diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-22 10:32:04 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-22 11:14:18 -0800 |
commit | 39a799dac616edd4b42a1b4de2c861f248318e1f (patch) | |
tree | 821d778a77ff75015dba4936ca10652824224ef9 /templates | |
parent | b17d21023482c752c490754a11450d4c41c83607 (diff) | |
download | vyatta-cfg-quagga-39a799dac616edd4b42a1b4de2c861f248318e1f.tar.gz vyatta-cfg-quagga-39a799dac616edd4b42a1b4de2c861f248318e1f.zip |
Use script vyatta-address to set interface
Avoid the overhead of perl compilation of vyatta-interfaces for each
address added. Handle the case of deleting address on deleted device
cleanly.
Clean up dhcpv6 script so it can be used on interfaces other
than ethernet.
Diffstat (limited to 'templates')
8 files changed, 17 insertions, 55 deletions
diff --git a/templates/interfaces/bonding/node.tag/address/node.def b/templates/interfaces/bonding/node.tag/address/node.def index 8956dba6..93a177b0 100644 --- a/templates/interfaces/bonding/node.tag/address/node.def +++ b/templates/interfaces/bonding/node.tag/address/node.def @@ -6,9 +6,9 @@ syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" commit:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-commit $VAR(@@) --dev $VAR(../@)" -create:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@) +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) -delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@) +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) allowed: echo "dhcp <>" val_help: ipv4net; IP address and prefix length diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/address/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/address/node.def index 236e6ae5..c413194b 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/address/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/address/node.def @@ -6,9 +6,9 @@ syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" commit:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-commit $VAR(@@) --dev $VAR(../../@).$VAR(../@)" -create:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../../@).$VAR(../@) +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../../@).$VAR(../@) $VAR(@) -delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../../@).$VAR(../@) +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../../@).$VAR(../@) $VAR(@) allowed: echo "dhcp <>" val_help: ipv4; IP address and prefix length diff --git a/templates/interfaces/bridge/node.tag/address/node.def b/templates/interfaces/bridge/node.tag/address/node.def index cb08069e..45aa03e2 100644 --- a/templates/interfaces/bridge/node.tag/address/node.def +++ b/templates/interfaces/bridge/node.tag/address/node.def @@ -5,19 +5,10 @@ help: IP address syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" -create: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@) +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) + +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) -delete: - if /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \ - --bridge-notin-proposedcfg \ - --bridge-interface="$VAR(../@)"; then \ - # bridge has higher priority than bridge-address so bridge gets deleted - # before bridge-address in case the whole of bridge config was deleted. - # In that case we do not need to delete address here now - exit 0 - else - sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@) - fi allowed: echo "dhcp <>" val_help: ipv4net; IP address and prefix length diff --git a/templates/interfaces/ethernet/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/address/node.def index c1bd8fc8..3cf32ef7 100644 --- a/templates/interfaces/ethernet/node.tag/address/node.def +++ b/templates/interfaces/ethernet/node.tag/address/node.def @@ -6,36 +6,9 @@ syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" commit:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-commit $VAR(@@) --dev $VAR(../@)" -create: - ifname=$VAR(../@) - param=$VAR(@) - if [ "$param" = "dhcpv6" ]; then - if [ -n "$VAR(../dhcpv6-options/parameters-only)" ]; then - echo "parameters-only is set" - arg1="--parameters-only" - fi - if [ -n "$VAR(../dhcpv6-options/temporary)" ]; then - echo "temporary is set" - arg2="--temporary" - fi +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) - echo "Starting DHCPv6 client on ${ifname}..." - sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --start \ - --ifname $ifname $arg1 $arg2 - else - sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@) - fi - -delete: - ifname=$VAR(../@) - param=$VAR(@) - if [ "$param" = "dhcpv6" ]; then - echo "Stopping DHCPv6 client on ${ifname}..." - sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --ifname \ - $ifname - else - sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@) - fi +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) allowed: echo "dhcp dhcpv6 <>" diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def index 535fa6d2..5c37e92d 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def @@ -6,9 +6,9 @@ syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" commit:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-commit $VAR(@@) --dev $VAR(../../@).$VAR(../@)" -create:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../../@).$VAR(../@) +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../../@).$VAR(../@) $VAR(@) -delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../../@).$VAR(../@) +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../../@).$VAR(../@) $VAR(@) allowed: echo "dhcp <>" diff --git a/templates/interfaces/loopback/node.tag/address/node.def b/templates/interfaces/loopback/node.tag/address/node.def index c0ec9386..98788814 100644 --- a/templates/interfaces/loopback/node.tag/address/node.def +++ b/templates/interfaces/loopback/node.tag/address/node.def @@ -6,8 +6,6 @@ help: IP address syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" -create:expression: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)"; \ - "Error setting address $VAR(@) on interface $VAR(../@)" +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) -delete:expression: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)"; \ - "Error deleting address $VAR(@) on interface $VAR(../@)" +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) diff --git a/templates/interfaces/pseudo-ethernet/node.tag/address/node.def b/templates/interfaces/pseudo-ethernet/node.tag/address/node.def index ad900975..b237e108 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/address/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/address/node.def @@ -4,9 +4,9 @@ help: IP address syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" -create:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@) +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) -delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@) +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) allowed: echo "dhcp <>" diff --git a/templates/interfaces/tunnel/node.tag/address/node.def b/templates/interfaces/tunnel/node.tag/address/node.def index e6a1e542..04612379 100644 --- a/templates/interfaces/tunnel/node.tag/address/node.def +++ b/templates/interfaces/tunnel/node.tag/address/node.def @@ -6,7 +6,7 @@ help: IP address syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)" -create:expression: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)"; "Error setting address $VAR(@) on interface $VAR(../@)" +create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) -delete:expression: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)"; "Error deleting address $VAR(@) on interface $VAR(../@)" +delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) |