diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2009-09-09 17:38:00 -0700 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2009-09-14 11:03:39 -0700 |
commit | a6cff4bb17b9d6c636a93ad97021611d30854682 (patch) | |
tree | e33baed86eaebc30e7b262ddad37c172bef05b30 | |
parent | ce22375fbf6b7083e6c1ca3698a7a44983913d47 (diff) | |
download | vyatta-cfg-a6cff4bb17b9d6c636a93ad97021611d30854682.tar.gz vyatta-cfg-a6cff4bb17b9d6c636a93ad97021611d30854682.zip |
Bugfix 4700, 4269: Fix set and commit-time checks for ethernet vif addresses too
Also restore "--valid-addr" flag to vyatta-interfaces.pl since it is used outside
this package.
(cherry picked from commit d32ceb43ab64530c6eca81ec83fe4b374dd510d0)
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 1 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def | 17 | ||||
-rw-r--r-- | templates/interfaces/loopback/node.tag/address/node.def | 5 |
3 files changed, 21 insertions, 2 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 798a23b..267ae44 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -71,6 +71,7 @@ EOF GetOptions("eth-addr-update=s" => \$eth_update, "eth-addr-delete=s" => \$eth_delete, + "valid-addr=s" => \$addr_set, "valid-addr-set=s" => \$addr_set, "valid-addr-commit=s{,}" => \@addr_commit, "dev=s" => \$dev, 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 4c93905..a5edef6 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 @@ -1,11 +1,26 @@ multi: + type: txt + help: Set an IP address for this interface -syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $VAR(@) --dev $VAR(../../@).$VAR(../@) "\ + +# Syntax check at "set" time. Give curent address value to script +# so that it can perform syntax check. +# +syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-set $VAR(@) --dev $VAR(../../@).$VAR(../@) "\ ; "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../../@).$VAR(../@)" + +# Syntax check at "commit" time. Pass all address values to script so that +# it can perform consistency check. +# +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(../@) + delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../../@).$VAR(../@) + allowed: echo "dhcp <>" + comp_help:Possible completions: <x.x.x.x/x> Set the IP address and prefix length <h:h:h:h:h:h:h:h/x> Set the IPv6 address and prefix length diff --git a/templates/interfaces/loopback/node.tag/address/node.def b/templates/interfaces/loopback/node.tag/address/node.def index 29e8973..76c2e76 100644 --- a/templates/interfaces/loopback/node.tag/address/node.def +++ b/templates/interfaces/loopback/node.tag/address/node.def @@ -1,7 +1,10 @@ multi: + type: txt + help: Set an IP address for this interface -syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $VAR(@) --dev $VAR(../@)"; \ + +syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-set $VAR(@) --dev $VAR(../@)"; \ "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../@)" create:expression: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)"; \ |