diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-05-25 18:41:37 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-05-25 18:41:37 -0700 |
commit | 21cb557437f2a1adc0d985f07b62fa9cf81f0261 (patch) | |
tree | 8879c4e8dab0e1e2630a163f10057b0e9c632d59 | |
parent | 144778465c780a56220bc8e68aa880ddd1149ddb (diff) | |
download | vyatta-cfg-system-21cb557437f2a1adc0d985f07b62fa9cf81f0261.tar.gz vyatta-cfg-system-21cb557437f2a1adc0d985f07b62fa9cf81f0261.zip |
Use capability for ip command
23 files changed, 49 insertions, 49 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 77653292..5b3c9937 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -312,14 +312,14 @@ sub update_mac { if (POSIX::strtoul($flags) & 1) { # NB: Perl 5 system return value is bass-ackwards - system "sudo ip link set $intf down" + system "ip link set $intf down" and die "Could not set $intf down ($!)\n"; - system "sudo ip link set $intf address $mac" + system "ip link set $intf address $mac" and die "Could not set $intf address ($!)\n"; - system "sudo ip link set $intf up" + system "ip link set $intf up" and die "Could not set $intf up ($!)\n"; } else { - system "sudo ip link set $intf address $mac" + system "ip link set $intf address $mac" and die "Could not set $intf address ($!)\n"; } exit 0; diff --git a/templates/interfaces/bonding/node.def b/templates/interfaces/bonding/node.def index e55b9ee7..eec7a65a 100644 --- a/templates/interfaces/bonding/node.def +++ b/templates/interfaces/bonding/node.def @@ -9,7 +9,7 @@ begin: if [ ! -f /sys/class/net/bonding_masters ]; then /sbin/modprobe bonding max_bonds=0 miimon=250 fi create: sudo sh -c "echo +$VAR(@) > /sys/class/net/bonding_masters" || exit 1 - sudo ip link set "$VAR(@)" up + ip link set "$VAR(@)" up /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on delete: SLAVES=`cat /sys/class/net/$VAR(@)/bonding/slaves`; if [ -z "$SLAVES" ] diff --git a/templates/interfaces/bonding/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/disable/node.def index ad033365..96325d72 100644 --- a/templates/interfaces/bonding/node.tag/disable/node.def +++ b/templates/interfaces/bonding/node.tag/disable/node.def @@ -1,11 +1,11 @@ help: Set interface disabled create: /etc/netplug/linkdown.d/dhclient $VAR(../@) - if ! sudo ip link set $VAR(../@) down 2>/dev/null; then + if ! ip link set $VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../@) exit 1 fi -delete: if ! sudo ip link set $VAR(../@) up; then +delete: if ! ip link set $VAR(../@) up; then echo "Error enabling dev $VAR(../@)" exit 1 fi diff --git a/templates/interfaces/bonding/node.tag/mtu/node.def b/templates/interfaces/bonding/node.tag/mtu/node.def index 07c102ac..8be06dc3 100644 --- a/templates/interfaces/bonding/node.tag/mtu/node.def +++ b/templates/interfaces/bonding/node.tag/mtu/node.def @@ -1,5 +1,5 @@ type: u32 help: Set the Maximum Transmission Unit (MTU) for this interface syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" -update:expression: "sudo ip link set $VAR(../@) mtu $VAR(@)"; "Error setting MTU on dev $VAR(../@)" -delete:expression: "sudo ip link set $VAR(../@) mtu 1500"; "Error deleting MTU on dev $VAR(../@)" +update:expression: "ip link set $VAR(../@) mtu $VAR(@)"; "Error setting MTU on dev $VAR(../@)" +delete:expression: "ip link set $VAR(../@) mtu 1500"; "Error deleting MTU on dev $VAR(../@)" diff --git a/templates/interfaces/bonding/node.tag/vif/node.def b/templates/interfaces/bonding/node.tag/vif/node.def index 2e718f41..62e7ab95 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.def @@ -8,9 +8,9 @@ create: read -a SLAVES </sys/class/net/$VAR(../@)/bonding/slaves echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" exit 1 fi - sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1 - sudo ip link set "$VAR(../@).$VAR(@)" up + ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1 + ip link set "$VAR(../@).$VAR(@)" up sudo sh -c "/opt/vyatta/sbin/vyatta-link-detect $VAR(../@).$VAR(@) on" -delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) +delete: ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) comp_help: possible completions: <0-4094> Set VLAN ID diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def index 78b24870..b2119c9c 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def @@ -1,11 +1,11 @@ help: Set interface disabled update: /etc/netplug/linkdown.d/dhclient $VAR(../../@).$VAR(../@) - if ! sudo ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then + if ! ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../../@).$VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../../@).$VAR(../@) exit 1 fi -delete: if ! sudo ip link set $VAR(../../@).$VAR(../@) up; then +delete: if ! ip link set $VAR(../../@).$VAR(../@) up; then echo "Error enabling dev $VAR(../../@).$VAR(../@)" exit 1 fi diff --git a/templates/interfaces/bridge/node.def b/templates/interfaces/bridge/node.def index ec06c817..60af4bc0 100644 --- a/templates/interfaces/bridge/node.def +++ b/templates/interfaces/bridge/node.def @@ -7,13 +7,13 @@ comp_help: "Enter bridge interface name (br0 - br999)" syntax:expression: pattern $VAR(@) "^br[0-9]+$" ; "Must be (br0 - br999)" create: /usr/sbin/brctl addbr $VAR(@) - sudo ip link set $VAR(@) up + ip link set $VAR(@) up delete: if ! /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \ --no-interfaces-assigned \ --bridge-interface="$VAR(@)"; then \ exit 1 fi - sudo ip link set $VAR(@) down; + ip link set $VAR(@) down; /usr/sbin/brctl delbr $VAR(@); diff --git a/templates/interfaces/bridge/node.tag/disable/node.def b/templates/interfaces/bridge/node.tag/disable/node.def index 3f37a6d6..2e20be3b 100644 --- a/templates/interfaces/bridge/node.tag/disable/node.def +++ b/templates/interfaces/bridge/node.tag/disable/node.def @@ -1,11 +1,11 @@ help: Disable the bridge interface update: /etc/netplug/linkdown.d/dhclient $VAR(../@) - if ! sudo ip link set $VAR(../@) down 2>/dev/null; then + if ! ip link set $VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../@) exit 1 fi -delete: if ! sudo ip link set $VAR(../@) up; then +delete: if ! ip link set $VAR(../@) up; then echo "Error enabling dev $VAR(../@)" exit 1 fi diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def index 0b67836b..05b2e03c 100644 --- a/templates/interfaces/ethernet/node.def +++ b/templates/interfaces/ethernet/node.def @@ -12,7 +12,7 @@ syntax:expression: exec \ echo \"interface ethernet $VAR(@): does not exist\"; exit 1; \ fi" -create: sudo ip link set "$VAR(@)" up +create: ip link set "$VAR(@)" up /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 - sudo ip link set $VAR(@) down + ip link set $VAR(@) down diff --git a/templates/interfaces/ethernet/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/disable/node.def index fbfb155a..5fe2b748 100644 --- a/templates/interfaces/ethernet/node.tag/disable/node.def +++ b/templates/interfaces/ethernet/node.tag/disable/node.def @@ -1,12 +1,12 @@ help: Set interface disabled create: /etc/netplug/linkdown.d/dhclient $VAR(../@) - if ! sudo ip link set $VAR(../@) down 2>/dev/null; then + if ! ip link set $VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../@) exit 1 fi delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 - if ! sudo ip link set $VAR(../@) up; then + if ! ip link set $VAR(../@) up; then echo "Error enabling dev $VAR(../@)" exit 1 fi diff --git a/templates/interfaces/ethernet/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/mtu/node.def index dc03ae16..f33158f8 100644 --- a/templates/interfaces/ethernet/node.tag/mtu/node.def +++ b/templates/interfaces/ethernet/node.tag/mtu/node.def @@ -1,8 +1,8 @@ type: u32 help: Set the Maximum Transmission Unit (MTU) for this interface syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" -update: if ! sudo ip link set $VAR(../@) mtu $VAR(@) +update: if ! ip link set $VAR(../@) mtu $VAR(@) then echo "Error setting MTU on dev $VAR(../@)"; exit 1 fi delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 - sudo ip link set $VAR(../@) mtu 1500 + ip link set $VAR(../@) mtu 1500 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def index b6b8abc7..c14ed002 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.def @@ -5,17 +5,17 @@ help: Set Virtual Local Area Network (VLAN) ID syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" -create: if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) +create: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) then echo "Error creating VLAN device $VAR(../@).$VAR(@)" exit 1 fi # if parent is up, then bring VLAN up if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ]; then - sudo ip link set "$VAR(../@).$VAR(@)" up + ip link set "$VAR(../@).$VAR(@)" up fi /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 - sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) + ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) comp_help: possible completions: <0-4094> Set VLAN ID diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/disable/node.def index 78b24870..b2119c9c 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/disable/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/disable/node.def @@ -1,11 +1,11 @@ help: Set interface disabled update: /etc/netplug/linkdown.d/dhclient $VAR(../../@).$VAR(../@) - if ! sudo ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then + if ! ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../../@).$VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../../@).$VAR(../@) exit 1 fi -delete: if ! sudo ip link set $VAR(../../@).$VAR(../@) up; then +delete: if ! ip link set $VAR(../../@).$VAR(../@) up; then echo "Error enabling dev $VAR(../../@).$VAR(../@)" exit 1 fi diff --git a/templates/interfaces/input/node.def b/templates/interfaces/input/node.def index 002f5305..e1bf153b 100644 --- a/templates/interfaces/input/node.def +++ b/templates/interfaces/input/node.def @@ -7,5 +7,5 @@ comp_help: Enter input functional block interface name (ifb0 - ifb999) syntax:expression: pattern $VAR(@) "^ifb[0-9]+$" ; "name must be (ifb0-ifb999)" begin: [ -d /sys/module/ifb ] || /sbin/modprobe ifb numifbs=0 -create: sudo ip link add $VAR(@) type ifb && sudo ip link set $VAR(@) up -delete: sudo ip link delete dev $VAR(@) +create: ip link add $VAR(@) type ifb && sudo ip link set $VAR(@) up +delete: ip link delete dev $VAR(@) diff --git a/templates/interfaces/loopback/node.def b/templates/interfaces/loopback/node.def index ae166e7b..b78cf10b 100644 --- a/templates/interfaces/loopback/node.def +++ b/templates/interfaces/loopback/node.def @@ -6,4 +6,4 @@ comp_help: Enter looback interface name (lo) syntax:expression: exec \ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=loopback" allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=loopback -create: sudo ip link set $VAR(@) up +create: ip link set $VAR(@) up diff --git a/templates/interfaces/pseudo-ethernet/node.def b/templates/interfaces/pseudo-ethernet/node.def index 14ee0a34..bf88b047 100644 --- a/templates/interfaces/pseudo-ethernet/node.def +++ b/templates/interfaces/pseudo-ethernet/node.def @@ -7,7 +7,7 @@ syntax:expression: pattern $VAR(@) "^peth[0-9]+$" \ ; "name must be (peth0-peth999)" commit:expression: $VAR(link) != "" ; "link device must be set for virtual ethernet $VAR(@)" -create: sudo ip link add $VAR(@) link $VAR(link/@) type macvlan || exit 1 - sudo ip link set $VAR(@) up +create: ip link add $VAR(@) link $VAR(link/@) type macvlan || exit 1 + ip link set $VAR(@) up /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on -delete: sudo ip link delete dev $VAR(@) type macvlan +delete: ip link delete dev $VAR(@) type macvlan diff --git a/templates/interfaces/pseudo-ethernet/node.tag/disable/node.def b/templates/interfaces/pseudo-ethernet/node.tag/disable/node.def index 3d3ffef9..9dafeacf 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/disable/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/disable/node.def @@ -5,12 +5,12 @@ create: vif=`/opt/vyatta/sbin/vyatta-interfaces.pl --vif=$VAR(../@) --show=all` exit 1 fi /etc/netplug/linkdown.d/dhclient $VAR(../@) - if ! sudo ip link set $VAR(../@) down 2>/dev/null; then + if ! ip link set $VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../@) exit 1 fi -delete: if ! sudo ip link set $VAR(../@) up; then +delete: if ! ip link set $VAR(../@) up; then echo "Error enabling dev $VAR(../@)" exit 1 fi diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def index c4446163..34ef1ad6 100644 --- a/templates/interfaces/tunnel/node.def +++ b/templates/interfaces/tunnel/node.def @@ -21,11 +21,11 @@ create:expression: "\ if [ x$VAR(./multicast/@) == xenable ]; then \ MC=\"multicast on allmulticast on\"; \ fi; \ - sudo ip tunnel add $VAR(@) \ + ip tunnel add $VAR(@) \ local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) \ mode $VAR(./encapsulation/@) $KEY; \ - sudo ip link set $VAR(@) $MC up;" ; \ + ip link set $VAR(@) $MC up;" ; \ "Error creating $VAR(@)" -delete:expression: "sudo ip tunnel del $VAR(@)" ; "Error deleting $VAR(@)" +delete:expression: "ip tunnel del $VAR(@)" ; "Error deleting $VAR(@)" diff --git a/templates/interfaces/tunnel/node.tag/disable/node.def b/templates/interfaces/tunnel/node.tag/disable/node.def index cd3c019a..23fb46e7 100644 --- a/templates/interfaces/tunnel/node.tag/disable/node.def +++ b/templates/interfaces/tunnel/node.tag/disable/node.def @@ -1,6 +1,6 @@ help: Disable interface -update:expression: "sudo ip link set $VAR(../@) down"; \ +update:expression: "ip link set $VAR(../@) down"; \ "Error disabling dev $VAR(../@)" -delete:expression: "sudo ip link set $VAR(../@) up"; \ +delete:expression: "ip link set $VAR(../@) up"; \ "Error enabling dev $VAR(../@)" diff --git a/templates/interfaces/tunnel/node.tag/key/node.def b/templates/interfaces/tunnel/node.tag/key/node.def index 1ece7642..c137107c 100644 --- a/templates/interfaces/tunnel/node.tag/key/node.def +++ b/templates/interfaces/tunnel/node.tag/key/node.def @@ -3,7 +3,7 @@ help: Set the tunnel key syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 999999; \ "Must be between 0-999999 for $VAR(../@)" syntax:expression: exec " \ - if [ -n \"`sudo ip tunnel show $VAR(../@) | grep $VAR(../@) `\" ]; then \ + if [ -n \"`ip tunnel show $VAR(../@) | grep $VAR(../@) `\" ]; then \ echo Key can only be set at tunnel creation for $VAR(../@); \ exit 1 ; \ fi ; " diff --git a/templates/interfaces/tunnel/node.tag/mtu/node.def b/templates/interfaces/tunnel/node.tag/mtu/node.def index f1fdf39b..8076cacd 100644 --- a/templates/interfaces/tunnel/node.tag/mtu/node.def +++ b/templates/interfaces/tunnel/node.tag/mtu/node.def @@ -1,7 +1,7 @@ type: u32 help: Set the tunnel Maximum Transmission Unit (MTU) syntax:expression: $VAR(@) >= 64 && $VAR(@) <= 8024; "Must be between 64-8024" -update:expression: "sudo ip link set $VAR(../@) mtu $VAR(@)" -delete:expression: "sudo ip link set $VAR(../@) mtu 1476" +update:expression: "ip link set $VAR(../@) mtu $VAR(@)" +delete:expression: "ip link set $VAR(../@) mtu 1476" comp_help: possible completions: <64-8024> Set MTU diff --git a/templates/interfaces/tunnel/node.tag/tos/node.def b/templates/interfaces/tunnel/node.tag/tos/node.def index 1f739966..9492d7aa 100644 --- a/templates/interfaces/tunnel/node.tag/tos/node.def +++ b/templates/interfaces/tunnel/node.tag/tos/node.def @@ -1,7 +1,7 @@ type: u32 help: Set the tunnel Type of Service (TOS) syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 99; "Must be between 0-99" -update:expression: "sudo ip tunnel change $VAR(../@) tos $VAR(@)" -delete:expression: "sudo ip tunnel change $VAR(../@) tos inherit" +update:expression: "ip tunnel change $VAR(../@) tos $VAR(@)" +delete:expression: "ip tunnel change $VAR(../@) tos inherit" comp_help: possible completions <0-99> Set type of service diff --git a/templates/interfaces/tunnel/node.tag/ttl/node.def b/templates/interfaces/tunnel/node.tag/ttl/node.def index 298c4d61..29bc4ced 100644 --- a/templates/interfaces/tunnel/node.tag/ttl/node.def +++ b/templates/interfaces/tunnel/node.tag/ttl/node.def @@ -2,7 +2,7 @@ type: u32 help: Set the tunnel time to live field default: 255 syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 255; "Must be between 0-255" -update:expression: "sudo ip tunnel change $VAR(../@) ttl $VAR(@)" -delete:expression: "sudo ip tunnel change $VAR(../@) ttl inherit" +update:expression: "ip tunnel change $VAR(../@) ttl $VAR(@)" +delete:expression: "ip tunnel change $VAR(../@) ttl inherit" comp_help: possible completions: <0-255> Set time to live (default 255) |