summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2010-05-26 16:11:36 -0700
committerBob Gilligan <gilligan@vyatta.com>2010-05-26 16:11:36 -0700
commit74105f39b3646c12c0dfed647c7fd9922cdd864e (patch)
treea5e63ce37d25d4bdb12cf0c5aa5f7dfa40014d61 /templates
parentfcc3a7c4d5465022a9f7092fc5d335a44e4211e4 (diff)
downloadvyatta-cfg-quagga-74105f39b3646c12c0dfed647c7fd9922cdd864e.tar.gz
vyatta-cfg-quagga-74105f39b3646c12c0dfed647c7fd9922cdd864e.zip
Move DHCPv6 client configuration to this package and restructre parameters.
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/ethernet/node.tag/address/node.def43
-rw-r--r--templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def49
-rw-r--r--templates/interfaces/ethernet/node.tag/dhcpv6-options/parameters-only/node.def3
-rw-r--r--templates/interfaces/ethernet/node.tag/dhcpv6-options/temporary/node.def3
4 files changed, 90 insertions, 8 deletions
diff --git a/templates/interfaces/ethernet/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/address/node.def
index db87ff05..7ed12bba 100644
--- a/templates/interfaces/ethernet/node.tag/address/node.def
+++ b/templates/interfaces/ethernet/node.tag/address/node.def
@@ -15,14 +15,41 @@ syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-set
#
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(../@)
-
-delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)
-
-allowed: echo "dhcp <>"
+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
+
+ 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
+
+allowed: echo "dhcp dhcpv6 <>"
comp_help:Possible completions:
- <x.x.x.x/x> Set the IP address and prefix length
+ <x.x.x.x/x> Set the IPv4 address and prefix length
<h:h:h:h:h:h:h:h/x> Set the IPv6 address and prefix length
- dhcp Set the IP address and prefix length via DHCP
-
+ dhcp Set the IPv4 address and prefix length via DHCP
+ dhcpv6 Set the IPv6 address and prefix length via DHCPv6
diff --git a/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def
new file mode 100644
index 00000000..aaeca067
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def
@@ -0,0 +1,49 @@
+# This node is run before the rest of the interface is configured.
+# We first check to see if DHCPv6 is still configured on the interface by
+# looking over at the interface address parameters. Then we check to see
+# if the DHCPv6 client program is still running on this interface. If both
+# of those are true, then any change to this tree means that the user
+# has changed this tree ONLY, and that we are going to have to re-start
+# the DHCPv6 client using the new parameters.
+
+
+priority: 317 # Run before interface has been configured
+
+help: Set options for DHCPv6
+
+end:
+ ifname="$VAR(../@)"
+ echo "dhcpv6-options: ifname is $ifname"
+
+ dhcpv6_set=0
+ for param in $VAR(../address/@@); do
+ if [ "$param" = "dhcpv6" ]; then
+ dhcpv6_set=1
+ fi
+ done
+
+ if [ $dhcpv6_set -eq 0 ]; then
+ echo "DHCPv6 is not configured on this interface"
+ exit 0
+ fi
+
+ conffile=/var/lib/dhcp3/dhclient_v6_$VAR(../@).conf
+ if [ ! -e $conffile ]; then
+ echo "Conf file $conffile doesn't exist"
+ exit 0
+ fi
+
+ if [ -n "$VAR(./parameters-only)" ]; then
+ arg1="--parameters-only"
+ fi
+
+ if [ -n "$VAR(./temporary)" ]; then
+ arg2="--temporary"
+ fi
+
+ echo "Re-starting DHCPv6 client on ${ifname}..."
+ sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \
+ --ifname $ifname $arg1 $arg2
+
+ echo "Done."
+ exit 0 \ No newline at end of file
diff --git a/templates/interfaces/ethernet/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/ethernet/node.tag/dhcpv6-options/parameters-only/node.def
new file mode 100644
index 00000000..0178c469
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/dhcpv6-options/parameters-only/node.def
@@ -0,0 +1,3 @@
+
+help: Acquire only config parameters, not address, via DHCPv6
+
diff --git a/templates/interfaces/ethernet/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/ethernet/node.tag/dhcpv6-options/temporary/node.def
new file mode 100644
index 00000000..afb9de9c
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/dhcpv6-options/temporary/node.def
@@ -0,0 +1,3 @@
+
+help: Acquire a "temporary" IPv6 address
+