summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-29 09:55:28 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-29 09:55:28 -0700
commit63dce1bf2261546321b8a783ff7b5f5dd99911c2 (patch)
tree9eeab61ec2b4241b64fc3703592e019d9f518f32
parent147a0ee7eeb02944d3c78d4bb4b4d8df28a5e924 (diff)
parent5182559eeb9ffa7acde43561c9a331f5e5bdf09c (diff)
downloadvyatta-cfg-quagga-63dce1bf2261546321b8a783ff7b5f5dd99911c2.tar.gz
vyatta-cfg-quagga-63dce1bf2261546321b8a783ff7b5f5dd99911c2.zip
Merge branch 'jenner' of 192.168.100.1:git/vyatta-cfg-quagga into jenner
-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