summaryrefslogtreecommitdiff
path: root/scripts/vyatta-link-detect
blob: 66f444d34481c77f5a4a4477e1b6e96e560eae33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/bash
#
# Usage: vyatta-link-detect devicename on|off
#

usage() {
    echo "Usage: $0 devicename {on|off}"
    exit 1
}

if [ $# -ne 2 ]; then
    usage
fi

case $2 in
on)	sysctl -w "net.ipv4.conf.$1.link_filter=2"
	sysctl -w "net.ipv6.conf.$1.link_filter=2"
	cmd="link-detect" ;;
off)    sysctl -w "net.ipv4.conf.$1.link_filter=1"
	sysctl -w "net.ipv6.conf.$1.link_filter=1"
	cmd="no link-detect" ;;
*)	usage;;
esac

exec vyatta-vtysh -c "configure terminal" -c "interface $1" -c "$cmd"