summaryrefslogtreecommitdiff
path: root/scripts/vyatta-address
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-08-25 20:19:04 +0200
committerDaniil Baturin <daniil@baturin.org>2018-08-25 20:19:04 +0200
commit7f5df3ea03fe410f781478aeffc201537756b040 (patch)
treedfcf9ac77e832e1bc68ea7f8aeb50fbea092dcec /scripts/vyatta-address
parentff172c743e5d732cad083c075c79485849913b4d (diff)
downloadvyatta-cfg-system-7f5df3ea03fe410f781478aeffc201537756b040.tar.gz
vyatta-cfg-system-7f5df3ea03fe410f781478aeffc201537756b040.zip
T797: add sudo to ip command calls in other interface types.
Diffstat (limited to 'scripts/vyatta-address')
-rwxr-xr-xscripts/vyatta-address10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/vyatta-address b/scripts/vyatta-address
index 072f27e6..4491c3f0 100755
--- a/scripts/vyatta-address
+++ b/scripts/vyatta-address
@@ -17,11 +17,11 @@ case $1 in
elif [[ "$3" =~ ":" ]]; then
# Ipv6 address
if ! ip -6 addr list dev $2 | grep -q $3; then
- exec ip -6 addr add "$3" dev "$2"
+ exec sudo ip -6 addr add "$3" dev "$2"
fi
else
if ! ip addr list dev $2 | grep -q $3; then
- exec ip addr add "$3" broadcast + dev "$2"
+ exec sudo ip addr add "$3" broadcast + dev "$2"
fi
fi ;;
@@ -37,7 +37,7 @@ case $1 in
ip_address=$3;
fi
- if ! /sbin/ip address show dev $2 2>/dev/null | grep -q "$ip_address"; then
+ if ! ip address show dev $2 2>/dev/null | grep -q "$ip_address"; then
# Address doesn't exist there, nothing to delete
exit 0
fi
@@ -50,9 +50,9 @@ case $1 in
elif [[ "$3" = "dhcpv6" ]]; then
exec /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --ifname "$2"
elif [[ "$3" =~ ":" ]]; then
- exec ip -6 addr del "$3" dev "$2"
+ exec sudo ip -6 addr del "$3" dev "$2"
else
- exec ip addr del "$3" dev "$2"
+ exec sudo ip addr del "$3" dev "$2"
fi ;;
*)
echo "Unknown option $1"