]>
git.proxmox.com Git - mirror_lxc.git/blob - src/tests/parse_config_file.c
3 * Copyright © 2017 Christian Brauner <christian.brauner@ubuntu.com>.
4 * Copyright © 2017 Canonical Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <lxc/lxccontainer.h>
26 #include <sys/types.h>
30 #include "confile_utils.h"
31 #include "lxc/state.h"
34 static int set_get_compare_clear_save_load(struct lxc_container
*c
,
35 const char *key
, const char *value
,
36 const char *config_file
,
39 char retval
[4096] = {0};
42 if (!c
->set_config_item(c
, key
, value
)) {
43 lxc_error("failed to set config item \"%s\" to \"%s\"\n", key
,
48 ret
= c
->get_config_item(c
, key
, retval
, sizeof(retval
));
50 lxc_error("failed to get config item \"%s\"\n", key
);
55 ret
= strcmp(retval
, value
);
58 "expected value \"%s\" and retrieved value \"%s\" "
59 "for config key \"%s\" do not match\n",
66 if (!c
->save_config(c
, config_file
)) {
67 lxc_error("%s\n", "failed to save config file");
74 if (!c
->load_config(c
, config_file
)) {
75 lxc_error("%s\n", "failed to load config file");
80 if (!c
->clear_config_item(c
, key
)) {
81 lxc_error("failed to clear config item \"%s\"\n", key
);
91 static int set_and_clear_complete_netdev(struct lxc_container
*c
)
93 if (!c
->set_config_item(c
, "lxc.net.1.type", "veth")) {
94 lxc_error("%s\n", "lxc.net.1.type");
98 if (!c
->set_config_item(c
, "lxc.net.1.ipv4", "10.0.2.3/24")) {
99 lxc_error("%s\n", "lxc.net.1.ipv4");
103 if (!c
->set_config_item(c
, "lxc.net.1.ipv4_gateway", "10.0.2.2")) {
104 lxc_error("%s\n", "lxc.net.1.ipv4");
108 if (!c
->set_config_item(c
, "lxc.net.1.ipv6",
109 "2003:db8:1:0:214:1234:fe0b:3596/64")) {
110 lxc_error("%s\n", "lxc.net.1.ipv6");
114 if (!c
->set_config_item(c
, "lxc.net.1.ipv6_gateway",
115 "2003:db8:1:0::1")) {
116 lxc_error("%s\n", "lxc.net.1.ipv6");
120 if (!c
->set_config_item(c
, "lxc.net.1.flags", "up")) {
121 lxc_error("%s\n", "lxc.net.1.flags");
125 if (!c
->set_config_item(c
, "lxc.net.1.link", "br0")) {
126 lxc_error("%s\n", "lxc.net.1.link");
130 if (!c
->set_config_item(c
, "lxc.net.1.veth.pair", "bla")) {
131 lxc_error("%s\n", "lxc.net.1.veth.pair");
135 if (!c
->set_config_item(c
, "lxc.net.1.hwaddr",
136 "52:54:00:80:7a:5d")) {
137 lxc_error("%s\n", "lxc.net.1.hwaddr");
141 if (!c
->set_config_item(c
, "lxc.net.1.mtu", "2000")) {
142 lxc_error("%s\n", "lxc.net.1.mtu");
146 if (!c
->clear_config_item(c
, "lxc.net.1")) {
147 lxc_error("%s", "failed to clear \"lxc.net.1\"\n");
157 int test_idmap_parser(void)
164 static struct idmap_check idmaps
[] = {
168 { true, "u 1 100001 999999999" },
169 { true, "g 1 100001 999999999" },
172 { true, "u 1000 165536 65536" },
173 { true, "g 999 999 1" },
174 { true, "u 0 5000 100000" },
175 { true, "g 577 789 5" },
176 { true, "u 65536 65536 1 " },
178 { false, "1u 0 0 0" },
179 { false, "1g 0 0 0a" },
180 { false, "1 u 0 0 0" },
181 { false, "1g 0 0 0 1" },
182 { false, "1u a0 b0 c0 d1" },
183 { false, "1g 0 b0 0 d1" },
184 { false, "1u a0 0 c0 1" },
185 { false, "g -1 0 -10" },
186 { false, "a 1 0 10" },
187 { false, "u 1 1 0 10" },
188 { false, "g 1 0 10 z " },
191 for (i
= 0; i
< sizeof(idmaps
) / sizeof(struct idmap_check
); i
++) {
192 unsigned long hostid
, nsid
, range
;
195 ret
= parse_idmaps(idmaps
[i
].idmap
, &type
, &nsid
, &hostid
,
197 if ((ret
< 0 && idmaps
[i
].is_valid
) ||
198 (ret
== 0 && !idmaps
[i
].is_valid
)) {
199 lxc_error("failed to parse idmap \"%s\"\n",
208 static int set_get_compare_clear_save_load_network(
209 struct lxc_container
*c
, const char *key
, const char *value
,
210 const char *config_file
, bool compare
, const char *network_type
)
212 char retval
[4096] = {0};
215 if (!c
->set_config_item(c
, "lxc.net.0.type", network_type
)) {
216 lxc_error("%s\n", "lxc.net.0.type");
220 if (!c
->set_config_item(c
, key
, value
)) {
221 lxc_error("failed to set config item \"%s\" to \"%s\"\n", key
,
226 ret
= c
->get_config_item(c
, key
, retval
, sizeof(retval
));
228 lxc_error("failed to get config item \"%s\"\n", key
);
233 ret
= strcmp(retval
, value
);
236 "expected value \"%s\" and retrieved value \"%s\" "
237 "for config key \"%s\" do not match\n",
244 if (!c
->save_config(c
, config_file
)) {
245 lxc_error("%s\n", "failed to save config file");
252 if (!c
->load_config(c
, config_file
)) {
253 lxc_error("%s\n", "failed to load config file");
258 if (!c
->clear_config_item(c
, key
)) {
259 lxc_error("failed to clear config item \"%s\"\n", key
);
263 if (!c
->clear_config_item(c
, "lxc.net.0.type")) {
264 lxc_error("%s\n", "lxc.net.0.type");
274 int main(int argc
, char *argv
[])
276 struct lxc_container
*c
;
278 int ret
= EXIT_FAILURE
;
279 char tmpf
[] = "lxc-parse-config-file-XXXXXX";
280 char retval
[4096] = {0};
282 c
= lxc_container_new(tmpf
, NULL
);
284 lxc_error("%s\n", "failed to create new container");
290 lxc_error("%s\n", "Could not create temporary file");
297 if (set_get_compare_clear_save_load(c
, "lxc.arch", "x86_64", tmpf
,
299 lxc_error("%s\n", "lxc.arch");
304 if (set_get_compare_clear_save_load(c
, "lxc.pts", "1000", tmpf
, true) <
306 lxc_error("%s\n", "lxc.pts");
311 if (set_get_compare_clear_save_load(c
, "lxc.tty", "4", tmpf
, true) <
313 lxc_error("%s\n", "lxc.tty");
318 legacy devttydir keys
320 if (set_get_compare_clear_save_load(c
, "lxc.devttydir", "not-dev", tmpf
,
322 lxc_error("%s\n", "lxc.devttydir");
327 if (set_get_compare_clear_save_load(c
, "lxc.tty.dir", "not-dev", tmpf
,
329 lxc_error("%s\n", "lxc.tty.dir");
336 if (set_get_compare_clear_save_load(c
, "lxc.aa_profile", "unconfined",
338 lxc_error("%s\n", "lxc.aa_profile");
345 if (set_get_compare_clear_save_load(c
, "lxc.aa_allow_incomplete", "1",
347 lxc_error("%s\n", "lxc.aa_allow_incomplete");
354 if (set_get_compare_clear_save_load(c
, "lxc.se_context", "system_u:system_r:lxc_t:s0:c22",
356 lxc_error("%s\n", "lxc.apparmor.se_context");
360 /* lxc.apparmor.profile */
361 if (set_get_compare_clear_save_load(c
, "lxc.apparmor.profile", "unconfined",
363 lxc_error("%s\n", "lxc.apparmor.profile");
367 /* lxc.apparmor.allow_incomplete */
368 if (set_get_compare_clear_save_load(c
, "lxc.apparmor.allow_incomplete", "1",
370 lxc_error("%s\n", "lxc.apparmor.allow_incomplete");
374 /* lxc.selinux.context */
375 if (set_get_compare_clear_save_load(c
, "lxc.selinux.context", "system_u:system_r:lxc_t:s0:c22",
377 lxc_error("%s\n", "lxc.apparmor.selinux.context");
381 /* lxc.cgroup.cpuset.cpus */
382 if (set_get_compare_clear_save_load(c
, "lxc.cgroup.cpuset.cpus",
383 "1-100", tmpf
, false) < 0) {
384 lxc_error("%s\n", "lxc.cgroup.cpuset.cpus");
389 if (!c
->set_config_item(c
, "lxc.cgroup.cpuset.cpus", "1-100")) {
390 lxc_error("%s\n", "failed to set config item "
391 "\"lxc.cgroup.cpuset.cpus\" to \"1-100\"");
395 if (!c
->set_config_item(c
, "lxc.cgroup.memory.limit_in_bytes",
399 "failed to set config item "
400 "\"lxc.cgroup.memory.limit_in_bytes\" to \"123456789\"");
404 if (!c
->get_config_item(c
, "lxc.cgroup", retval
, sizeof(retval
))) {
405 lxc_error("%s\n", "failed to get config item \"lxc.cgroup\"");
413 * We can't really save the config here since save_config() wants to
414 * chown the container's directory but we haven't created an on-disk
415 * container. So let's test set-get-clear.
417 if (set_get_compare_clear_save_load(
418 c
, "lxc.id_map", "u 0 100000 1000000000", NULL
, false) < 0) {
419 lxc_error("%s\n", "lxc.id_map");
423 if (!c
->set_config_item(c
, "lxc.id_map", "u 1 100000 10000000")) {
424 lxc_error("%s\n", "failed to set config item "
425 "\"lxc.id_map\" to \"u 1 100000 10000000\"");
429 if (!c
->set_config_item(c
, "lxc.id_map", "g 1 100000 10000000")) {
430 lxc_error("%s\n", "failed to set config item "
431 "\"lxc.id_map\" to \"g 1 100000 10000000\"");
435 if (!c
->get_config_item(c
, "lxc.id_map", retval
, sizeof(retval
))) {
436 lxc_error("%s\n", "failed to get config item \"lxc.cgroup\"");
444 legacy lxc.loglevel key
446 if (set_get_compare_clear_save_load(c
, "lxc.loglevel", "DEBUG", tmpf
,
448 lxc_error("%s\n", "lxc.loglevel");
453 legacy lxc.logfile key
455 if (set_get_compare_clear_save_load(c
, "lxc.logfile", "/some/path",
457 lxc_error("%s\n", "lxc.logfile");
463 if (set_get_compare_clear_save_load(c
, "lxc.log.level", "DEBUG", tmpf
,
465 lxc_error("%s\n", "lxc.log.level");
470 if (set_get_compare_clear_save_load(c
, "lxc.log.file", "/some/path",
472 lxc_error("%s\n", "lxc.log.file");
477 if (set_get_compare_clear_save_load(c
, "lxc.mount", "/some/path", NULL
,
479 lxc_error("%s\n", "lxc.mount");
484 * Note that we cannot compare the values since the getter for
485 * lxc.mount.auto does not preserve ordering.
487 if (set_get_compare_clear_save_load(c
, "lxc.mount.auto",
488 "proc:rw sys:rw cgroup-full:rw",
490 lxc_error("%s\n", "lxc.mount.auto");
495 * Note that we cannot compare the values since the getter for
496 * lxc.mount.entry appends newlines.
498 if (set_get_compare_clear_save_load(
499 c
, "lxc.mount.entry",
500 "/dev/dri dev/dri none bind,optional,create=dir", tmpf
,
502 lxc_error("%s\n", "lxc.mount.entry");
507 legacy lxc.rootfs key
509 if (set_get_compare_clear_save_load(c
, "lxc.rootfs", "/some/path", tmpf
,
511 lxc_error("%s\n", "lxc.rootfs");
515 /* lxc.rootfs.path */
516 if (set_get_compare_clear_save_load(c
, "lxc.rootfs.path", "/some/path", tmpf
,
518 lxc_error("%s\n", "lxc.rootfs.path");
522 /* lxc.rootfs.mount */
523 if (set_get_compare_clear_save_load(c
, "lxc.rootfs.mount", "/some/path",
525 lxc_error("%s\n", "lxc.rootfs.mount");
529 /* lxc.rootfs.options */
530 if (set_get_compare_clear_save_load(c
, "lxc.rootfs.options",
531 "ext4,discard", tmpf
, true) < 0) {
532 lxc_error("%s\n", "lxc.rootfs.options");
537 legacy lxc.utsname key
539 if (set_get_compare_clear_save_load(c
, "lxc.utsname", "the-shire", tmpf
,
541 lxc_error("%s\n", "lxc.utsname");
546 if (set_get_compare_clear_save_load(c
, "lxc.uts.name", "the-shire", tmpf
,
548 lxc_error("%s\n", "lxc.uts.name");
552 /* lxc.hook.pre-start */
553 if (set_get_compare_clear_save_load(
554 c
, "lxc.hook.pre-start", "/some/pre-start", tmpf
, false) < 0) {
555 lxc_error("%s\n", "lxc.hook.pre-start");
559 /* lxc.hook.pre-mount */
560 if (set_get_compare_clear_save_load(
561 c
, "lxc.hook.pre-mount", "/some/pre-mount", tmpf
, false) < 0) {
562 lxc_error("%s\n", "lxc.hook.pre-mount");
567 if (set_get_compare_clear_save_load(c
, "lxc.hook.mount", "/some/mount",
569 lxc_error("%s\n", "lxc.hook.mount");
573 /* lxc.hook.autodev */
574 if (set_get_compare_clear_save_load(c
, "lxc.hook.autodev",
575 "/some/autodev", tmpf
, false) < 0) {
576 lxc_error("%s\n", "lxc.hook.autodev");
581 if (set_get_compare_clear_save_load(c
, "lxc.hook.start", "/some/start",
583 lxc_error("%s\n", "lxc.hook.start");
588 if (set_get_compare_clear_save_load(c
, "lxc.hook.stop", "/some/stop",
590 lxc_error("%s\n", "lxc.hook.stop");
594 /* lxc.hook.post-stop */
595 if (set_get_compare_clear_save_load(
596 c
, "lxc.hook.post-stop", "/some/post-stop", tmpf
, false) < 0) {
597 lxc_error("%s\n", "lxc.hook.post-stop");
602 if (set_get_compare_clear_save_load(c
, "lxc.hook.clone", "/some/clone",
604 lxc_error("%s\n", "lxc.hook.clone");
608 /* lxc.hook.destroy */
609 if (set_get_compare_clear_save_load(c
, "lxc.hook.destroy",
610 "/some/destroy", tmpf
, false) < 0) {
611 lxc_error("%s\n", "lxc.hook.destroy");
616 if (set_get_compare_clear_save_load(c
, "lxc.cap.drop",
617 "sys_module mknod setuid net_raw",
619 lxc_error("%s\n", "lxc.cap.drop");
624 if (set_get_compare_clear_save_load(c
, "lxc.cap.keep",
625 "sys_module mknod setuid net_raw",
627 lxc_error("%s\n", "lxc.cap.keep");
632 if (set_get_compare_clear_save_load(c
, "lxc.console", "none", tmpf
,
634 lxc_error("%s\n", "lxc.console");
638 /* lxc.console.logfile */
639 if (set_get_compare_clear_save_load(c
, "lxc.console.logfile",
640 "/some/logfile", tmpf
, true) < 0) {
641 lxc_error("%s\n", "lxc.console.logfile");
646 if (set_get_compare_clear_save_load(
647 c
, "lxc.seccomp", "/some/seccomp/file", tmpf
, true) < 0) {
648 lxc_error("%s\n", "lxc.seccomp");
653 if (set_get_compare_clear_save_load(c
, "lxc.autodev", "1", tmpf
, true) <
655 lxc_error("%s\n", "lxc.autodev");
660 legacy lxc.haltsignal key
662 if (set_get_compare_clear_save_load(c
, "lxc.haltsignal", "1", tmpf
,
664 lxc_error("%s\n", "lxc.haltsignal");
668 /* lxc.signal.halt */
669 if (set_get_compare_clear_save_load(c
, "lxc.signal.halt", "1", tmpf
,
671 lxc_error("%s\n", "lxc.signal.halt");
676 legacy lxc.rebootsignal key
678 if (set_get_compare_clear_save_load(c
, "lxc.rebootsignal", "1", tmpf
,
680 lxc_error("%s\n", "lxc.rebootsignal");
684 /* lxc.signal.reboot */
685 if (set_get_compare_clear_save_load(c
, "lxc.signal.reboot", "1", tmpf
,
687 lxc_error("%s\n", "lxc.signal.reboot");
692 legacy lxc.stopsignal key
694 if (set_get_compare_clear_save_load(c
, "lxc.stopsignal", "1", tmpf
,
696 lxc_error("%s\n", "lxc.stopsignal");
700 /* lxc.signal.stop */
701 if (set_get_compare_clear_save_load(c
, "lxc.signal.stop", "1", tmpf
,
703 lxc_error("%s\n", "lxc.signal.stop");
708 if (set_get_compare_clear_save_load(c
, "lxc.start.auto", "1", tmpf
,
710 lxc_error("%s\n", "lxc.start.auto");
714 /* lxc.start.delay */
715 if (set_get_compare_clear_save_load(c
, "lxc.start.delay", "5", tmpf
,
717 lxc_error("%s\n", "lxc.start.delay");
721 /* lxc.start.order */
722 if (set_get_compare_clear_save_load(c
, "lxc.start.order", "1", tmpf
,
724 lxc_error("%s\n", "lxc.start.order");
729 if (set_get_compare_clear_save_load(c
, "lxc.log.syslog", "local0", tmpf
,
731 lxc_error("%s\n", "lxc.log.syslog");
736 if (set_get_compare_clear_save_load(c
, "lxc.utsname", "get-schwifty",
738 lxc_error("%s\n", "lxc.utsname");
742 /* lxc.monitor.unshare */
743 if (set_get_compare_clear_save_load(c
, "lxc.monitor.unshare", "1", tmpf
,
745 lxc_error("%s\n", "lxc.monitor.unshare");
750 if (set_get_compare_clear_save_load(
751 c
, "lxc.group", "some,container,groups", tmpf
, false) < 0) {
752 lxc_error("%s\n", "lxc.group");
756 /* lxc.environment */
757 if (set_get_compare_clear_save_load(c
, "lxc.environment", "FOO=BAR",
759 lxc_error("%s\n", "lxc.environment");
764 legacy lxc.init_cmd key
766 if (set_get_compare_clear_save_load(c
, "lxc.init_cmd", "/bin/bash",
768 lxc_error("%s\n", "lxc.init_cmd");
773 if (set_get_compare_clear_save_load(c
, "lxc.init.cmd", "/bin/bash",
775 lxc_error("%s\n", "lxc.init.cmd");
780 legacy lxc.init_uid key
782 if (set_get_compare_clear_save_load(c
, "lxc.init_uid", "1000", tmpf
,
784 lxc_error("%s\n", "lxc.init_uid");
789 if (set_get_compare_clear_save_load(c
, "lxc.init.uid", "1000", tmpf
,
791 lxc_error("%s\n", "lxc.init.uid");
796 legacy lxc.init_gid key
798 if (set_get_compare_clear_save_load(c
, "lxc.init_gid", "1000", tmpf
,
800 lxc_error("%s\n", "lxc.init_gid");
805 if (set_get_compare_clear_save_load(c
, "lxc.init.gid", "1000", tmpf
,
807 lxc_error("%s\n", "lxc.init.gid");
812 if (set_get_compare_clear_save_load(c
, "lxc.ephemeral", "1", tmpf
,
814 lxc_error("%s\n", "lxc.ephemeral");
818 /* lxc.no_new_privs */
819 if (set_get_compare_clear_save_load(c
, "lxc.no_new_privs", "1", tmpf
,
821 lxc_error("%s\n", "lxc.no_new_privs");
826 legacy lxc.limit.* key
828 if (set_get_compare_clear_save_load(c
, "lxc.limit.nofile", "65536",
830 lxc_error("%s\n", "lxc.limit.nofile");
834 /* lxc.prlimit.nofile */
835 if (set_get_compare_clear_save_load(c
, "lxc.prlimit.nofile", "65536",
837 lxc_error("%s\n", "lxc.prlimit.nofile");
841 if (test_idmap_parser() < 0) {
842 lxc_error("%s\n", "failed to test parser for \"lxc.id_map\"");
846 if (set_get_compare_clear_save_load(c
, "lxc.net.0.type", "veth",
848 lxc_error("%s\n", "lxc.net.0.type");
852 if (set_get_compare_clear_save_load(c
, "lxc.net.2.type", "none",
854 lxc_error("%s\n", "lxc.net.2.type");
858 if (set_get_compare_clear_save_load(c
, "lxc.net.3.type", "empty",
860 lxc_error("%s\n", "lxc.net.3.type");
864 if (set_get_compare_clear_save_load(c
, "lxc.net.4.type", "vlan",
866 lxc_error("%s\n", "lxc.net.4.type");
870 if (set_get_compare_clear_save_load(c
, "lxc.net.0.type", "macvlan",
872 lxc_error("%s\n", "lxc.net.0.type");
876 if (set_get_compare_clear_save_load(c
, "lxc.net.1000.type", "phys",
878 lxc_error("%s\n", "lxc.net.1000.type");
882 if (set_get_compare_clear_save_load(c
, "lxc.net.0.flags", "up",
884 lxc_error("%s\n", "lxc.net.0.flags");
888 if (set_get_compare_clear_save_load(c
, "lxc.net.0.name", "eth0",
890 lxc_error("%s\n", "lxc.net.0.name");
894 if (set_get_compare_clear_save_load(c
, "lxc.net.0.link", "bla",
896 lxc_error("%s\n", "lxc.net.0.link");
900 if (set_get_compare_clear_save_load_network(
901 c
, "lxc.net.0.macvlan.mode", "private", tmpf
, true,
903 lxc_error("%s\n", "lxc.net.0.macvlan.mode");
907 if (set_get_compare_clear_save_load_network(
908 c
, "lxc.net.0.macvlan.mode", "vepa", tmpf
, true,
910 lxc_error("%s\n", "lxc.net.0.macvlan.mode");
914 if (set_get_compare_clear_save_load_network(
915 c
, "lxc.net.0.macvlan.mode", "bridge", tmpf
, true,
917 lxc_error("%s\n", "lxc.net.0.macvlan.mode");
921 if (set_get_compare_clear_save_load_network(
922 c
, "lxc.net.0.veth.pair", "clusterfuck", tmpf
, true,
924 lxc_error("%s\n", "lxc.net.0.veth.pair");
928 if (set_get_compare_clear_save_load(c
, "lxc.net.0.script.up",
929 "/some/up/path", tmpf
, true)) {
930 lxc_error("%s\n", "lxc.net.0.script.up");
934 if (set_get_compare_clear_save_load(c
, "lxc.net.0.script.down",
935 "/some/down/path", tmpf
, true)) {
936 lxc_error("%s\n", "lxc.net.0.script.down");
940 if (set_get_compare_clear_save_load(c
, "lxc.net.0.hwaddr",
941 "52:54:00:80:7a:5d", tmpf
, true)) {
942 lxc_error("%s\n", "lxc.net.0.hwaddr");
946 if (set_get_compare_clear_save_load(c
, "lxc.net.0.mtu", "2000",
948 lxc_error("%s\n", "lxc.net.0.mtu");
952 if (set_get_compare_clear_save_load_network(c
, "lxc.net.0.vlan.id",
953 "2", tmpf
, true, "vlan")) {
954 lxc_error("%s\n", "lxc.net.0.vlan.id");
958 if (set_get_compare_clear_save_load(c
, "lxc.net.0.ipv4.gateway",
959 "10.0.2.2", tmpf
, true)) {
960 lxc_error("%s\n", "lxc.net.0.ipv4.gateway");
964 if (set_get_compare_clear_save_load(c
, "lxc.net.0.ipv6.gateway",
965 "2003:db8:1::1", tmpf
, true)) {
966 lxc_error("%s\n", "lxc.net.0.ipv6.gateway");
970 if (set_get_compare_clear_save_load(c
, "lxc.net.0.ipv4",
971 "10.0.2.3/24", tmpf
, true)) {
972 lxc_error("%s\n", "lxc.net.0.ipv4");
976 if (set_get_compare_clear_save_load(
977 c
, "lxc.net.0.ipv6", "2003:db8:1:0:214:1234:fe0b:3596/64",
979 lxc_error("%s\n", "lxc.net.0.ipv6");
983 if (set_and_clear_complete_netdev(c
) < 0) {
984 lxc_error("%s\n", "failed to clear whole network");
992 lxc_container_put(c
);