From 68415ce71d21ee84df046a68e9221e5dd34fc1af Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 26 Aug 2020 02:22:30 -0600 Subject: [PATCH] link executor: add support for hwaddress option --- executor-scripts/linux/link | 1 + tests/linux/link_test | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index f7ede1f..b6b37a8 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -4,6 +4,7 @@ IF_LINK_OPTIONS="$IF_LINK_OPTIONS" [ -n "$IF_MTU" ] && IF_LINK_OPTIONS="$IF_LINK_OPTIONS mtu $IF_MTU" +[ -n "$IF_HWADDRESS" ] && IF_LINK_OPTIONS="$IF_LINK_OPTIONS address $IF_HWADDRESS" is_vlan() { case "$IFACE" in diff --git a/tests/linux/link_test b/tests/linux/link_test index 1cb2784..505adcd 100755 --- a/tests/linux/link_test +++ b/tests/linux/link_test @@ -7,6 +7,7 @@ tests_init \ up \ down \ mtu \ + hwaddress \ vlan_explicit_up \ vlan_explicit_down \ vlan_guessed_up \ @@ -32,6 +33,12 @@ mtu_body() { ${EXECUTOR} } +hwaddress_body() { + export IFACE=eth0 PHASE=up MOCK=echo IF_HWADDRESS=12:34:56:78:90:ab + atf_check -s exit:0 -o match:'ip link set up dev eth0 address 12:34:56:78:90:ab' \ + ${EXECUTOR} +} + vlan_explicit_up_body() { export IFACE=servers PHASE=up MOCK=echo \ IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"