]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix carrier handling on BSD
authorRoy Marples <roy@marples.name>
Wed, 23 Nov 2011 09:57:34 +0000 (09:57 +0000)
committerRoy Marples <roy@marples.name>
Wed, 23 Nov 2011 09:57:34 +0000 (09:57 +0000)
dhcpcd.c
if-bsd.c

index 80aa04ad858a89ea351966102ee99fb09586163a..9449d0137d57639e8c255641fd39494445e04bc4 100644 (file)
--- 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);
index 56585bfc0900b3df901243e691872b20ea0421bd..6c8c968f2726a972d8cb944c8cc82d4b8fdb527a 100644 (file)
--- 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);