From fd3d448fa8ee0fb834598d866067dde8be06b746 Mon Sep 17 00:00:00 2001 From: Pyun YongHyeon Date: Fri, 30 Mar 2012 05:27:05 +0000 Subject: [PATCH] Do not report current link status if driver is not running. This change also workarounds dhclient's link state handling bug by not giving current link status. Unlike other controllers, ale(4)'s PHY hibernation perfectly works such that driver does not see a valid link if the controller is not brought up. If dhclient(8) runs on ale(4) it will blindly waits until link UP and then gives up after 10 seconds. Because dhclient(8) still thinks interface got a valid link when IFM_AVALID is not set for selected media, this change makes dhclient initiate DHCP without waiting for link UP. --- sys/dev/ale/if_ale.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/ale/if_ale.c b/sys/dev/ale/if_ale.c index 31255e15753..f79346c2c4f 100644 --- a/sys/dev/ale/if_ale.c +++ b/sys/dev/ale/if_ale.c @@ -301,6 +301,10 @@ ale_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) sc = ifp->if_softc; ALE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ALE_UNLOCK(sc); + return; + } mii = device_get_softc(sc->ale_miibus); mii_pollstat(mii);