diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-04 09:25:02 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-04 16:30:02 +0200 |
commit | 47c784c1eea80d322e5f0dfa0b7906616e61e702 (patch) | |
tree | 08e44c08bd0c8245b31272427920fd02f3e17b05 | |
parent | 3309122cfeb89396ac40f0a46948f87614b74781 (diff) | |
download | vyatta-cfg-system-47c784c1eea80d322e5f0dfa0b7906616e61e702.tar.gz vyatta-cfg-system-47c784c1eea80d322e5f0dfa0b7906616e61e702.zip |
bonding: T1614: remove old style node.def files in favour of XML/Python rewrite
64 files changed, 0 insertions, 949 deletions
diff --git a/scripts/vyatta-bonding.pl b/scripts/vyatta-bonding.pl deleted file mode 100755 index 24182af3..00000000 --- a/scripts/vyatta-bonding.pl +++ /dev/null @@ -1,288 +0,0 @@ -#!/usr/bin/perl -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# A copy of the GNU General Public License is available as -# `/usr/share/common-licenses/GPL' in the Debian GNU/Linux distribution -# or on the World Wide Web at `http://www.gnu.org/copyleft/gpl.html'. -# You can also obtain it by writing to the Free Software Foundation, -# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, -# MA 02110-1301, USA. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Stephen Hemminger -# Date: September 2008 -# Description: Script to setup bonding interfaces -# -# **** End License **** -# - -use lib "/opt/vyatta/share/perl5/"; -use Vyatta::Interface; -use Vyatta::Config; -use Getopt::Long; - -use strict; -use warnings; - -my %modes = ( - "round-robin" => 0, - "active-backup" => 1, - "xor-hash" => 2, - "broadcast" => 3, - "802.3ad" => 4, - "transmit-load-balance" => 5, - "adaptive-load-balance" => 6, -); - -sub set_mode { - my ( $intf, $mode ) = @_; - my $val = $modes{$mode}; - die "Unknown bonding mode $mode\n" unless defined($val); - - open my $fm, '>', "/sys/class/net/$intf/bonding/mode" - or die "Error: $intf is not a bonding device:$!\n"; - print {$fm} $val, "\n"; - close $fm - or die "Error: $intf can not set mode $val:$!\n"; -} - -sub set_hash_policy { - my ( $intf, $hash ) = @_; - - open my $fm, '>', "/sys/class/net/$intf/bonding/xmit_hash_policy" - or die "Error: $intf is not a bonding device:$!\n"; - print {$fm} $hash, "\n"; - close $fm - or die "Error: $intf can not set hash $hash:$!\n"; -} - -sub get_slaves { - my $intf = shift; - - open my $f, '<', "/sys/class/net/$intf/bonding/slaves" - or die "$intf is not a bonding interface"; - my $slaves = <$f>; - close $f; - return unless $slaves; - - chomp $slaves; - return split( ' ', $slaves ); -} - -sub add_slave { - my ( $intf, $slave ) = @_; - my $sysfs_slaves = "/sys/class/net/$intf/bonding/slaves"; - - open my $f, '>', $sysfs_slaves - or die "Can't open $sysfs_slaves: $!"; - - print {$f} "+$slave\n"; - close $f; -} - -sub remove_slave { - my ( $intf, $slave ) = @_; - my $sysfs_slaves = "/sys/class/net/$intf/bonding/slaves"; - - open my $f, '>', $sysfs_slaves - or die "Can't open $sysfs_slaves: $!"; - - print {$f} "-$slave\n"; - close $f; -} - -# Go dumpster diving to figure out which ethernet interface (if any) -# gave it's address to be used by all bonding devices. -sub primary_slave { - my ( $intf, $bond_addr ) = @_; - - open my $p, '<', "/proc/net/bonding/$intf" - or die "Can't open /proc/net/bonding/$intf : $!"; - - my ( $dev, $match ); - while ( my $line = <$p> ) { - chomp $line; - if ( $line =~ m/^Slave Interface: (.*)$/ ) { - $dev = $1; - } - elsif ( $line =~ m/^Permanent HW addr: (.*)$/ ) { - if ( $1 eq $bond_addr ) { - $match = $dev; - last; - } - } - } - close $p; - - return $match; -} - -sub get_irq_affinity { - my $intf = shift; - my $cfg = new Vyatta::Config; - - my $slaveif = new Vyatta::Interface($intf); - unless ($slaveif) { - warn "$intf: unknown interface type"; - return; - } - $cfg->setLevel($slaveif->path()); - return $cfg->returnValue('smp-affinity'); -} - -sub if_down { - my $intf = shift; - system "sudo ip link set dev $intf down" - and die "Could not set $intf up ($!)\n"; -} - -sub if_up { - my $intf = shift; - system "sudo ip link set dev $intf up" - and die "Could not set $intf up ($!)\n"; - - my $smp_affinity = get_irq_affinity($intf); - if ($smp_affinity) { - system "/opt/vyatta/sbin/irq-affinity.pl $intf $smp_affinity" - and warn "Could not set $intf smp-affinity $smp_affinity\n"; - } -} - -# Can't change mode when bond device is up and slaves are attached -sub change_mode { - my ( $intf, $mode ) = @_; - my $interface = new Vyatta::Interface($intf); - die "$intf is not a valid interface" unless $interface; - - my $bond_up = $interface->up(); - - if_down($intf) if ($bond_up); - - # Remove all interfaces; do primary last - my $primary = primary_slave( $intf, $interface->hw_address()); - my @slaves = get_slaves($intf); - - foreach my $slave (@slaves) { - remove_slave( $intf, $slave ) unless ( $primary && $slave eq $primary ); - } - remove_slave( $intf, $primary ) if ($primary); - - set_mode( $intf, $mode ); - - add_slave( $intf, $primary) if ($primary); - foreach my $slave ( @slaves ) { - add_slave( $intf, $slave ) unless ($primary && $slave eq $primary); - } - if_up($intf) if ($bond_up); -} - -# Can't change hash when bond device is up -sub change_hash { - my ( $intf, $hash ) = @_; - my $interface = new Vyatta::Interface($intf); - die "$intf is not a valid interface" unless $interface; - my $bond_up = $interface->up(); - - if_down($intf) if $bond_up; - set_hash_policy( $intf, $hash ); - if_up($intf) if $bond_up; -} - -# Consistency checks prior to commit -sub commit_check { - my ( $intf, $slave ) = @_; - my $cfg = new Vyatta::Config; - - die "Bonding interface $intf does not exist\n" - unless ( -d "/sys/class/net/$intf" ); - - my $slaveif = new Vyatta::Interface($slave); - die "$slave: unknown interface type" unless $slaveif; - $cfg->setLevel($slaveif->path()); - - die "Error: can not add disabled interface $slave to bond-group $intf\n" - if $cfg->exists('disable'); - - die "Error: can not add interface $slave that is part of bridge to bond-group\n" - if defined($cfg->returnValue("bridge-group bridge")); - - my @addr = $cfg->returnValues('address'); - die "Error: can not add interface $slave with addresses to bond-group\n" - if (@addr); - - my @vrrp = $cfg->listNodes('vrrp vrrp-group'); - die "Error: can not add interface $slave with VRRP to bond-group\n" - if (@vrrp); - - $cfg->setLevel('interfaces pseudo-ethernet'); - foreach my $peth ($cfg->listNodes()) { - my $link = $cfg->returnValue("$peth link"); - - die "Error: can not add interface $slave to bond-group already used by pseudo-ethernet $peth\n" - if ($link eq $slave); - } -} - -# bonding requires interface to be down before enslaving -# but enslaving automatically brings interface up! -sub add_port { - my ( $intf, $slave ) = @_; - my $cfg = new Vyatta::Config; - my $slaveif = new Vyatta::Interface($slave); - die "$slave: unknown interface type" unless $slaveif; - - $cfg->setLevel($slaveif->path()); - my $old = $cfg->returnOrigValue('bond-group'); - - if_down($slave) if ($slaveif->up()); - remove_slave($old, $slave) if $old; - add_slave ($intf, $slave); -} - -sub remove_port { - my ( $intf, $slave ) = @_; - - remove_slave ($intf, $slave); - if_up ($slave); -} - -sub usage { - print "Usage: $0 --dev=bondX --mode={mode}\n"; - print " $0 --dev=bondX --hash=layerX\n"; - print " $0 --dev=bondX --add=ethX\n"; - print " $0 --dev=bondX --remove=ethX\n"; - print print "modes := ", join( ',', sort( keys %modes ) ), "\n"; - - exit 1; -} - -my ( $dev, $mode, $hash, $add_port, $rem_port, $check ); - -GetOptions( - 'dev=s' => \$dev, - 'mode=s' => \$mode, - 'hash=s' => \$hash, - 'add=s' => \$add_port, - 'remove=s' => \$rem_port, - 'check=s' => \$check, -) or usage(); - -die "$0: device not specified\n" unless $dev; - -commit_check($dev, $check) if $check; -change_mode( $dev, $mode ) if $mode; -change_hash( $dev, $hash ) if $hash; -add_port( $dev, $add_port ) if $add_port; -remove_port( $dev, $rem_port ) if $rem_port; diff --git a/templates/interfaces/bonding/node.def b/templates/interfaces/bonding/node.def deleted file mode 100644 index 1fa270b4..00000000 --- a/templates/interfaces/bonding/node.def +++ /dev/null @@ -1,35 +0,0 @@ -tag: -priority: 315 -type: txt -help: Bonding interface name -val_help: <bondN>; Bonding interface name -syntax:expression: pattern $VAR(@) "^bond[0-9]+$" \ - ; "bonding must be (bond0-bond99)" - -begin: if [ ! -f /sys/class/net/bonding_masters ]; then - sudo modprobe bonding max_bonds=0 miimon=250 - fi - -create: sudo sh -c "echo +$VAR(@) > /sys/class/net/bonding_masters" || exit 1 - touch /tmp/bonding_$VAR(@).$PPID - -delete: SLAVES=`cat /sys/class/net/$VAR(@)/bonding/slaves`; - if [ -z "$SLAVES" ] - then - sudo sh -c "echo -$VAR(@) > /sys/class/net/bonding_masters" - else - echo "bonded interface $VAR(@) still has slaves: $SLAVES" - exit 1; - fi - -end: `/bin/cli-shell-api exists interfaces bonding $VAR(@) disable` - if [ $? -ne 0 ] - then - if [ -f /tmp/bonding_$VAR(@).$PPID ] - then rm -f /tmp/bonding_$VAR(@).$PPID - sudo ip link set "$VAR(@)" up - /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on - fi - else - sudo ip link set "$VAR(@)" down - fi diff --git a/templates/interfaces/bonding/node.tag/address/node.def b/templates/interfaces/bonding/node.tag/address/node.def deleted file mode 100644 index 2789d865..00000000 --- a/templates/interfaces/bonding/node.tag/address/node.def +++ /dev/null @@ -1,18 +0,0 @@ -multi: -priority: 320 # after ether device bonding groups -type: txt -help: IP address - -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-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/bonding/node.tag/arp-monitor/interval/node.def b/templates/interfaces/bonding/node.tag/arp-monitor/interval/node.def deleted file mode 100644 index 010a953b..00000000 --- a/templates/interfaces/bonding/node.tag/arp-monitor/interval/node.def +++ /dev/null @@ -1,7 +0,0 @@ -type: u32 -default: 0 -help: ARP link monitoring frequency in milliseconds - -update: sudo sh -c "echo $VAR(@) >/sys/class/net/$VAR(../../@)/bonding/arp_interval" -delete: sudo sh -c 'echo 0 > /sys/class/net/$VAR(../../@)/bonding/arp_interval' - sudo sh -c 'echo 250 > /sys/class/net/$VAR(../../@)/bonding/miimon' diff --git a/templates/interfaces/bonding/node.tag/arp-monitor/node.def b/templates/interfaces/bonding/node.tag/arp-monitor/node.def deleted file mode 100644 index e1c392a7..00000000 --- a/templates/interfaces/bonding/node.tag/arp-monitor/node.def +++ /dev/null @@ -1 +0,0 @@ -help: ARP link monitoring parameters diff --git a/templates/interfaces/bonding/node.tag/arp-monitor/target/node.def b/templates/interfaces/bonding/node.tag/arp-monitor/target/node.def deleted file mode 100644 index 7dad4c4c..00000000 --- a/templates/interfaces/bonding/node.tag/arp-monitor/target/node.def +++ /dev/null @@ -1,7 +0,0 @@ -multi: -type: ipv4 -help: IP address to use for ARP monitoring - -create: sudo sh -c "echo +$VAR(@) >/sys/class/net/$VAR(../../@)/bonding/arp_ip_target" - -delete: sudo sh -c "echo -$VAR(@) >/sys/class/net/$VAR(../../@)/bonding/arp_ip_target" diff --git a/templates/interfaces/bonding/node.tag/description/node.def b/templates/interfaces/bonding/node.tag/description/node.def deleted file mode 100644 index c6d2789d..00000000 --- a/templates/interfaces/bonding/node.tag/description/node.def +++ /dev/null @@ -1,8 +0,0 @@ -type: txt -help: Description - -syntax:expression: pattern $VAR(@) "^.{1,256}$" \ - ; "interface description is too long (limit 256 characters)" - -update: sudo sh -c "echo \"$VAR(@)\" >/sys/class/net/$VAR(../@)/ifalias" -delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../@)/ifalias" diff --git a/templates/interfaces/bonding/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/dhcp-options/client-id/node.def deleted file mode 100644 index 85ebe6e3..00000000 --- a/templates/interfaces/bonding/node.tag/dhcp-options/client-id/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/dhcp-options/host-name/node.def deleted file mode 100644 index 80d28fbd..00000000 --- a/templates/interfaces/bonding/node.tag/dhcp-options/host-name/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/dhcp-options/node.def deleted file mode 100644 index e90406df..00000000 --- a/templates/interfaces/bonding/node.tag/dhcp-options/node.def +++ /dev/null @@ -1 +0,0 @@ -help: DHCP options diff --git a/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def deleted file mode 100644 index d25533f9..00000000 --- a/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def +++ /dev/null @@ -1,52 +0,0 @@ -# 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: 319 # 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/dhcp/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 - if [ $? != 0 ]; then - exit 1 - fi - - 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 deleted file mode 100644 index 0e407f81..00000000 --- a/templates/interfaces/bonding/node.tag/dhcpv6-options/parameters-only/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -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 deleted file mode 100644 index a850ef4b..00000000 --- a/templates/interfaces/bonding/node.tag/dhcpv6-options/temporary/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -help: IPv6 "temporary" address - diff --git a/templates/interfaces/bonding/node.tag/disable-link-detect/node.def b/templates/interfaces/bonding/node.tag/disable-link-detect/node.def deleted file mode 100644 index 7129ff33..00000000 --- a/templates/interfaces/bonding/node.tag/disable-link-detect/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Ignore link state changes -update:/opt/vyatta/sbin/vyatta-link-detect $VAR(../@) on -delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../@) off diff --git a/templates/interfaces/bonding/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/disable/node.def deleted file mode 100644 index c4a4c681..00000000 --- a/templates/interfaces/bonding/node.tag/disable/node.def +++ /dev/null @@ -1,11 +0,0 @@ -help: Disable interface -create: /etc/netplug/linkdown.d/dhclient $VAR(../@) - if ! sudo ip link set $VAR(../@) down 2>/dev/null; then - echo "Error disabling dev $VAR(../@)" - /etc/netplug/linkup.d/dhclient $VAR(../@) - exit 1 - fi -delete: if ! sudo ip link set $VAR(../@) up; then - echo "Error enabling dev $VAR(../@)" - exit 1 - fi diff --git a/templates/interfaces/bonding/node.tag/hash-policy/node.def b/templates/interfaces/bonding/node.tag/hash-policy/node.def deleted file mode 100644 index 81fb2901..00000000 --- a/templates/interfaces/bonding/node.tag/hash-policy/node.def +++ /dev/null @@ -1,12 +0,0 @@ -type: txt -default: "layer2" -allowed: echo "layer2 layer2+3 layer3+4" -syntax:expression: $VAR(@) in "layer2", "layer2+3", "layer3+4" \ - ; "hash-policy must be layer2 layer3+4 or layer2+3" -help: Bonding transmit hash policy - -update: sudo ${vyatta_sbindir}/vyatta-bonding.pl --dev=$VAR(../@) --hash=$VAR(@) - -val_help: layer2; use MAC addresses to generate the hash (802.3ad) -val_help: layer2+3; combine MAC address and IP address to make hash -val_help: layer3+4; combine IP address and port to make hash diff --git a/templates/interfaces/bonding/node.tag/ip/arp-cache-timeout/node.def b/templates/interfaces/bonding/node.tag/ip/arp-cache-timeout/node.def deleted file mode 100644 index 4441914c..00000000 --- a/templates/interfaces/bonding/node.tag/ip/arp-cache-timeout/node.def +++ /dev/null @@ -1,9 +0,0 @@ -help: ARP cache entry timeout in seconds - -type: u32 - -create:expression: "sudo sh -c \"echo $((1000*$VAR(@))) > /proc/sys/net/ipv4/neigh/$VAR(../../@)/base_reachable_time_ms\" " - -update:expression: "sudo sh -c \"echo $((1000*$VAR(@))) > /proc/sys/net/ipv4/neigh/$VAR(../../@)/base_reachable_time_ms\" " - -delete:expression: "sudo sh -c \"echo 30000 > /proc/sys/net/ipv4/neigh/$VAR(../../@)/base_reachable_time_ms\" " diff --git a/templates/interfaces/bonding/node.tag/ip/enable-proxy-arp/node.def b/templates/interfaces/bonding/node.tag/ip/enable-proxy-arp/node.def deleted file mode 100644 index ae7ba09a..00000000 --- a/templates/interfaces/bonding/node.tag/ip/enable-proxy-arp/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Enable proxy-arp on this interface -create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/proxy_arp\" " -delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/proxy_arp\" " diff --git a/templates/interfaces/bonding/node.tag/ip/proxy-arp-pvlan/node.def b/templates/interfaces/bonding/node.tag/ip/proxy-arp-pvlan/node.def deleted file mode 100644 index a6cf9494..00000000 --- a/templates/interfaces/bonding/node.tag/ip/proxy-arp-pvlan/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Enable private VLAN proxy ARP on this interface -create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/proxy_arp_pvlan\" " -delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/proxy_arp_pvlan\" " diff --git a/templates/interfaces/bonding/node.tag/mac/node.def b/templates/interfaces/bonding/node.tag/mac/node.def deleted file mode 100644 index c315af71..00000000 --- a/templates/interfaces/bonding/node.tag/mac/node.def +++ /dev/null @@ -1,6 +0,0 @@ -type: macaddr -help: Media Access Control (MAC) address -syntax:expression: exec "\ - /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --valid-mac $VAR(@)" -update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(@) -# delete does nothing since there is no hardware original value diff --git a/templates/interfaces/bonding/node.tag/mode/node.def b/templates/interfaces/bonding/node.tag/mode/node.def deleted file mode 100644 index a21d2961..00000000 --- a/templates/interfaces/bonding/node.tag/mode/node.def +++ /dev/null @@ -1,19 +0,0 @@ -type: txt -default: "802.3ad" -allowed: echo 802.3ad active-backup broadcast round-robin \ - transmit-load-balance adaptive-load-balance xor-hash -syntax:expression: $VAR(@) in \ - "802.3ad", "active-backup", "broadcast", "round-robin", \ - "transmit-load-balance", "adaptive-load-balance", "xor-hash" ; \ - "mode must be 802.3ad, active-backup, broadcast, round-robin, \ -transmit-load-balance, adaptive-load-balance, or xor" -help: Bonding mode -update: sudo ${vyatta_sbindir}/vyatta-bonding.pl --dev=$VAR(../@) --mode=$VAR(@) - -val_help: 802.3ad; IEEE 802.3ad Dynamic link aggregation (Default) -val_help: active-backup; Fault tolerant: only one slave in the bond is active -val_help: broadcast; Fault tolerant: transmits everything on all slave interfaces -val_help: round-robin; Load balance: transmit packets in sequential order -val_help: transmit-load-balance; Load balance: adapts based on transmit load and speed -val_help: adaptive-load-balance; Load balance: adapts based on transmit and receive plus ARP -val_help: xor-hash; Load balance: distribute based on MAC address diff --git a/templates/interfaces/bonding/node.tag/mtu/node.def b/templates/interfaces/bonding/node.tag/mtu/node.def deleted file mode 100644 index 71347c58..00000000 --- a/templates/interfaces/bonding/node.tag/mtu/node.def +++ /dev/null @@ -1,7 +0,0 @@ -type: u32 -priority: 381 -help: Maximum Transmission Unit (MTU) -syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" -val_help: u32:68-9000; Maximum Transmission Unit -update: sudo ip link set $VAR(../@) mtu $VAR(@) -delete: sudo ip link set $VAR(../@) mtu 1500 diff --git a/templates/interfaces/bonding/node.tag/primary/node.def b/templates/interfaces/bonding/node.tag/primary/node.def deleted file mode 100644 index 98a18a48..00000000 --- a/templates/interfaces/bonding/node.tag/primary/node.def +++ /dev/null @@ -1,10 +0,0 @@ -type: txt -priority: 320 # must be after ethernet bond-group -commit:expression: exec \ - "grep -s $VAR(@) /sys/class/net/$VAR(../@)/bonding/slaves" \ - ; "Ethernet interface must be part of the bonding group" -commit:expression: exec \ - "grep -E '(^active-backup|^balance-tlb|^balance-alb)' /sys/class/net/$VAR(../@)/bonding/mode" \ - ; "Bonding must have mode active-backup, transmit-load-balance or adaptive-load-balance" -update: sudo sh -c "echo $VAR(@) >/sys/class/net/$VAR(../@)/bonding/primary" -help: Primary device interface diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.def deleted file mode 100644 index 2c483317..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.def +++ /dev/null @@ -1,26 +0,0 @@ -tag: -priority: 320 -type: u32 -help: QinQ TAG-S Virtual Local Area Network (VLAN) ID -syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" -val_help: u32:0-4094; VLAN ID - -create: ETHERTYPE=`echo "$VAR(ethertype/@)"` - if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi - if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi - - if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@) - then echo "Error creating VLAN device $VAR(../@).$VAR(@)" - exit 1 - fi - # if parent is up, then bring VLAN up - if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ] - then sudo ip link set "$VAR(../@).$VAR(@)" up - fi - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on - -delete: ETHERTYPE=`echo "$VAR(ethertype/@)"` - if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi - if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi - [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 - sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/address/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/address/node.def deleted file mode 100644 index f025dece..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/address/node.def +++ /dev/null @@ -1,17 +0,0 @@ -multi: -type: txt -help: IP address - -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-address add $VAR(../../@).$VAR(../@) $VAR(@) - -delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../../@).$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/bonding/node.tag/vif-s/node.tag/description/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/description/node.def deleted file mode 100644 index a0b29f05..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/description/node.def +++ /dev/null @@ -1,8 +0,0 @@ -type: txt -help: Description - -syntax:expression: pattern $VAR(@) "^.{1,256}$" \ - ; "interface description is too long (limit 256 characters)" - -update: sudo sh -c "echo \"$VAR(@)\" >/sys/class/net/$VAR(../../@).$VAR(../@)/ifalias" -delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../../@).$VAR(../@)/ifalias" diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def deleted file mode 100644 index 85ebe6e3..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def deleted file mode 100644 index 80d28fbd..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/node.def deleted file mode 100644 index e90406df..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/node.def +++ /dev/null @@ -1 +0,0 @@ -help: DHCP options diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def deleted file mode 100644 index d6fea411..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def +++ /dev/null @@ -1,50 +0,0 @@ -# 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: 319 # 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/dhcp/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 - if [ $? != 0 ]; then - exit 1 - fi - - exit 0 diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/parameters-only/node.def deleted file mode 100644 index 0e407f81..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/parameters-only/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -help: Acquire only config parameters, not address - diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def deleted file mode 100644 index a850ef4b..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -help: IPv6 "temporary" address - diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/disable-link-detect/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/disable-link-detect/node.def deleted file mode 100644 index 5f60e6ab..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/disable-link-detect/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Ignore link state changes -update:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../@).$VAR(../@) on -delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../@).$VAR(../@) off diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/disable/node.def deleted file mode 100644 index 12db6a98..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/disable/node.def +++ /dev/null @@ -1,11 +0,0 @@ -help: Disable interface -update: /etc/netplug/linkdown.d/dhclient $VAR(../../@).$VAR(../@) - if ! sudo ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then - echo "Error disabling dev $VAR(../../@).$VAR(../@)" - /etc/netplug/linkup.d/dhclient $VAR(../../@).$VAR(../@) - exit 1 - fi -delete: if ! sudo ip link set $VAR(../../@).$VAR(../@) up; then - echo "Error enabling dev $VAR(../../@).$VAR(../@)" - exit 1 - fi diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def deleted file mode 100644 index 24d08568..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def +++ /dev/null @@ -1,26 +0,0 @@ -type: txt -help: Set Ethertype -syntax:expression: $VAR(@) in "0x88A8", "0x8100";"Must be (0x88A8 0x8100)\n" -default: "0x88A8" - -comp_help: possible completions: - 0x88A8 802.1AD - 0x8100 802.1Q - -update: ACTIVEETHTYPE=`cli-shell-api returnActiveValue interfaces bonding $VAR(../../@) vif-s $VAR(../@) ethertype` - if [ ! -z $VAR(../vif-c/@@) ] && [ ! -z $ACTIVEETHTYPE ] - then echo "Can not change ethertype with vif-c configured" - exit 1 - fi - ETHERTYPE=`echo "$VAR(@)"` - if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi - if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi - read -a SLAVES </sys/class/net/$VAR(../../@)/bonding/slaves - if [ ${#SLAVES[*]} -eq 0 ]; then - echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" - exit 1 - fi - sudo ip link delete dev "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) > /dev/null 2>&1 - sudo ip link add link $VAR(../../@) name "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) || exit 1 - sudo ip link set "$VAR(../../@).$VAR(../@)" up - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@)" on diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/mac/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/mac/node.def deleted file mode 100644 index 750710ec..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/mac/node.def +++ /dev/null @@ -1,4 +0,0 @@ -type: macaddr -help: Media Access Control (MAC) address - -update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../../@).$VAR(../@) --set-mac $VAR(@) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/mtu/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/mtu/node.def deleted file mode 100644 index b3f3e7c7..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/mtu/node.def +++ /dev/null @@ -1,9 +0,0 @@ -type: u32 -priority: 382 -help: Maximum Transmission Unit (MTU) -val_help: u32:68-9000; Maximum Transmission Unit (MTU) -syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" - -update: sudo ip link set $VAR(../../@).$VAR(../@) mtu $VAR(@) -delete: [ -d /sys/class/net/$VAR(../../@).$VAR(../@) ] || exit 0 - sudo ip link set $VAR(../../@).$VAR(../@) mtu 1500 diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.def deleted file mode 100644 index eb32ce61..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.def +++ /dev/null @@ -1,18 +0,0 @@ -tag: -priority: 321 -type: u32 -help: QinQ TAG-C Virtual Local Area Network (VLAN) ID -syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" -val_help: u32:0-4094; VLAN ID - -create: read -a SLAVES </sys/class/net/$VAR(../../@)/bonding/slaves - if [ ${#SLAVES[*]} -eq 0 ]; then - echo "Must configure slave devices for bond interface $VAR(../../@) before adding vif" - exit 1 - fi - sudo ip link add link $VAR(../../@).$VAR(../@) name "$VAR(../../@).$VAR(../@).$VAR(@)" type vlan proto 802.1q id $VAR(@) || exit 1 - sudo ip link set "$VAR(../../@).$VAR(../@).$VAR(@)" up - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@).$VAR(@)" on - -delete: [ -d /sys/class/net/$VAR(../../@).$VAR(../@).$VAR(@) ] || exit 0 - sudo ip link delete dev "$VAR(../../@).$VAR(../@).$VAR(@)" type vlan proto 802.1q id $VAR(@) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def deleted file mode 100644 index 415ef4b3..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def +++ /dev/null @@ -1,17 +0,0 @@ -multi: -type: txt -help: IP address - -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(../../@).$VAR(../@)" - -create: sudo /opt/vyatta/sbin/vyatta-address add $VAR(../../../@).$VAR(../../@).$VAR(../@) $VAR(@) - -delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../../../@).$VAR(../../@).$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/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def deleted file mode 100644 index 9324ce1b..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def +++ /dev/null @@ -1,8 +0,0 @@ -type: txt -help: Description - -syntax:expression: pattern $VAR(@) "^.{1,256}$" \ - ; "interface description is too long (limit 256 characters)" - -update: sudo sh -c "echo \"$VAR(@)\" >/sys/class/net/$VAR(../../../@).$VAR(../../@).$VAR(../@)/ifalias" -delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../../../@).$VAR(../../@).$VAR(../@)/ifalias" diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def deleted file mode 100644 index 85ebe6e3..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def deleted file mode 100644 index 80d28fbd..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def deleted file mode 100644 index e90406df..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def +++ /dev/null @@ -1 +0,0 @@ -help: DHCP options diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def deleted file mode 100644 index 0be14824..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def +++ /dev/null @@ -1,50 +0,0 @@ -# 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: 319 # Run before interface has been configured - -help: DHCPv6 options - -end: - ifname="$VAR(../../../@).$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/dhcp/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 - if [ $? != 0 ]; then - exit 1 - fi - - exit 0 diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/parameters-only/node.def deleted file mode 100644 index 0e407f81..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/parameters-only/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -help: Acquire only config parameters, not address - diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def deleted file mode 100644 index a850ef4b..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -help: IPv6 "temporary" address - diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def deleted file mode 100644 index ed593317..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Ignore link state changes -update:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../../@).$VAR(../../@).$VAR(../@) on -delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../../@).$VAR(../../@).$VAR(../@) off diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def deleted file mode 100644 index 7069e9c9..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def +++ /dev/null @@ -1,11 +0,0 @@ -help: Disable interface -update: /etc/netplug/linkdown.d/dhclient $VAR(../../../@).$VAR(../../@).$VAR(../@) - if ! sudo ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) down 2>/dev/null; then - echo "Error disabling dev $VAR(../../../@).$VAR(../../@).$VAR(../@)" - /etc/netplug/linkup.d/dhclient $VAR(../../../@).$VAR(../../@).$VAR(../@) - exit 1 - fi -delete: if ! sudo ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) up; then - echo "Error enabling dev $VAR(../../../@).$VAR(../../@).$VAR(../@)" - exit 1 - fi diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/mac/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/mac/node.def deleted file mode 100644 index 24b4b4d7..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/mac/node.def +++ /dev/null @@ -1,4 +0,0 @@ -type: macaddr -help: Media Access Control (MAC) address - -update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../../../@).$VAR(../../@).$VAR(../@) --set-mac $VAR(@) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def deleted file mode 100644 index 264c429b..00000000 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def +++ /dev/null @@ -1,9 +0,0 @@ -type: u32 -priority: 382 -help: Maximum Transmission Unit (MTU) -val_help: u32:68-9000; Maximum Transmission Unit (MTU) -syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" - -update: sudo ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) mtu $VAR(@) -delete: [ -d /sys/class/net/$VAR(../../../@).$VAR(../../@).$VAR(../@) ] || exit 0 - sudo ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) mtu 1500 diff --git a/templates/interfaces/bonding/node.tag/vif/node.def b/templates/interfaces/bonding/node.tag/vif/node.def deleted file mode 100644 index e7262d63..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.def +++ /dev/null @@ -1,18 +0,0 @@ -tag: -priority: 320 -type: u32 -help: Virtual Local Area Network (VLAN) ID -syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" -val_help: u32:0-4094; VLAN ID - -create: read -a SLAVES </sys/class/net/$VAR(../@)/bonding/slaves - if [ ${#SLAVES[*]} -eq 0 ]; then - echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" - exit 1 - fi - sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1 - sudo ip link set "$VAR(../@).$VAR(@)" up - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on - -delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 - sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) 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 deleted file mode 100644 index f025dece..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/address/node.def +++ /dev/null @@ -1,17 +0,0 @@ -multi: -type: txt -help: IP address - -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-address add $VAR(../../@).$VAR(../@) $VAR(@) - -delete: sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../../@).$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/bonding/node.tag/vif/node.tag/description/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/description/node.def deleted file mode 100644 index a0b29f05..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/description/node.def +++ /dev/null @@ -1,8 +0,0 @@ -type: txt -help: Description - -syntax:expression: pattern $VAR(@) "^.{1,256}$" \ - ; "interface description is too long (limit 256 characters)" - -update: sudo sh -c "echo \"$VAR(@)\" >/sys/class/net/$VAR(../../@).$VAR(../@)/ifalias" -delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../../@).$VAR(../@)/ifalias" diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/client-id/node.def deleted file mode 100644 index 85ebe6e3..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/client-id/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/host-name/node.def deleted file mode 100644 index 80d28fbd..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/host-name/node.def +++ /dev/null @@ -1,2 +0,0 @@ -type: txt -help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/node.def deleted file mode 100644 index e90406df..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/node.def +++ /dev/null @@ -1 +0,0 @@ -help: DHCP options 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 deleted file mode 100644 index 41975dea..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def +++ /dev/null @@ -1,50 +0,0 @@ -# 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/dhcp/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 - if [ $? != 0 ]; then - exit 1 - fi - - 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 deleted file mode 100644 index 0e407f81..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -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 deleted file mode 100644 index a850ef4b..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def +++ /dev/null @@ -1,3 +0,0 @@ - -help: IPv6 "temporary" address - diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/disable-link-detect/node.def deleted file mode 100644 index 5f60e6ab..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/disable-link-detect/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Ignore link state changes -update:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../@).$VAR(../@) on -delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../@).$VAR(../@) off diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def deleted file mode 100644 index 12db6a98..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/disable/node.def +++ /dev/null @@ -1,11 +0,0 @@ -help: Disable interface -update: /etc/netplug/linkdown.d/dhclient $VAR(../../@).$VAR(../@) - if ! sudo ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then - echo "Error disabling dev $VAR(../../@).$VAR(../@)" - /etc/netplug/linkup.d/dhclient $VAR(../../@).$VAR(../@) - exit 1 - fi -delete: if ! sudo ip link set $VAR(../../@).$VAR(../@) up; then - echo "Error enabling dev $VAR(../../@).$VAR(../@)" - exit 1 - fi diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/mac/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/mac/node.def deleted file mode 100644 index 750710ec..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/mac/node.def +++ /dev/null @@ -1,4 +0,0 @@ -type: macaddr -help: Media Access Control (MAC) address - -update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../../@).$VAR(../@) --set-mac $VAR(@) diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/mtu/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/mtu/node.def deleted file mode 100644 index b3f3e7c7..00000000 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/mtu/node.def +++ /dev/null @@ -1,9 +0,0 @@ -type: u32 -priority: 382 -help: Maximum Transmission Unit (MTU) -val_help: u32:68-9000; Maximum Transmission Unit (MTU) -syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" - -update: sudo ip link set $VAR(../../@).$VAR(../@) mtu $VAR(@) -delete: [ -d /sys/class/net/$VAR(../../@).$VAR(../@) ] || exit 0 - sudo ip link set $VAR(../../@).$VAR(../@) mtu 1500 diff --git a/templates/interfaces/ethernet/node.tag/bond-group/node.def b/templates/interfaces/ethernet/node.tag/bond-group/node.def deleted file mode 100644 index dff97395..00000000 --- a/templates/interfaces/ethernet/node.tag/bond-group/node.def +++ /dev/null @@ -1,12 +0,0 @@ -priority: 319 -type: txt -help: Assign interface to bonding group -allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show=bonding -syntax:expression: pattern $VAR(@) "^bond[0-9]+$" \ - ; "$VAR(@): not a valid name for a bonding interface" - -commit:expression: exec "${vyatta_sbindir}/vyatta-bonding.pl --dev=$VAR(@) --check=$VAR(../@)" - -update: sudo ${vyatta_sbindir}/vyatta-bonding.pl --dev=$VAR(@) --add=$VAR(../@) - -delete: sudo ${vyatta_sbindir}/vyatta-bonding.pl --dev=$VAR(@) --remove=$VAR(../@) |