summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-07-28 02:15:16 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-07-28 02:15:16 +0000
commit7af6159a89195af7dab9ac63d8196ba4f174c5b0 (patch)
treedd363b667671ffd640c543745fe966293d76ef5e /sys
parent291939fec77534baf034b3a028306387ae0014ae (diff)
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')
-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;
}
}