From 1384b38c78271f1c5bf0f0a9d28c5f1bd38c1a66 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 24 Aug 2020 03:06:32 -0600 Subject: [PATCH] interface: use link executor on vlans too --- libifupdown/interface.c | 6 +++++- tests/ifquery_test | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libifupdown/interface.c b/libifupdown/interface.c index fe9acea..4f348dc 100644 --- a/libifupdown/interface.c +++ b/libifupdown/interface.c @@ -63,7 +63,11 @@ lif_interface_init(struct lif_interface *interface, const char *ifname) interface->ifname = strdup(ifname); - lif_interface_use_executor(interface, strchr(ifname, '.') == NULL ? "link" : "vlan"); + lif_interface_use_executor(interface, "link"); + + /* keep the 'vlan' executor as a config hint for backwards compatibility */ + if (strchr(ifname, '.') != NULL) + lif_interface_use_executor(interface, "vlan"); } bool diff --git a/tests/ifquery_test b/tests/ifquery_test index a53c22c..26c0c6f 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -30,7 +30,9 @@ tests_init \ tunnel_legacy_rewrite \ tunnel_ifupdown2_dependency \ tunnel_ifupdown2_rewrite \ - gre_dependency + gre_dependency \ + vlan_explicit_learned_dependency \ + vlan_guessed_learned_dependency noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -192,3 +194,15 @@ gre_dependency_body() { atf_check -s exit:0 -o match:"requires eth0" \ ifquery -E $EXECUTORS_LINUX -i $FIXTURES/gre.interfaces tun0 } + +vlan_explicit_learned_dependency_body() { + atf_check -s exit:0 -o match:"requires eth0" \ + -o match:"use vlan" \ + ifquery -E $EXECUTORS_LINUX -i $FIXTURES/vlan-named.interfaces servers +} + +vlan_guessed_learned_dependency_body() { + atf_check -s exit:0 -o match:"requires eth0" \ + -o match:"use vlan" \ + ifquery -E $EXECUTORS_LINUX -i $FIXTURES/vlan.interfaces eth0.8 +}