summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-29 09:53:22 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-29 09:53:22 -0700
commit5182559eeb9ffa7acde43561c9a331f5e5bdf09c (patch)
tree6e73589a911bae6fd194013811ed3e66b518c80c /scripts
parentf17d6f5b0581b40180fdb02a71ced8ca0a690694 (diff)
downloadvyatta-cfg-quagga-5182559eeb9ffa7acde43561c9a331f5e5bdf09c.tar.gz
vyatta-cfg-quagga-5182559eeb9ffa7acde43561c9a331f5e5bdf09c.zip
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.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-link-detect25
1 files 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