summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2016-09-06 15:25:59 +0200
committerKim Hagen <kim.sidney@gmail.com>2016-09-06 15:25:59 +0200
commit250ce3efbd6b8a56c40cd329d43531ebf45e117d (patch)
tree077c6329bb498fd51ba5bc5c4ee0c0b97edbc7be
parent38dac1e5bb30ce46d49cb8178f560d4126bd3b7e (diff)
downloadvyatta-cfg-system-250ce3efbd6b8a56c40cd329d43531ebf45e117d.tar.gz
vyatta-cfg-system-250ce3efbd6b8a56c40cd329d43531ebf45e117d.zip
Some devices use ethernet switch chips which use 'lan' interfaces,
this will add the option to also configure these in VyOS.
-rw-r--r--sysconf/netdevice1
-rw-r--r--templates/interfaces/ethernet/node.def16
2 files changed, 15 insertions, 2 deletions
diff --git a/sysconf/netdevice b/sysconf/netdevice
index 71fc310d..43634748 100644
--- a/sysconf/netdevice
+++ b/sysconf/netdevice
@@ -1,6 +1,7 @@
# device name to CLI path matching
lo loopback
eth ethernet
+lan ethernet
ifb input
peth pseudo-ethernet
br bridge
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def
index bdbdb0d5..2af57e0a 100644
--- a/templates/interfaces/ethernet/node.def
+++ b/templates/interfaces/ethernet/node.def
@@ -4,13 +4,18 @@ type: txt
help: Ethernet interface name
allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet
val_help: <ethN>; Ethernet interface name
-syntax:expression: pattern $VAR(@) "^eth[0-9]+$" \
+syntax:expression: pattern $VAR(@) "^(eth|lan)[0-9]+$" \
; "interface ethernet $VAR(@): not a valid name"
syntax:expression: exec \
"if [ ! -d /sys/class/net/$VAR(@) ]; then \
echo \"interface ethernet $VAR(@): does not exist\";
exit 1; \
+ fi
+
+ if ip link show | awk '{print $2 }' | grep -ao \"lan[0-9]@$VAR(@)\" > /dev/null 2>&1 ; then \
+ echo \"interface ethernet $VAR(@): is a switch master interface and not configurable, please use 'lan' interfaces\";
+ exit 1; \
fi"
begin: rm -f /tmp/speed-duplex.$VAR(@)
@@ -26,7 +31,14 @@ begin: rm -f /tmp/speed-duplex.$VAR(@)
create: if ! cli-shell-api exists interfaces ethernet $VAR(@) disable;
- then ip link set $VAR(@) up
+ then
+ case "$VAR(@)" in
+ *lan*)
+ masterint=$(ip link show $VAR(@) | awk 'NR==1{print $2 }' | grep -ao "eth[0-9]")
+ ip link set $masterint up
+ ;;
+ esac
+ ip link set $VAR(@) up
fi
/opt/vyatta/sbin/vyatta-link-detect $VAR(@) on