From 535038b0a269f19c58ed1be3b4aafba66877ae2e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 30 Nov 2010 10:47:51 -0800 Subject: Add dhcpv6 options for all interfaces that support DHCP DHCPv6 is not restricted to ethernet only anymore. --- .../interfaces/bonding/node.tag/address/node.def | 2 +- .../bonding/node.tag/dhcpv6-options/node.def | 49 ++++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../node.tag/dhcpv6-options/temporary/node.def | 3 ++ .../bonding/node.tag/vif/node.tag/address/node.def | 1 + .../node.tag/vif/node.tag/dhcpv6-options/node.def | 47 +++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../vif/node.tag/dhcpv6-options/temporary/node.def | 3 ++ .../interfaces/bridge/node.tag/address/node.def | 2 +- .../bridge/node.tag/dhcpv6-options/node.def | 49 ++++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../node.tag/dhcpv6-options/temporary/node.def | 3 ++ .../node.tag/vif/node.tag/address/node.def | 1 + .../node.tag/vif/node.tag/dhcpv6-options/node.def | 47 +++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../vif/node.tag/dhcpv6-options/temporary/node.def | 3 ++ .../pseudo-ethernet/node.tag/address/node.def | 2 +- .../node.tag/dhcpv6-options/node.def | 49 ++++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../node.tag/dhcpv6-options/temporary/node.def | 3 ++ 20 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 templates/interfaces/bonding/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/bonding/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/bonding/node.tag/dhcpv6-options/temporary/node.def create mode 100644 templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def create mode 100644 templates/interfaces/bridge/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/bridge/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/bridge/node.tag/dhcpv6-options/temporary/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def create mode 100644 templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/temporary/node.def (limited to 'templates') diff --git a/templates/interfaces/bonding/node.tag/address/node.def b/templates/interfaces/bonding/node.tag/address/node.def index 93a177b0..a5714772 100644 --- a/templates/interfaces/bonding/node.tag/address/node.def +++ b/templates/interfaces/bonding/node.tag/address/node.def @@ -14,4 +14,4 @@ allowed: echo "dhcp <>" val_help: ipv4net; IP address and prefix length val_help: ipv6net; IPv6 address and prefix length val_help: dhcp; Dynamic Host Configuration Protocol - +val_help: dhcpv6; Dynamic Host Configuration Protocol for IPv6 diff --git a/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..d9c814ee --- /dev/null +++ b/templates/interfaces/bonding/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: DHCPv6 options + +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 diff --git a/templates/interfaces/bonding/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/bonding/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/dhcpv6-options/parameters-only/node.def @@ -0,0 +1,3 @@ + +help: Acquire only config parameters, not address + diff --git a/templates/interfaces/bonding/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/bonding/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/bonding/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + 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 c413194b..773da775 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 @@ -14,3 +14,4 @@ allowed: echo "dhcp <>" val_help: ipv4; IP address and prefix length val_help: ipv6; IPv6 address and prefix length val_help: dhcp; Dynamic Host Configuration Protocol +val_help: dhcpv6; Dynamic Host Configuration Protocol for IPv6 diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..9cf861b4 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def @@ -0,0 +1,47 @@ +# 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: DHCPv6 options + +end: + ifname="$VAR(../../@).$VAR(../@)" + + 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 + + exit 0 diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def @@ -0,0 +1,3 @@ + +help: Acquire only config parameters, not address + diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + diff --git a/templates/interfaces/bridge/node.tag/address/node.def b/templates/interfaces/bridge/node.tag/address/node.def index 45aa03e2..ab0e5593 100644 --- a/templates/interfaces/bridge/node.tag/address/node.def +++ b/templates/interfaces/bridge/node.tag/address/node.def @@ -9,8 +9,8 @@ create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@) delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@) - allowed: echo "dhcp <>" val_help: ipv4net; IP address and prefix length val_help: ipv6net; IPv6 address and prefix length val_help: dhcp; Dynamic Host Configuration Protocol +val_help: dhcpv6; Dynamic Host Configuration Protocol for IPv6 diff --git a/templates/interfaces/bridge/node.tag/dhcpv6-options/node.def b/templates/interfaces/bridge/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..d9c814ee --- /dev/null +++ b/templates/interfaces/bridge/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: DHCPv6 options + +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 diff --git a/templates/interfaces/bridge/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/bridge/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/dhcpv6-options/parameters-only/node.def @@ -0,0 +1,3 @@ + +help: Acquire only config parameters, not address + diff --git a/templates/interfaces/bridge/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/bridge/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/bridge/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + 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 5c37e92d..574b24ed 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 @@ -15,3 +15,4 @@ allowed: echo "dhcp <>" val_help: ipv4; IP address and prefix length val_help: ipv6; IPv6 address and prefix length val_help: dhcp; Dynamic Host Configuration Protocol +val_help: dhcpv6; Dynamic Host Configuration Protocol for IPv6 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..9cf861b4 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def @@ -0,0 +1,47 @@ +# 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: DHCPv6 options + +end: + ifname="$VAR(../../@).$VAR(../@)" + + 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 + + exit 0 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def @@ -0,0 +1,3 @@ + +help: Acquire only config parameters, not address + diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + diff --git a/templates/interfaces/pseudo-ethernet/node.tag/address/node.def b/templates/interfaces/pseudo-ethernet/node.tag/address/node.def index b237e108..d2812446 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/address/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/address/node.def @@ -13,4 +13,4 @@ allowed: echo "dhcp <>" val_help: ipv4net; IP address and prefix length val_help: ipv6net; IPv6 address and prefix length val_help: dhcp; Dynamic Host Configuration Protocol - +val_help: dhcpv6; Dynamic Host Configuration Protocol for IPv6 diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..d9c814ee --- /dev/null +++ b/templates/interfaces/pseudo-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: DHCPv6 options + +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 diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/parameters-only/node.def @@ -0,0 +1,3 @@ + +help: Acquire only config parameters, not address + diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + -- cgit v1.2.3