Commit be660853 by Stéphane Graber

conf: Save lxc.network.ipv4 broadcast address

parent 8c39f7a4
...@@ -2274,11 +2274,19 @@ void write_config(FILE *fout, struct lxc_conf *c) ...@@ -2274,11 +2274,19 @@ void write_config(FILE *fout, struct lxc_conf *c)
struct lxc_inetdev *i = it2->elem; struct lxc_inetdev *i = it2->elem;
char buf[INET_ADDRSTRLEN]; char buf[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &i->addr, buf, sizeof(buf)); inet_ntop(AF_INET, &i->addr, buf, sizeof(buf));
fprintf(fout, "lxc.network.ipv4 = %s", buf);
if (i->prefix) if (i->prefix)
fprintf(fout, "lxc.network.ipv4 = %s/%d\n", fprintf(fout, "/%d", i->prefix);
buf, i->prefix);
if (i->bcast.s_addr != (i->addr.s_addr |
htonl(INADDR_BROADCAST >> i->prefix))) {
inet_ntop(AF_INET, &i->bcast, buf, sizeof(buf));
fprintf(fout, " %s\n", buf);
}
else else
fprintf(fout, "lxc.network.ipv4 = %s\n", buf); fprintf(fout, "\n");
} }
if (n->ipv6_gateway_auto) if (n->ipv6_gateway_auto)
fprintf(fout, "lxc.network.ipv6.gateway = auto\n"); fprintf(fout, "lxc.network.ipv6.gateway = auto\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment