diff options
Diffstat (limited to 'templates/interfaces/bonding')
8 files changed, 110 insertions, 1 deletions
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 + |