summaryrefslogtreecommitdiffstats
path: root/sys/net/if_media.c
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2005-07-28 02:15:15 +0000
committerbrad <brad@openbsd.org>2005-07-28 02:15:15 +0000
commit50a50837e47c2f69907d9df50f1f14a2a01d5773 (patch)
tree64669d280cfd289e18bb2325f81d0d050f2f2d9d /sys/net/if_media.c
parentRCS id (diff)
downloadwireguard-openbsd-50a50837e47c2f69907d9df50f1f14a2a01d5773.tar.xz
wireguard-openbsd-50a50837e47c2f69907d9df50f1f14a2a01d5773.zip
rev 1.18
when there are multiple matches for the requested media, select the first matching instance rather than the last one. From chs NetBSD
Diffstat (limited to 'sys/net/if_media.c')
-rw-r--r--sys/net/if_media.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
index dcad56a2789..677b84feb52 100644
--- a/sys/net/if_media.c
+++ b/sys/net/if_media.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_media.c,v 1.15 2005/07/09 21:23:45 brad Exp $ */
+/* $OpenBSD: if_media.c,v 1.16 2005/07/28 02:15:15 brad Exp $ */
/* $NetBSD: if_media.c,v 1.10 2000/03/13 23:52:39 soren Exp $ */
/*-
@@ -362,12 +362,14 @@ ifmedia_match(struct ifmedia *ifm, u_int target, u_int mask)
for (next = TAILQ_FIRST(&ifm->ifm_list); next != NULL;
next = TAILQ_NEXT(next, ifm_list)) {
if ((next->ifm_media & mask) == (target & mask)) {
-#if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC)
if (match) {
+#if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC)
printf("ifmedia_match: multiple match for "
- "0x%x/0x%x\n", target, mask);
- }
+ "0x%x/0x%x, selected instance %d\n",
+ target, mask, IFM_INST(match->ifm_media));
#endif
+ break;
+ }
match = next;
}
}