[lxc-devel] [PATCH] Don't forget network prefix information
Stéphane Graber
stgraber at ubuntu.com
Mon Jan 20 20:17:21 UTC 2014
On Mon, Jan 20, 2014 at 06:35:57PM +0100, Robert Vogelgesang wrote:
> Include the IPv4/IPv6 prefix if it's set.
>
> Signed-off-by: Robert Vogelgesang <vogel at users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
>
> 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)
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140120/366fb2c8/attachment.pgp>
More information about the lxc-devel
mailing list