From e4b4d8b70ab99c3bbd3e3b100f12786cb5588653 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:36:34 -0600 Subject: [PATCH] ethtool: add pause and offload settings support --- executor-scripts/linux/ethtool | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 20ec63f..4f735b5 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -1,6 +1,20 @@ #!/bin/sh set -e +# gather params for a given prefix, based on executor-scripts/linux/tunnel. +gather_params() { + set | sed -E " + s/^IF_${1}_([A-Z0-9_]+)=(.+)/\1\n\2/ + ta + d + :a + h + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + P + g + s/.*\n//" +} + case "$PHASE" in pre-up) settings="\ @@ -32,5 +46,10 @@ up) [ -z "$link_settings" ] || $MOCK ethtool --change "$IFACE" $link_settings + pause_settings=$(gather_params IF_ETHTOOL_ETHERNET_PAUSE) + [ -z "$pause_settings" ] || $MOCK ethtool --pause "$IFACE" $pause_settings + + offload_settings=$(gather_params IF_ETHTOOL_OFFLOAD) + [ -z "$offload_settings" ] || $MOCK ethtool --offload "$IFACE" $offload_settings ;; esac