From 5182559eeb9ffa7acde43561c9a331f5e5bdf09c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 29 Mar 2009 09:53:22 -0700 Subject: Fix sysctl setting link_filter on vif sysctl command has legacy dotted notation which won't work with names for vlans (eth1.110). So just write /proc. --- scripts/vyatta-link-detect | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/vyatta-link-detect b/scripts/vyatta-link-detect index f0d0693b..af392549 100755 --- a/scripts/vyatta-link-detect +++ b/scripts/vyatta-link-detect @@ -12,14 +12,23 @@ if [ $# -ne 2 ]; then usage fi +# Note can't use sysctl it is broken for vif name because of dots +# link_filter values: +# 0 - always receive +# 1 - ignore receive if admin_down +# 2 - ignore receive if admin_down or link down +set-sysctl () { + sudo sh -c "echo $2 >/proc/sys/net/ipv4/conf/$1/link_filter" +# sudo sh -c "echo $2 >/proc/sys/net/ipv6/conf/$1/link_filter" +} + case $2 in -on) sudo sysctl -w "net.ipv4.conf.$1.link_filter=2" -# sudo sysctl -w "net.ipv6.conf.$1.link_filter=2" - cmd="link-detect" ;; -off) sudo sysctl -w "net.ipv4.conf.$1.link_filter=1" -# sudo sysctl -w "net.ipv6.conf.$1.link_filter=1" - cmd="no link-detect" ;; +on) set-sysctl $1 2 + exec vyatta-vtysh -c "configure terminal" -c "interface $1" \ + -c "link-detect" ;; +off) set-sysctl $1 1 + exec vyatta-vtysh -c "configure terminal" -c "interface $1" \ + -c "no link-detect" ;; *) usage;; esac - -exec vyatta-vtysh -c "configure terminal" -c "interface $1" -c "$cmd" +# not reached -- cgit v1.2.3