summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2012-07-25 18:18:59 +0000
committermiod <miod@openbsd.org>2012-07-25 18:18:59 +0000
commit8ee6d84e48f43b73c092fc8894a4427d013e152e (patch)
tree0dbad75a053ea8650b827caf19d10a0311c47560
parentdecls before code (diff)
downloadwireguard-openbsd-8ee6d84e48f43b73c092fc8894a4427d013e152e.tar.xz
wireguard-openbsd-8ee6d84e48f43b73c092fc8894a4427d013e152e.zip
When reporting media state, be sure to set IFM_AVALID and IFM_ACTIVE in
ifm_status, for dhclient's sake. Current dhclient interface_status() considers interfaces able to report media information but not returning IFM_AVALID as down. Note that these interfaces usually have mii(4) or have specific code reporting correct values; sparc le(4) is an exception. Found the hard way by sebastia@; joint work with krw@, ok deraadt@
-rw-r--r--sys/arch/sparc/dev/if_le.c5
-rw-r--r--sys/dev/sbus/if_le_ledma.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c
index 0a8b22f562f..c01e21d58e1 100644
--- a/sys/arch/sparc/dev/if_le.c
+++ b/sys/arch/sparc/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.31 2010/07/10 19:32:24 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.32 2012/07/25 18:18:59 miod Exp $ */
/* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */
/*-
@@ -278,6 +278,8 @@ lemediastatus(ifp, ifmr)
struct am7990_softc *sc = ifp->if_softc;
struct le_softc *lesc = (struct le_softc *)sc;
+ ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
+
if (lesc->sc_dma == NULL) {
if (lesc->sc_lebufchild)
ifmr->ifm_active = IFM_ETHER | IFM_10_T;
@@ -298,6 +300,7 @@ lemediastatus(ifp, ifmr)
else
ifmr->ifm_active = IFM_ETHER | IFM_10_5;
#else
+ ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
ifmr->ifm_active = IFM_ETHER | IFM_10_5;
#endif
}
diff --git a/sys/dev/sbus/if_le_ledma.c b/sys/dev/sbus/if_le_ledma.c
index bbd6663e24f..a2cb145126f 100644
--- a/sys/dev/sbus/if_le_ledma.c
+++ b/sys/dev/sbus/if_le_ledma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le_ledma.c,v 1.14 2008/06/26 05:42:18 ray Exp $ */
+/* $OpenBSD: if_le_ledma.c,v 1.15 2012/07/25 18:18:59 miod Exp $ */
/* $NetBSD: if_le_ledma.c,v 1.14 2001/05/30 11:46:35 mrg Exp $ */
/*-
@@ -206,6 +206,8 @@ lemediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
/*
* Notify the world which media we're currently using.
*/
+ ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
+
if (L64854_GCSR(dma) & E_TP_AUI)
ifmr->ifm_active = IFM_ETHER|IFM_10_T;
else