From b05ccf040f9ccd4d215794d5b4f03316343529dc Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Wed, 2 Jul 2014 00:29:58 +0200 Subject: Set separate virtual interface for QinQ. --- .../interfaces/ethernet/node.tag/vif-s/node.def | 19 +++++++++ .../node.tag/vif-s/node.tag/address/node.def | 18 +++++++++ .../vif-s/node.tag/bridge-group/bridge/node.def | 9 +++++ .../vif-s/node.tag/bridge-group/cost/node.def | 4 ++ .../node.tag/vif-s/node.tag/bridge-group/node.def | 4 ++ .../vif-s/node.tag/bridge-group/priority/node.def | 4 ++ .../node.tag/vif-s/node.tag/description/node.def | 8 ++++ .../vif-s/node.tag/dhcpv6-options/node.def | 47 ++++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../node.tag/dhcpv6-options/temporary/node.def | 3 ++ .../vif-s/node.tag/disable-link-detect/node.def | 3 ++ .../node.tag/vif-s/node.tag/disable/node.def | 11 +++++ .../vif-s/node.tag/ip/enable-proxy-arp/node.def | 3 ++ .../ethernet/node.tag/vif-s/node.tag/mtu/node.def | 9 +++++ .../node.tag/vif-s/node.tag/vif-c/node.def | 19 +++++++++ .../vif-s/node.tag/vif-c/node.tag/address/node.def | 18 +++++++++ .../vif-c/node.tag/bridge-group/bridge/node.def | 9 +++++ .../vif-c/node.tag/bridge-group/cost/node.def | 4 ++ .../node.tag/vif-c/node.tag/bridge-group/node.def | 4 ++ .../vif-c/node.tag/bridge-group/priority/node.def | 4 ++ .../node.tag/vif-c/node.tag/description/node.def | 8 ++++ .../vif-c/node.tag/dhcpv6-options/node.def | 47 ++++++++++++++++++++++ .../dhcpv6-options/parameters-only/node.def | 3 ++ .../node.tag/dhcpv6-options/temporary/node.def | 3 ++ .../vif-c/node.tag/disable-link-detect/node.def | 3 ++ .../vif-s/node.tag/vif-c/node.tag/disable/node.def | 11 +++++ .../vif-c/node.tag/ip/enable-proxy-arp/node.def | 3 ++ .../vif-s/node.tag/vif-c/node.tag/mtu/node.def | 9 +++++ .../interfaces/ethernet/node.tag/vif/node.def | 4 +- .../ethernet/node.tag/vif/node.tag/vif/node.def | 19 --------- .../vif/node.tag/vif/node.tag/address/node.def | 18 --------- .../vif/node.tag/bridge-group/bridge/node.def | 9 ----- .../vif/node.tag/bridge-group/cost/node.def | 4 -- .../node.tag/vif/node.tag/bridge-group/node.def | 4 -- .../vif/node.tag/bridge-group/priority/node.def | 4 -- .../vif/node.tag/vif/node.tag/description/node.def | 8 ---- .../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 -- .../vif/node.tag/disable-link-detect/node.def | 3 -- .../vif/node.tag/vif/node.tag/disable/node.def | 11 ----- .../vif/node.tag/ip/enable-proxy-arp/node.def | 3 -- .../vif/node.tag/vif/node.tag/mtu/node.def | 9 ----- 43 files changed, 292 insertions(+), 147 deletions(-) create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/address/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/bridge/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/cost/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/priority/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/description/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable-link-detect/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/ip/enable-proxy-arp/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/mtu/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/bridge/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/cost/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/priority/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/parameters-only/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/enable-proxy-arp/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/address/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/bridge/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/cost/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/priority/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/description/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable-link-detect/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/ip/enable-proxy-arp/node.def delete mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/mtu/node.def (limited to 'templates/interfaces/ethernet') diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.def new file mode 100644 index 00000000..0a4ed145 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.def @@ -0,0 +1,19 @@ +tag: +priority: 319 +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: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad 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 ip link set "$VAR(../@).$VAR(@)" up + fi + /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on + +delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 + ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/address/node.def new file mode 100644 index 00000000..db361f38 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/address/node.def @@ -0,0 +1,18 @@ +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/ethernet/node.tag/vif-s/node.tag/bridge-group/bridge/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/bridge/node.def new file mode 100644 index 00000000..0d1f16e2 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/bridge/node.def @@ -0,0 +1,9 @@ +type: txt + +help: Bridge group interface + +commit:expression: exec \ + "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=bridge" + +allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge + diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/cost/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/cost/node.def new file mode 100644 index 00000000..243747b9 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/cost/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Path cost for this port +syntax:expression: $VAR(@) >= 1 && $VAR(@) < 65536 ; "Bridge cost value must be between 1 and 65535" +val_help: u32:1-65535; Path cost value for Spanning Tree Protocol diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/node.def new file mode 100644 index 00000000..dfd046c2 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/node.def @@ -0,0 +1,4 @@ +priority: 320 +help: Add this interface to a bridge group + +end: /opt/vyatta/sbin/vyatta-bridge.pl ${COMMIT_ACTION} $VAR(../../@).$VAR(../@) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/priority/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/priority/node.def new file mode 100644 index 00000000..be0ff479 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/priority/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Bridge port priority +syntax:expression: $VAR(@) >= 0 &&$VAR(@) < 64; "Port priority must be between 0-63" +val_help: u32:0-63; Bridge port priority diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/description/node.def new file mode 100644 index 00000000..a0b29f05 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/description/node.def @@ -0,0 +1,8 @@ +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/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..9cf861b4 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/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-s/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/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-s/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable-link-detect/node.def new file mode 100644 index 00000000..5f60e6ab --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable-link-detect/node.def @@ -0,0 +1,3 @@ +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/ethernet/node.tag/vif-s/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable/node.def new file mode 100644 index 00000000..e9943645 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/disable/node.def @@ -0,0 +1,11 @@ +help: Disable interface +update: /etc/netplug/linkdown.d/dhclient $VAR(../../@).$VAR(../@) + if ! 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 ! ip link set $VAR(../../@).$VAR(../@) up; then + echo "Error enabling dev $VAR(../../@).$VAR(../@)" + exit 1 + fi diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ip/enable-proxy-arp/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ip/enable-proxy-arp/node.def new file mode 100644 index 00000000..cd6d56d9 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ip/enable-proxy-arp/node.def @@ -0,0 +1,3 @@ +help: Enable proxy-arp on this interface +create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../../@).$VAR(../../@)/proxy_arp\" " +delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../../@).$VAR(../../@)/proxy_arp\" " diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/mtu/node.def new file mode 100644 index 00000000..e0d3c3f9 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/mtu/node.def @@ -0,0 +1,9 @@ +type: u32 +priority: 381 +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: ip link set $VAR(../../@).$VAR(../@) mtu $VAR(@) +delete: [ -d /sys/class/net/$VAR(../../@).$VAR(../@) ] || exit 0 + ip link set $VAR(../../@).$VAR(../@) mtu 1500 diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.def new file mode 100644 index 00000000..8450acfd --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.def @@ -0,0 +1,19 @@ +tag: +priority: 320 +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: if ! ip link add link $VAR(../../@).$VAR(../@) name "$VAR(../../@).$VAR(../@).$VAR(@)" type vlan proto 802.1q id $VAR(@) + then echo "Error creating VLAN device $VAR(../../@).$VAR(../@).$VAR(@)" + exit 1 + fi + # if parent is up, then bring VLAN up + if [ $(( $(cat /sys/class/net/$VAR(../../@).$VAR(../@)/flags) & 1 )) -eq 1 ] + then ip link set "$VAR(../../@).$VAR(../@).$VAR(@)" up + fi + /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@).$VAR(@)" on + +delete: [ -d /sys/class/net/$VAR(../../@).$VAR(../@).$VAR(@) ] || exit 0 + ip link delete dev "$VAR(../../@).$VAR(../@).$VAR(@)" type vlan proto 802.1q id $VAR(@) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def new file mode 100644 index 00000000..93476d60 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def @@ -0,0 +1,18 @@ +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/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/bridge/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/bridge/node.def new file mode 100644 index 00000000..0d1f16e2 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/bridge/node.def @@ -0,0 +1,9 @@ +type: txt + +help: Bridge group interface + +commit:expression: exec \ + "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=bridge" + +allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge + diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/cost/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/cost/node.def new file mode 100644 index 00000000..243747b9 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/cost/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Path cost for this port +syntax:expression: $VAR(@) >= 1 && $VAR(@) < 65536 ; "Bridge cost value must be between 1 and 65535" +val_help: u32:1-65535; Path cost value for Spanning Tree Protocol diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/node.def new file mode 100644 index 00000000..a2f2ae42 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/node.def @@ -0,0 +1,4 @@ +priority: 320 +help: Add this interface to a bridge group + +end: /opt/vyatta/sbin/vyatta-bridge.pl ${COMMIT_ACTION} $VAR(../../../@).$VAR(../../@).$VAR(../@) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/priority/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/priority/node.def new file mode 100644 index 00000000..be0ff479 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/priority/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Bridge port priority +syntax:expression: $VAR(@) >= 0 &&$VAR(@) < 64; "Port priority must be between 0-63" +val_help: u32:0-63; Bridge port priority diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def new file mode 100644 index 00000000..9324ce1b --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def @@ -0,0 +1,8 @@ +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/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def new file mode 100644 index 00000000..805315fc --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/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(../../@).$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-s/node.tag/vif-c/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/parameters-only/node.def new file mode 100644 index 00000000..0e407f81 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/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-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def new file mode 100644 index 00000000..a850ef4b --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/temporary/node.def @@ -0,0 +1,3 @@ + +help: IPv6 "temporary" address + diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def new file mode 100644 index 00000000..ed593317 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable-link-detect/node.def @@ -0,0 +1,3 @@ +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/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def new file mode 100644 index 00000000..31c5a9b2 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def @@ -0,0 +1,11 @@ +help: Disable interface +update: /etc/netplug/linkdown.d/dhclient $VAR(../../../@).$VAR(../../@).$VAR(../@) + if ! 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 ! ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) up; then + echo "Error enabling dev $VAR(../../../@).$VAR(../../@).$VAR(../@)" + exit 1 + fi diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/enable-proxy-arp/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/enable-proxy-arp/node.def new file mode 100644 index 00000000..dd572811 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/enable-proxy-arp/node.def @@ -0,0 +1,3 @@ +help: Enable proxy-arp on this interface +create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../../../@).$VAR(../../../@).$VAR(../../@)/proxy_arp\" " +delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../../../@).$VAR(../../../@).$VAR(../../@)/proxy_arp\" " diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def new file mode 100644 index 00000000..eea81e2a --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def @@ -0,0 +1,9 @@ +type: u32 +priority: 381 +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: ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) mtu $VAR(@) +delete: [ -d /sys/class/net/$VAR(../../../@).$VAR(../../@).$VAR(../@) ] || exit 0 + ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) mtu 1500 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def index 49efa447..ab6da98e 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.def @@ -5,7 +5,7 @@ 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: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) +create: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) then echo "Error creating VLAN device $VAR(../@).$VAR(@)" exit 1 fi @@ -16,4 +16,4 @@ create: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan pro /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 - ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) + ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.def deleted file mode 100644 index 0ee6a08d..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.def +++ /dev/null @@ -1,19 +0,0 @@ -tag: -priority: 320 -type: u32 -help: Nested 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: if ! ip link add link $VAR(../../@).$VAR(../@) name "$VAR(../../@).$VAR(../@).$VAR(@)" type vlan proto 802.1q id $VAR(@) - then echo "Error creating VLAN device $VAR(../../@).$VAR(../@).$VAR(@)" - exit 1 - fi - # if parent is up, then bring VLAN up - if [ $(( $(cat /sys/class/net/$VAR(../../@).$VAR(../@)/flags) & 1 )) -eq 1 ] - then ip link set "$VAR(../../@).$VAR(../@).$VAR(@)" up - fi - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@).$VAR(@)" on - -delete: [ -d /sys/class/net/$VAR(../../@).$VAR(../@).$VAR(@) ] || exit 0 - ip link delete dev "$VAR(../../@).$VAR(../@).$VAR(@)" type vlan proto 802.1q id $VAR(@) diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/address/node.def deleted file mode 100644 index 93476d60..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/address/node.def +++ /dev/null @@ -1,18 +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/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/bridge/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/bridge/node.def deleted file mode 100644 index 0d1f16e2..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/bridge/node.def +++ /dev/null @@ -1,9 +0,0 @@ -type: txt - -help: Bridge group interface - -commit:expression: exec \ - "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=bridge" - -allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge - diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/cost/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/cost/node.def deleted file mode 100644 index 243747b9..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/cost/node.def +++ /dev/null @@ -1,4 +0,0 @@ -type: u32 -help: Path cost for this port -syntax:expression: $VAR(@) >= 1 && $VAR(@) < 65536 ; "Bridge cost value must be between 1 and 65535" -val_help: u32:1-65535; Path cost value for Spanning Tree Protocol diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/node.def deleted file mode 100644 index a2f2ae42..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/node.def +++ /dev/null @@ -1,4 +0,0 @@ -priority: 320 -help: Add this interface to a bridge group - -end: /opt/vyatta/sbin/vyatta-bridge.pl ${COMMIT_ACTION} $VAR(../../../@).$VAR(../../@).$VAR(../@) diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/priority/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/priority/node.def deleted file mode 100644 index be0ff479..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/priority/node.def +++ /dev/null @@ -1,4 +0,0 @@ -type: u32 -help: Bridge port priority -syntax:expression: $VAR(@) >= 0 &&$VAR(@) < 64; "Port priority must be between 0-63" -val_help: u32:0-63; Bridge port priority diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/description/node.def deleted file mode 100644 index 9324ce1b..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/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(../../@).$VAR(../@)/ifalias" -delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../../../@).$VAR(../../@).$VAR(../@)/ifalias" diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/node.def deleted file mode 100644 index 805315fc..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/node.def +++ /dev/null @@ -1,47 +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(../../@).$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/vif/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def deleted file mode 100644 index 0e407f81..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/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/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def deleted file mode 100644 index a850ef4b..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/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/ethernet/node.tag/vif/node.tag/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable-link-detect/node.def deleted file mode 100644 index ed593317..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/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(../../@).$VAR(../@) on -delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../../@).$VAR(../../@).$VAR(../@) off diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable/node.def deleted file mode 100644 index 31c5a9b2..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/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(../../@).$VAR(../@) - if ! 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 ! ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) up; then - echo "Error enabling dev $VAR(../../../@).$VAR(../../@).$VAR(../@)" - exit 1 - fi diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/ip/enable-proxy-arp/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/ip/enable-proxy-arp/node.def deleted file mode 100644 index dd572811..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/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(../../../../@).$VAR(../../../@).$VAR(../../@)/proxy_arp\" " -delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../../../@).$VAR(../../../@).$VAR(../../@)/proxy_arp\" " diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/mtu/node.def deleted file mode 100644 index eea81e2a..00000000 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/mtu/node.def +++ /dev/null @@ -1,9 +0,0 @@ -type: u32 -priority: 381 -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: ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) mtu $VAR(@) -delete: [ -d /sys/class/net/$VAR(../../../@).$VAR(../../@).$VAR(../@) ] || exit 0 - ip link set $VAR(../../../@).$VAR(../../@).$VAR(../@) mtu 1500 -- cgit v1.2.3