Network interface names: tolerate more than one hyphen

Previously the handling of network interface names allowed something
like "foo-bar", but failed over "foo-bar-baz".

Thanks to Kai-Uwe Eckhardt.
This commit is contained in:
Lars Kruse 2020-04-12 15:49:28 +02:00
parent aad298f892
commit 1b43f16454

View file

@ -75,7 +75,7 @@ for PLUG in $PLUGINS; do
if_|if_err_) if_|if_err_)
interface_names=$(grep -E '^ *(ppp|eth|wlan|ath|ra|ipsec|tap|br-)[^:]{1,}:' /proc/net/dev | sed 's/^ *//; s/:.*$//') interface_names=$(grep -E '^ *(ppp|eth|wlan|ath|ra|ipsec|tap|br-)[^:]{1,}:' /proc/net/dev | sed 's/^ *//; s/:.*$//')
for INTER in $interface_names; do for INTER in $interface_names; do
INTERRES=$(echo "$INTER" | sed -e 's/\./VLAN/' -e 's/\-/_/') INTERRES=$(echo "$INTER" | sed -e 's/\./VLAN/' -e 's/\-/_/g')
RES="$RES ${PLUG}${INTERRES}" RES="$RES ${PLUG}${INTERRES}"
eval "fetch_${PLUG}${INTERRES}() { 'fetch_${PLUG%_}' '$INTER'; }" eval "fetch_${PLUG}${INTERRES}() { 'fetch_${PLUG%_}' '$INTER'; }"
eval "config_${PLUG}${INTERRES}() { 'config_${PLUG%_}' '$INTER'; }" eval "config_${PLUG}${INTERRES}() { 'config_${PLUG%_}' '$INTER'; }"