From: Robert Vogelgesang Date: Mon, 20 Jan 2014 17:35:57 +0000 (+0100) Subject: Don't forget network prefix information X-Git-Tag: lxc-1.0.0.beta3~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89addaa75df866b97726d78597a3bfa99835ce54;p=thirdparty%2Flxc.git Don't forget network prefix information Include the IPv4/IPv6 prefix if it's set. Signed-off-by: Robert Vogelgesang Acked-by: Stéphane Graber --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index a53d73a23..aa2d75903 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -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)