diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index 8bb9d62..2aafd67 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -1,5 +1,9 @@ #!/bin/sh [ -z "$VERBOSE" ] || set -x +OPTIONS="" case "$PHASE" in -up|down) ${MOCK} ip link set $PHASE dev $IFACE ;; +up|down) + [ -n "$IF_MTU" ] && OPTIONS="$OPTIONS mtu $IF_MTU" + ${MOCK} ip link set $PHASE dev $IFACE $OPTIONS + ;; esac diff --git a/tests/linux/link_test b/tests/linux/link_test index 6957224..717d462 100755 --- a/tests/linux/link_test +++ b/tests/linux/link_test @@ -3,7 +3,7 @@ . $(atf_get_srcdir)/../test_env.sh EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/link" -tests_init up down +tests_init up down mtu up_body() { export IFACE=lo PHASE=up MOCK=echo @@ -16,3 +16,9 @@ down_body() { atf_check -s exit:0 -o match:'ip link set down dev lo' \ ${EXECUTOR} } + +mtu_body() { + export IFACE=eth0 PHASE=up MOCK=echo IF_MTU=1492 + atf_check -s exit:0 -o match:'ip link set up dev eth0 mtu 1492' \ + ${EXECUTOR} +}