]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Don't forget network prefix information
authorRobert Vogelgesang <vogel@users.sourceforge.net>
Mon, 20 Jan 2014 17:35:57 +0000 (18:35 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 20 Jan 2014 20:17:45 +0000 (15:17 -0500)
Include the IPv4/IPv6 prefix if it's set.

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/confile.c

index a53d73a2310f859601bfacd474c86b0a0229af4e..aa2d75903d295a626167e988eed54503a436297d 100644 (file)
@@ -2267,7 +2267,11 @@ void write_config(FILE *fout, struct lxc_conf *c)
                        struct lxc_inetdev *i = it2->elem;
                        char buf[INET_ADDRSTRLEN];
                        inet_ntop(AF_INET, &i->addr, buf, sizeof(buf));
-                       fprintf(fout, "lxc.network.ipv4 = %s\n", buf);
+                       if (i->prefix)
+                               fprintf(fout, "lxc.network.ipv4 = %s/%d\n",
+                                       buf, i->prefix);
+                       else
+                               fprintf(fout, "lxc.network.ipv4 = %s\n", buf);
                }
                if (n->ipv6_gateway_auto)
                        fprintf(fout, "lxc.network.ipv6.gateway = auto\n");
@@ -2280,7 +2284,11 @@ void write_config(FILE *fout, struct lxc_conf *c)
                        struct lxc_inet6dev *i = it2->elem;
                        char buf[INET6_ADDRSTRLEN];
                        inet_ntop(AF_INET6, &i->addr, buf, sizeof(buf));
-                       fprintf(fout, "lxc.network.ipv6 = %s\n", buf);
+                       if (i->prefix)
+                               fprintf(fout, "lxc.network.ipv6 = %s/%d\n",
+                                       buf, i->prefix);
+                       else
+                               fprintf(fout, "lxc.network.ipv6 = %s\n", buf);
                }
        }
        lxc_list_for_each(it, &c->caps)