]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Set the broadcast flag for interfaces that say they need it.
authorRoy Marples <roy@marples.name>
Fri, 5 Mar 2010 15:47:46 +0000 (15:47 +0000)
committerRoy Marples <roy@marples.name>
Fri, 5 Mar 2010 15:47:46 +0000 (15:47 +0000)
dhcpcd.c
if-bsd.c
if-linux.c
net.h

index ac077ad2616f99d16ce7db8ec79b02e9d729adaa..170af36b6709911823c7f9f396afe431da7ba35e 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -765,6 +765,9 @@ configure_interface1(struct interface *iface)
        uint8_t *duid;
        size_t len = 0, ifl;
 
+       /* Do any platform specific configuration */
+       if_conf(iface);
+
        if (iface->flags & IFF_POINTOPOINT && !(ifo->options & DHCPCD_INFORM))
                ifo->options |= DHCPCD_STATIC;
        if (iface->flags & IFF_NOARP ||
index 05a2d5157aa89e87425132db5a188494e356afb9..8ca2f28a8cf4eac2511d2c5d8606d8d930dd1dad 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -79,6 +79,13 @@ if_init(_unused struct interface *iface)
        return 0;
 }
 
+int
+if_conf(_unused struct interface *iface)
+{
+       /* No extra checks needed on BSD */
+       return 0;
+}
+
 int
 init_sockets(void)
 {
index 705f775383b242a19563cc56939a3c526d8c8870..58d732d5513aa18ba5da5cd5dea06e6b5e346202 100644 (file)
@@ -85,6 +85,26 @@ if_init(struct interface *iface)
        return n == -1 ? -1 : 0;
 }
 
+int
+if_conf(struct interface *iface)
+{
+       char path[PATH_MAX], buf[1];
+       FILE *fp;
+
+       /* Some qeth setups require the use of the broadcast flag. */
+       snprintf(path, sizeof(path),
+           "/sys/class/net/%s/device/layer2",
+           iface->name);
+
+       fp = fopen(path, "r");
+       if (fp == NULL)
+               return errno == ENOENT ? 0 : -1;
+       if (fgets(buf, sizeof(buf), fp) != NULL && buf[0] == '0')
+               iface->state->options->options |= DHCPCD_BROADCAST;
+       fclose(fp);
+       return 0;
+}
+
 static int
 _open_link_socket(struct sockaddr_nl *nl)
 {
diff --git a/net.h b/net.h
index 4f92f0a7c85a5af36cae927916de23f9e4b630ec..4d6eaadaa9487be244b22179b3e4d85d49cc7b45 100644 (file)
--- a/net.h
+++ b/net.h
@@ -105,6 +105,7 @@ int inet_ntocidr(struct in_addr);
 int inet_cidrtoaddr(int, struct in_addr *);
 
 int up_interface(struct interface *);
+int if_conf(struct interface *);
 int if_init(struct interface *);
 
 int do_address(const char *,