]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
added locally modified files for broadcast support
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 18 May 2010 17:13:26 +0000 (19:13 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 18 May 2010 17:13:26 +0000 (19:13 +0200)
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c
src/lxc/conf.h
src/lxc/confile.c

index 2c9bc4e1d43df085c9699c09486e0fc31e832797..a0c7a7c4a71255298528887a6857644f6a0a8e50 100644 (file)
@@ -943,8 +943,8 @@ static int setup_ipv4_addr(struct lxc_list *ip, int ifindex)
 
                inetdev = iterator->elem;
 
-               err = lxc_ip_addr_add(AF_INET, ifindex,
-                                     &inetdev->addr, inetdev->prefix);
+               err = lxc_ipv4_addr_add(ifindex, &inetdev->addr,
+                                       &inetdev->bcast, inetdev->prefix);
                if (err) {
                        ERROR("failed to setup_ipv4_addr ifindex %d : %s",
                              ifindex, strerror(-err));
@@ -965,8 +965,9 @@ static int setup_ipv6_addr(struct lxc_list *ip, int ifindex)
 
                inet6dev = iterator->elem;
 
-               err = lxc_ip_addr_add(AF_INET6, ifindex,
-                                     &inet6dev->addr, inet6dev->prefix);
+               err = lxc_ipv6_addr_add(ifindex, &inet6dev->addr, 
+                                       &inet6dev->mcast, &inet6dev->acast,
+                                       inet6dev->prefix);
                if (err) {
                        ERROR("failed to setup_ipv6_addr ifindex %d : %s",
                              ifindex, strerror(-err));
index 845126607a0d51386efd7b4e8154693a5e9e893d..32135b656285186893a9d1bf7bdf4bebd23ef5d4 100644 (file)
@@ -62,7 +62,7 @@ struct lxc_route {
  */
 struct lxc_inet6dev {
        struct in6_addr addr;
-       struct in6_addr bcast;
+       struct in6_addr mcast;
        struct in6_addr acast;
        int prefix;
 };
index 8c1b3ddd15f4084279930e521a4111591db73809..993f9704fe87c5e6738c9de412681e182057f567 100644 (file)
@@ -405,16 +405,23 @@ static int config_network_ipv4(const char *key, char *value,
                return -1;
        }
 
-       if (bcast)
-               if (!inet_pton(AF_INET, bcast, &inetdev->bcast)) {
-                       SYSERROR("invalid ipv4 address: %s", value);
-                       return -1;
-               }
+       if (bcast && !inet_pton(AF_INET, bcast, &inetdev->bcast)) {
+               SYSERROR("invalid ipv4 broadcast address: %s", value);
+               return -1;
+       }
 
        /* no prefix specified, determine it from the network class */
        inetdev->prefix = prefix ? atoi(prefix) :
                config_ip_prefix(&inetdev->addr);
 
+       /* if no broadcast address, let compute one from the 
+        * prefix and address
+        */
+       if (!bcast) {
+               inetdev->bcast.s_addr = 
+                       htonl(INADDR_BROADCAST << (32 - inetdev->prefix));
+               inetdev->bcast.s_addr &= inetdev->addr.s_addr;
+       }
 
        lxc_list_add(&netdev->ipv4, list);