diff options
author | Kim Hagen <khagen@multi-development.com> | 2014-07-02 00:29:58 +0200 |
---|---|---|
committer | Kim Hagen <khagen@multi-development.com> | 2014-07-02 00:29:58 +0200 |
commit | b05ccf040f9ccd4d215794d5b4f03316343529dc (patch) | |
tree | 9efcc12dbbe5956c7a86c12e118e9cafb4e314e9 /templates/interfaces/ethernet | |
parent | 60b94f9699e623d05e5cf554e66047fcf5142c70 (diff) | |
download | vyatta-cfg-system-b05ccf040f9ccd4d215794d5b4f03316343529dc.tar.gz vyatta-cfg-system-b05ccf040f9ccd4d215794d5b4f03316343529dc.zip |
Set separate virtual interface for QinQ.
Diffstat (limited to 'templates/interfaces/ethernet')
29 files changed, 148 insertions, 3 deletions
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/node.tag/vif/node.tag/bridge-group/bridge/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/bridge/node.def index 0d1f16e2..0d1f16e2 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/bridge/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/bridge/node.def 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-s/node.tag/bridge-group/cost/node.def index 243747b9..243747b9 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/cost/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/cost/node.def 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/node.tag/vif/node.tag/bridge-group/priority/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/priority/node.def index be0ff479..be0ff479 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/priority/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/bridge-group/priority/node.def 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/node.tag/vif/node.tag/dhcpv6-options/parameters-only/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/parameters-only/node.def index 0e407f81..0e407f81 100644 --- 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-s/node.tag/dhcpv6-options/parameters-only/node.def 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-s/node.tag/dhcpv6-options/temporary/node.def index a850ef4b..a850ef4b 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/temporary/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/temporary/node.def 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/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.def index 0ee6a08d..8450acfd 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.def @@ -1,7 +1,7 @@ tag: priority: 320 type: u32 -help: Nested Virtual Local Area Network (VLAN) ID +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 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def index 93476d60..93476d60 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/address/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/address/node.def 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/node.tag/vif/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/node.def index a2f2ae42..a2f2ae42 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/bridge-group/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/bridge-group/node.def 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/node.tag/vif/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def index 9324ce1b..9324ce1b 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/description/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/description/node.def 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-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def index 805315fc..805315fc 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def 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/node.tag/vif/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 index ed593317..ed593317 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/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 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def index 31c5a9b2..31c5a9b2 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/disable/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/disable/node.def 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-s/node.tag/vif-c/node.tag/ip/enable-proxy-arp/node.def index dd572811..dd572811 100644 --- 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-s/node.tag/vif-c/node.tag/ip/enable-proxy-arp/node.def diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def index eea81e2a..eea81e2a 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vif/node.tag/mtu/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/mtu/node.def 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(@) |