Merge pull request #27 from ifupdown-ng/feature/link-mtu

link: support `mtu` parameter (like debian)
This commit is contained in:
Ariadne Conill 2020-08-18 16:01:06 -06:00 committed by GitHub
commit a2a532c8ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
[ -z "$VERBOSE" ] || set -x [ -z "$VERBOSE" ] || set -x
OPTIONS=""
case "$PHASE" in 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 esac

View file

@ -3,7 +3,7 @@
. $(atf_get_srcdir)/../test_env.sh . $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/link" EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/link"
tests_init up down tests_init up down mtu
up_body() { up_body() {
export IFACE=lo PHASE=up MOCK=echo 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' \ atf_check -s exit:0 -o match:'ip link set down dev lo' \
${EXECUTOR} ${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}
}