From 823544aace9639a88a23d71b89694ba4c1eef496 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 06:03:48 -0600 Subject: [PATCH 1/6] interface-file: map ppp-provider --- libifupdown/interface-file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index b59ca8a..82a3328 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -25,7 +25,8 @@ struct remap_token { }; static const struct remap_token tokens[] = { - {"vrf", "vrf-member"} + {"provider", "ppp-provider"}, /* legacy ifupdown, ifupdown2 */ + {"vrf", "vrf-member"}, }; static int @@ -119,6 +120,10 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename) cur_iface->is_dhcp = true; lif_dict_add(&cur_iface->vars, "use", strdup("dhcp")); } + else if (!strcmp(token, "ppp")) + { + lif_dict_add(&cur_iface->vars, "use", strdup("ppp")); + } else if (!strcmp(token, "inherits")) { token = lif_next_token(&bufp); From dd02502461bacb284a1963f3fc8f1ccd9aa1834f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 06:05:29 -0600 Subject: [PATCH 2/6] tests: add ppp fixtures --- tests/fixtures/ppp-legacy.interfaces | 4 ++++ tests/fixtures/ppp.interfaces | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 tests/fixtures/ppp-legacy.interfaces create mode 100644 tests/fixtures/ppp.interfaces diff --git a/tests/fixtures/ppp-legacy.interfaces b/tests/fixtures/ppp-legacy.interfaces new file mode 100644 index 0000000..8a83490 --- /dev/null +++ b/tests/fixtures/ppp-legacy.interfaces @@ -0,0 +1,4 @@ +auto ppp0 +iface ppp0 inet ppp + requires eth0 + provider someisp diff --git a/tests/fixtures/ppp.interfaces b/tests/fixtures/ppp.interfaces new file mode 100644 index 0000000..4d4cb9b --- /dev/null +++ b/tests/fixtures/ppp.interfaces @@ -0,0 +1,4 @@ +auto ppp0 +iface ppp0 + requires eth0 + ppp-provider someisp From 0dd8dc1b0e0cc21b375f1f5cf87220cfa2efdeaa Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 06:09:05 -0600 Subject: [PATCH 3/6] tests: add ifquery tests for ppp --- tests/ifquery_test | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/ifquery_test b/tests/ifquery_test index f6afe13..67284ec 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -21,7 +21,9 @@ tests_init \ implicit_vlan \ vrf_dependency \ vrf_ifupdown2_rewrite \ - vrf_ifupdown2_dependency + vrf_ifupdown2_dependency \ + ppp_dependency \ + ppp_legacy_rewrite noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -130,3 +132,13 @@ vrf_ifupdown2_dependency_body() { atf_check -s exit:0 -o match:"requires vrf-red" \ ifquery -E $EXECUTORS_LINUX -i $FIXTURES/vrf-ifupdown2.interfaces eth0 } + +ppp_dependency_body() { + atf_check -s exit:0 -o match:"requires eth0" \ + ifquery -E $EXECUTORS_LINUX -i $FIXTURES/ppp.interfaces ppp0 +} + +ppp_legacy_rewrite_body() { + atf_check -s exit:0 -o match:"ppp-provider someisp" \ + ifquery -E $EXECUTORS_LINUX -i $FIXTURES/ppp-legacy.interfaces ppp0 +} From 472319b84743b2e36d09b85eab652c9e44f21fd5 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 06:11:52 -0600 Subject: [PATCH 4/6] add ppp executor --- executor-scripts/linux/ppp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 executor-scripts/linux/ppp diff --git a/executor-scripts/linux/ppp b/executor-scripts/linux/ppp new file mode 100755 index 0000000..ea7b085 --- /dev/null +++ b/executor-scripts/linux/ppp @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +[ -z "$IF_PPP_PROVIDER" ] && exit 0 +case "$PHASE" in +pre-up) ${MOCK} pon $IF_PPP_PROVIDER ;; +post-down) ${MOCK} poff $IF_PPP_PROVIDER ;; +esac From c2465344d576ccf2ea922bf7cfd350fe2d035b2a Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 06:15:00 -0600 Subject: [PATCH 5/6] tests: add ppp executor tests --- tests/linux/Kyuafile | 1 + tests/linux/ppp_test | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 tests/linux/ppp_test diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index 22bb701..471a8ff 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -7,3 +7,4 @@ atf_test_program{name='ipv6-ra_test'} atf_test_program{name='dhcp_test'} atf_test_program{name='static_test'} atf_test_program{name='vrf_test'} +atf_test_program{name='ppp_test'} diff --git a/tests/linux/ppp_test b/tests/linux/ppp_test new file mode 100755 index 0000000..46bb0e0 --- /dev/null +++ b/tests/linux/ppp_test @@ -0,0 +1,22 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/../test_env.sh +EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/ppp" + +tests_init \ + bringup \ + teardown \ + +bringup_body() { + export MOCK=echo IFACE=ppp0 PHASE=pre-up IF_PPP_PROVIDER=someisp + atf_check -s exit:0 \ + -o match:'pon someisp' \ + ${EXECUTOR} +} + +teardown_body() { + export MOCK=echo IFACE=ppp0 PHASE=post-down IF_PPP_PROVIDER=someisp + atf_check -s exit:0 \ + -o match:'poff someisp' \ + ${EXECUTOR} +} From e18ab114e03c24c5134830270b5c9ac64a02469e Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 06:16:37 -0600 Subject: [PATCH 6/6] ppp: add support for ifupdown2 ppp-physdev for dependency learning --- executor-scripts/linux/ppp | 1 + 1 file changed, 1 insertion(+) diff --git a/executor-scripts/linux/ppp b/executor-scripts/linux/ppp index ea7b085..3ba001b 100755 --- a/executor-scripts/linux/ppp +++ b/executor-scripts/linux/ppp @@ -4,4 +4,5 @@ set -e case "$PHASE" in pre-up) ${MOCK} pon $IF_PPP_PROVIDER ;; post-down) ${MOCK} poff $IF_PPP_PROVIDER ;; +depend) echo "$IF_PPP_PHYSDEV" ;; esac