[lxc-devel] [PATCH] Don't forget network prefix information
Robert Vogelgesang
vogel at users.sourceforge.net
Mon Jan 20 17:35:57 UTC 2014
Include the IPv4/IPv6 prefix if it's set.
Signed-off-by: Robert Vogelgesang <vogel at users.sourceforge.net>
diff -u lxc-lxc-1.0.0.beta2/src/lxc/confile.c.writeprefix lxc-lxc-1.0.0.beta2/src/lxc/confile.c
--- lxc-lxc-1.0.0.beta2/src/lxc/confile.c.writeprefix 2014-01-16 01:07:33.000000000 +0100
+++ lxc-lxc-1.0.0.beta2/src/lxc/confile.c 2014-01-20 18:20:16.616979009 +0100
@@ -2267,7 +2267,11 @@
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 @@
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)
More information about the lxc-devel
mailing list