link: support mtu parameter (like debian)

This commit is contained in:
Ariadne Conill 2020-08-18 15:57:01 -06:00
parent f282704186
commit 962ef0d415
2 changed files with 12 additions and 2 deletions

View file

@ -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

View file

@ -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}
}