summaryrefslogtreecommitdiff
path: root/src/etc/udev/rules.d/65-vyatta-net.rules
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-20 20:48:58 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-20 20:48:58 +0100
commit511c127832667f5db218cf803ad88355f873d399 (patch)
tree8a322e8bd9b9260c7ffdc4f80320058017f43c32 /src/etc/udev/rules.d/65-vyatta-net.rules
parent44b7157addd4427e1bee20e9918ccc6a22814eec (diff)
downloadvyos-1x-511c127832667f5db218cf803ad88355f873d399.tar.gz
vyos-1x-511c127832667f5db218cf803ad88355f873d399.zip
udev: import rule file from vyatta-cfg-system
Diffstat (limited to 'src/etc/udev/rules.d/65-vyatta-net.rules')
-rw-r--r--src/etc/udev/rules.d/65-vyatta-net.rules26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/etc/udev/rules.d/65-vyatta-net.rules b/src/etc/udev/rules.d/65-vyatta-net.rules
new file mode 100644
index 000000000..2b48c1213
--- /dev/null
+++ b/src/etc/udev/rules.d/65-vyatta-net.rules
@@ -0,0 +1,26 @@
+# These rules use vyatta_net_name to persistently name network interfaces
+# per "hwid" association in the Vyatta configuration file.
+
+ACTION!="add", GOTO="vyatta_net_end"
+SUBSYSTEM!="net", GOTO="vyatta_net_end"
+
+# ignore the interface if a name has already been set
+NAME=="?*", GOTO="vyatta_net_end"
+
+# Do name change for ethernet and wireless devices only
+KERNEL!="eth*|wlan*", GOTO="vyatta_net_end"
+
+# ignore "secondary" monitor interfaces of mac80211 drivers
+KERNEL=="wlan*", ATTRS{type}=="803", GOTO="vyatta_net_end"
+
+# If using VyOS predefined names
+ENV{VYOS_IFNAME}!="eth*", GOTO="end_vyos_predef_names"
+
+DRIVERS=="?*", PROGRAM="vyatta_net_name %k $attr{address} $env{VYOS_IFNAME}", NAME="%c", GOTO="vyatta_net_end"
+
+LABEL="end_vyos_predef_names"
+
+# ignore interfaces without a driver link like bridges and VLANs
+DRIVERS=="?*", PROGRAM="vyatta_net_name %k $attr{address}", NAME="%c"
+
+LABEL="vyatta_net_end"