]>
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.address", "10.0.2.3/24")) {
99 lxc_error("%s\n", "lxc.net.1.ipv4.address");
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.gateway");
108 if (!c
->set_config_item(c
, "lxc.net.1.ipv6.address",
109 "2003:db8:1:0:214:1234:fe0b:3596/64")) {
110 lxc_error("%s\n", "lxc.net.1.ipv6.address");
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.gateway");
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");
479 if (set_get_compare_clear_save_load(c
, "lxc.mount", "/some/path", NULL
,
481 lxc_error("%s\n", "lxc.mount");
485 /* lxc.mount.fstab */
486 if (set_get_compare_clear_save_load(c
, "lxc.mount.fstab", "/some/path", NULL
,
488 lxc_error("%s\n", "lxc.mount.fstab");
493 * Note that we cannot compare the values since the getter for
494 * lxc.mount.auto does not preserve ordering.
496 if (set_get_compare_clear_save_load(c
, "lxc.mount.auto",
497 "proc:rw sys:rw cgroup-full:rw",
499 lxc_error("%s\n", "lxc.mount.auto");
504 * Note that we cannot compare the values since the getter for
505 * lxc.mount.entry appends newlines.
507 if (set_get_compare_clear_save_load(
508 c
, "lxc.mount.entry",
509 "/dev/dri dev/dri none bind,optional,create=dir", tmpf
,
511 lxc_error("%s\n", "lxc.mount.entry");
516 legacy lxc.rootfs key
518 if (set_get_compare_clear_save_load(c
, "lxc.rootfs", "/some/path", tmpf
,
520 lxc_error("%s\n", "lxc.rootfs");
524 /* lxc.rootfs.path */
525 if (set_get_compare_clear_save_load(c
, "lxc.rootfs.path", "/some/path", tmpf
,
527 lxc_error("%s\n", "lxc.rootfs.path");
531 /* lxc.rootfs.mount */
532 if (set_get_compare_clear_save_load(c
, "lxc.rootfs.mount", "/some/path",
534 lxc_error("%s\n", "lxc.rootfs.mount");
538 /* lxc.rootfs.options */
539 if (set_get_compare_clear_save_load(c
, "lxc.rootfs.options",
540 "ext4,discard", tmpf
, true) < 0) {
541 lxc_error("%s\n", "lxc.rootfs.options");
546 legacy lxc.utsname key
548 if (set_get_compare_clear_save_load(c
, "lxc.utsname", "the-shire", tmpf
,
550 lxc_error("%s\n", "lxc.utsname");
555 if (set_get_compare_clear_save_load(c
, "lxc.uts.name", "the-shire", tmpf
,
557 lxc_error("%s\n", "lxc.uts.name");
561 /* lxc.hook.pre-start */
562 if (set_get_compare_clear_save_load(
563 c
, "lxc.hook.pre-start", "/some/pre-start", tmpf
, false) < 0) {
564 lxc_error("%s\n", "lxc.hook.pre-start");
568 /* lxc.hook.pre-mount */
569 if (set_get_compare_clear_save_load(
570 c
, "lxc.hook.pre-mount", "/some/pre-mount", tmpf
, false) < 0) {
571 lxc_error("%s\n", "lxc.hook.pre-mount");
576 if (set_get_compare_clear_save_load(c
, "lxc.hook.mount", "/some/mount",
578 lxc_error("%s\n", "lxc.hook.mount");
582 /* lxc.hook.autodev */
583 if (set_get_compare_clear_save_load(c
, "lxc.hook.autodev",
584 "/some/autodev", tmpf
, false) < 0) {
585 lxc_error("%s\n", "lxc.hook.autodev");
590 if (set_get_compare_clear_save_load(c
, "lxc.hook.start", "/some/start",
592 lxc_error("%s\n", "lxc.hook.start");
597 if (set_get_compare_clear_save_load(c
, "lxc.hook.stop", "/some/stop",
599 lxc_error("%s\n", "lxc.hook.stop");
603 /* lxc.hook.post-stop */
604 if (set_get_compare_clear_save_load(
605 c
, "lxc.hook.post-stop", "/some/post-stop", tmpf
, false) < 0) {
606 lxc_error("%s\n", "lxc.hook.post-stop");
611 if (set_get_compare_clear_save_load(c
, "lxc.hook.clone", "/some/clone",
613 lxc_error("%s\n", "lxc.hook.clone");
617 /* lxc.hook.destroy */
618 if (set_get_compare_clear_save_load(c
, "lxc.hook.destroy",
619 "/some/destroy", tmpf
, false) < 0) {
620 lxc_error("%s\n", "lxc.hook.destroy");
625 if (set_get_compare_clear_save_load(c
, "lxc.cap.drop",
626 "sys_module mknod setuid net_raw",
628 lxc_error("%s\n", "lxc.cap.drop");
633 if (set_get_compare_clear_save_load(c
, "lxc.cap.keep",
634 "sys_module mknod setuid net_raw",
636 lxc_error("%s\n", "lxc.cap.keep");
641 legacy lxc.console key
643 if (set_get_compare_clear_save_load(c
, "lxc.console", "none", tmpf
,
645 lxc_error("%s\n", "lxc.console");
649 /* lxc.console.path */
650 if (set_get_compare_clear_save_load(c
, "lxc.console.path", "none", tmpf
,
652 lxc_error("%s\n", "lxc.console.path");
656 /* lxc.console.logfile */
657 if (set_get_compare_clear_save_load(c
, "lxc.console.logfile",
658 "/some/logfile", tmpf
, true) < 0) {
659 lxc_error("%s\n", "lxc.console.logfile");
664 if (set_get_compare_clear_save_load(
665 c
, "lxc.seccomp", "/some/seccomp/file", tmpf
, true) < 0) {
666 lxc_error("%s\n", "lxc.seccomp");
671 if (set_get_compare_clear_save_load(c
, "lxc.autodev", "1", tmpf
, true) <
673 lxc_error("%s\n", "lxc.autodev");
678 legacy lxc.haltsignal key
680 if (set_get_compare_clear_save_load(c
, "lxc.haltsignal", "1", tmpf
,
682 lxc_error("%s\n", "lxc.haltsignal");
686 /* lxc.signal.halt */
687 if (set_get_compare_clear_save_load(c
, "lxc.signal.halt", "1", tmpf
,
689 lxc_error("%s\n", "lxc.signal.halt");
694 legacy lxc.rebootsignal key
696 if (set_get_compare_clear_save_load(c
, "lxc.rebootsignal", "1", tmpf
,
698 lxc_error("%s\n", "lxc.rebootsignal");
702 /* lxc.signal.reboot */
703 if (set_get_compare_clear_save_load(c
, "lxc.signal.reboot", "1", tmpf
,
705 lxc_error("%s\n", "lxc.signal.reboot");
710 legacy lxc.stopsignal key
712 if (set_get_compare_clear_save_load(c
, "lxc.stopsignal", "1", tmpf
,
714 lxc_error("%s\n", "lxc.stopsignal");
718 /* lxc.signal.stop */
719 if (set_get_compare_clear_save_load(c
, "lxc.signal.stop", "1", tmpf
,
721 lxc_error("%s\n", "lxc.signal.stop");
726 if (set_get_compare_clear_save_load(c
, "lxc.start.auto", "1", tmpf
,
728 lxc_error("%s\n", "lxc.start.auto");
732 /* lxc.start.delay */
733 if (set_get_compare_clear_save_load(c
, "lxc.start.delay", "5", tmpf
,
735 lxc_error("%s\n", "lxc.start.delay");
739 /* lxc.start.order */
740 if (set_get_compare_clear_save_load(c
, "lxc.start.order", "1", tmpf
,
742 lxc_error("%s\n", "lxc.start.order");
747 if (set_get_compare_clear_save_load(c
, "lxc.log.syslog", "local0", tmpf
,
749 lxc_error("%s\n", "lxc.log.syslog");
754 if (set_get_compare_clear_save_load(c
, "lxc.utsname", "get-schwifty",
756 lxc_error("%s\n", "lxc.utsname");
760 /* lxc.monitor.unshare */
761 if (set_get_compare_clear_save_load(c
, "lxc.monitor.unshare", "1", tmpf
,
763 lxc_error("%s\n", "lxc.monitor.unshare");
768 if (set_get_compare_clear_save_load(
769 c
, "lxc.group", "some,container,groups", tmpf
, false) < 0) {
770 lxc_error("%s\n", "lxc.group");
774 /* lxc.environment */
775 if (set_get_compare_clear_save_load(c
, "lxc.environment", "FOO=BAR",
777 lxc_error("%s\n", "lxc.environment");
782 legacy lxc.init_cmd key
784 if (set_get_compare_clear_save_load(c
, "lxc.init_cmd", "/bin/bash",
786 lxc_error("%s\n", "lxc.init_cmd");
791 if (set_get_compare_clear_save_load(c
, "lxc.init.cmd", "/bin/bash",
793 lxc_error("%s\n", "lxc.init.cmd");
798 legacy lxc.init_uid key
800 if (set_get_compare_clear_save_load(c
, "lxc.init_uid", "1000", tmpf
,
802 lxc_error("%s\n", "lxc.init_uid");
807 if (set_get_compare_clear_save_load(c
, "lxc.init.uid", "1000", tmpf
,
809 lxc_error("%s\n", "lxc.init.uid");
814 legacy lxc.init_gid key
816 if (set_get_compare_clear_save_load(c
, "lxc.init_gid", "1000", tmpf
,
818 lxc_error("%s\n", "lxc.init_gid");
823 if (set_get_compare_clear_save_load(c
, "lxc.init.gid", "1000", tmpf
,
825 lxc_error("%s\n", "lxc.init.gid");
830 if (set_get_compare_clear_save_load(c
, "lxc.ephemeral", "1", tmpf
,
832 lxc_error("%s\n", "lxc.ephemeral");
836 /* lxc.no_new_privs */
837 if (set_get_compare_clear_save_load(c
, "lxc.no_new_privs", "1", tmpf
,
839 lxc_error("%s\n", "lxc.no_new_privs");
844 legacy lxc.limit.* key
846 if (set_get_compare_clear_save_load(c
, "lxc.limit.nofile", "65536",
848 lxc_error("%s\n", "lxc.limit.nofile");
852 /* lxc.prlimit.nofile */
853 if (set_get_compare_clear_save_load(c
, "lxc.prlimit.nofile", "65536",
855 lxc_error("%s\n", "lxc.prlimit.nofile");
859 if (test_idmap_parser() < 0) {
860 lxc_error("%s\n", "failed to test parser for \"lxc.id_map\"");
864 if (set_get_compare_clear_save_load(c
, "lxc.net.0.type", "veth",
866 lxc_error("%s\n", "lxc.net.0.type");
870 if (set_get_compare_clear_save_load(c
, "lxc.net.2.type", "none",
872 lxc_error("%s\n", "lxc.net.2.type");
876 if (set_get_compare_clear_save_load(c
, "lxc.net.3.type", "empty",
878 lxc_error("%s\n", "lxc.net.3.type");
882 if (set_get_compare_clear_save_load(c
, "lxc.net.4.type", "vlan",
884 lxc_error("%s\n", "lxc.net.4.type");
888 if (set_get_compare_clear_save_load(c
, "lxc.net.0.type", "macvlan",
890 lxc_error("%s\n", "lxc.net.0.type");
894 if (set_get_compare_clear_save_load(c
, "lxc.net.1000.type", "phys",
896 lxc_error("%s\n", "lxc.net.1000.type");
900 if (set_get_compare_clear_save_load(c
, "lxc.net.0.flags", "up",
902 lxc_error("%s\n", "lxc.net.0.flags");
906 if (set_get_compare_clear_save_load(c
, "lxc.net.0.name", "eth0",
908 lxc_error("%s\n", "lxc.net.0.name");
912 if (set_get_compare_clear_save_load(c
, "lxc.net.0.link", "bla",
914 lxc_error("%s\n", "lxc.net.0.link");
918 if (set_get_compare_clear_save_load_network(
919 c
, "lxc.net.0.macvlan.mode", "private", tmpf
, true,
921 lxc_error("%s\n", "lxc.net.0.macvlan.mode");
925 if (set_get_compare_clear_save_load_network(
926 c
, "lxc.net.0.macvlan.mode", "vepa", tmpf
, true,
928 lxc_error("%s\n", "lxc.net.0.macvlan.mode");
932 if (set_get_compare_clear_save_load_network(
933 c
, "lxc.net.0.macvlan.mode", "bridge", tmpf
, true,
935 lxc_error("%s\n", "lxc.net.0.macvlan.mode");
939 if (set_get_compare_clear_save_load_network(
940 c
, "lxc.net.0.veth.pair", "clusterfuck", tmpf
, true,
942 lxc_error("%s\n", "lxc.net.0.veth.pair");
946 if (set_get_compare_clear_save_load(c
, "lxc.net.0.script.up",
947 "/some/up/path", tmpf
, true)) {
948 lxc_error("%s\n", "lxc.net.0.script.up");
952 if (set_get_compare_clear_save_load(c
, "lxc.net.0.script.down",
953 "/some/down/path", tmpf
, true)) {
954 lxc_error("%s\n", "lxc.net.0.script.down");
958 if (set_get_compare_clear_save_load(c
, "lxc.net.0.hwaddr",
959 "52:54:00:80:7a:5d", tmpf
, true)) {
960 lxc_error("%s\n", "lxc.net.0.hwaddr");
964 if (set_get_compare_clear_save_load(c
, "lxc.net.0.mtu", "2000",
966 lxc_error("%s\n", "lxc.net.0.mtu");
970 if (set_get_compare_clear_save_load_network(c
, "lxc.net.0.vlan.id",
971 "2", tmpf
, true, "vlan")) {
972 lxc_error("%s\n", "lxc.net.0.vlan.id");
976 if (set_get_compare_clear_save_load(c
, "lxc.net.0.ipv4.gateway",
977 "10.0.2.2", tmpf
, true)) {
978 lxc_error("%s\n", "lxc.net.0.ipv4.gateway");
982 if (set_get_compare_clear_save_load(c
, "lxc.net.0.ipv6.gateway",
983 "2003:db8:1::1", tmpf
, true)) {
984 lxc_error("%s\n", "lxc.net.0.ipv6.gateway");
988 if (set_get_compare_clear_save_load(c
, "lxc.net.0.ipv4.address",
989 "10.0.2.3/24", tmpf
, true)) {
990 lxc_error("%s\n", "lxc.net.0.ipv4.address");
994 if (set_get_compare_clear_save_load(
995 c
, "lxc.net.0.ipv6.address", "2003:db8:1:0:214:1234:fe0b:3596/64",
997 lxc_error("%s\n", "lxc.net.0.ipv6.address");
1001 if (set_and_clear_complete_netdev(c
) < 0) {
1002 lxc_error("%s\n", "failed to clear whole network");
1003 goto non_test_error
;
1010 lxc_container_put(c
);