From: Roy Marples Date: Wed, 23 Nov 2011 09:57:34 +0000 (+0000) Subject: Fix carrier handling on BSD X-Git-Tag: v5.5.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f3b570cfd3502255f90e1c53b927688971a53a8;p=thirdparty%2Fdhcpcd.git Fix carrier handling on BSD --- diff --git a/dhcpcd.c b/dhcpcd.c index 80aa04ad..9449d013 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -897,7 +897,7 @@ handle_carrier(int action, int flags, const char *ifname) } if (carrier == -1) syslog(LOG_ERR, "%s: carrier_status: %m", ifname); - else if (carrier == 0 || !(iface->flags & IFF_RUNNING)) { + else if (carrier == 0 || !(iface->flags & (IFF_UP || IFF_RUNNING))) { if (iface->carrier != LINK_DOWN) { iface->carrier = LINK_DOWN; syslog(LOG_INFO, "%s: carrier lost", iface->name); @@ -905,7 +905,7 @@ handle_carrier(int action, int flags, const char *ifname) delete_timeouts(iface, start_expire, NULL); drop_config(iface, "NOCARRIER"); } - } else if (carrier == 1 && (iface->flags & IFF_RUNNING)) { + } else if (carrier == 1 && (iface->flags & (IFF_UP || IFF_RUNNING))) { if (iface->carrier != LINK_UP) { iface->carrier = LINK_UP; syslog(LOG_INFO, "%s: carrier acquired", iface->name); diff --git a/if-bsd.c b/if-bsd.c index 56585bfc..6c8c968f 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -366,14 +366,11 @@ manage_link(int fd) break; switch (ifm->ifm_data.ifi_link_state) { case LINK_STATE_DOWN: - len = 1; - break; - case LINK_STATE_UP: len = -1; break; default: - len = ifm->ifm_flags & IFF_RUNNING - ? 1 : -1; + len = ifm->ifm_flags & + (IFF_UP || IFF_RUNNING) ? 1 : -1; break; } handle_carrier(len, ifm->ifm_flags, ifname);