use "use loopback" hint instead of "inet loopback", same with dhcp

This commit is contained in:
Ariadne Conill 2020-07-24 05:00:49 -06:00
parent 37394310ea
commit 16af3755e0
4 changed files with 7 additions and 12 deletions

View file

@ -27,14 +27,7 @@ print_interface(struct lif_interface *iface)
if (iface->is_auto) if (iface->is_auto)
printf("auto %s\n", iface->ifname); printf("auto %s\n", iface->ifname);
printf("iface %s", iface->ifname); printf("iface %s\n", iface->ifname);
if (iface->is_loopback)
printf(" inet loopback\n");
else if (iface->is_dhcp)
printf(" inet dhcp\n");
else
printf("\n");
struct lif_node *iter; struct lif_node *iter;
LIF_DICT_FOREACH(iter, &iface->vars) LIF_DICT_FOREACH(iter, &iface->vars)

View file

@ -91,9 +91,10 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename)
continue; continue;
if (!strcmp(hint, "dhcp")) if (!strcmp(hint, "dhcp"))
{
cur_iface->is_dhcp = true; cur_iface->is_dhcp = true;
else if (!strcmp(hint, "loopback")) lif_dict_add(&cur_iface->vars, "use", strdup("dhcp"));
cur_iface->is_loopback = true; }
} }
else if (!strcmp(token, "use")) else if (!strcmp(token, "use"))
{ {

View file

@ -135,6 +135,7 @@ lif_interface_collection_init(struct lif_dict *collection)
/* always enable loopback interface as part of a collection */ /* always enable loopback interface as part of a collection */
if_lo = lif_interface_collection_find(collection, "lo"); if_lo = lif_interface_collection_find(collection, "lo");
if_lo->is_auto = if_lo->is_loopback = true; if_lo->is_auto = if_lo->is_loopback = true;
lif_dict_add(&if_lo->vars, "use", strdup("loopback"));
lif_interface_address_add(if_lo, "127.0.0.1/8"); lif_interface_address_add(if_lo, "127.0.0.1/8");
} }

View file

@ -18,7 +18,7 @@ noargs_body() {
} }
loopback_always_configured_body() { loopback_always_configured_body() {
atf_check -s exit:0 -o match:"inet loopback" \ atf_check -s exit:0 -o match:"use loopback" \
ifquery -S/dev/null -i $FIXTURES/static-eth0.interfaces lo ifquery -S/dev/null -i $FIXTURES/static-eth0.interfaces lo
} }
@ -43,7 +43,7 @@ static_ipv6_body() {
} }
dhcp_ipv4_body() { dhcp_ipv4_body() {
atf_check -s exit:0 -o match:"inet dhcp" \ atf_check -s exit:0 -o match:"use dhcp" \
ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0 ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0
} }