]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Bridge interfaces set IFF_LOWER_UP when they have a valid
authorRoy Marples <roy@marples.name>
Wed, 23 Nov 2011 13:49:44 +0000 (13:49 +0000)
committerRoy Marples <roy@marples.name>
Wed, 23 Nov 2011 13:49:44 +0000 (13:49 +0000)
hardware address. To trigger a valid hardware address pickup
we need to pretend that that don't exist until they have
IFF_LOWER_UP set.

if-linux.c

index 4b7ac682c471bbd80cd5b5eb259ef819b4276b1b..15c3668434095020c1ed3c618fd3c3d0cc418067 100644 (file)
 # define IFLA_WIRELESS (IFLA_MASTER + 1)
 #endif
 
+/* For some reason, glibc doesn't include newer flags from linux/if.h
+ * However, we cannot include linux/if.h directly as it conflicts
+ * with the glibc version. D'oh! */
+#ifndef IFF_LOWER_UP
+#define IFF_LOWER_UP   0x10000         /* driver signals L1 up         */
+#endif
+
 #include <errno.h>
 #include <ctype.h>
 #include <stddef.h>
@@ -377,6 +384,15 @@ link_netlink(struct nlmsghdr *nlm)
                return 1;
        }
 
+       /* Bridge interfaces set IFF_LOWER_UP when they have a valid
+        * hardware address. To trigger a valid hardware address pickup
+        * we need to pretend that that don't exist until they have
+        * IFF_LOWER_UP set. */
+       if (ifi->ifi_flags & IFF_MASTER && !(ifi->ifi_flags & IFF_LOWER_UP)) {
+               handle_interface(-1, ifn);
+               return 1;
+       }
+
        handle_carrier(ifi->ifi_flags & IFF_RUNNING ? 1 : -1,
            ifi->ifi_flags, ifn);
        return 1;