Skip to content

Commit

Permalink
Don't forget network prefix information
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Vogelgesang authored and stgraber committed Jan 20, 2014
1 parent c868b26 commit 89addaa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lxc/confile.c
Expand Up @@ -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");
Expand All @@ -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)
Expand Down

0 comments on commit 89addaa

Please sign in to comment.