summaryrefslogtreecommitdiff
path: root/src/etc/udev/rules.d/65-vyos-net.rules
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-09-30 12:56:22 -0500
committerGitHub <noreply@github.com>2021-09-30 12:56:22 -0500
commitee5af5ddc65333c76baa498d6131f69073e39a7e (patch)
treee755f3e982c8fd33fd50b2778da8e082169504cf /src/etc/udev/rules.d/65-vyos-net.rules
parent17dc7cd0aaca5c4ae14d3dc843de7a5b612ab5ed (diff)
parentbfc5d6a1a48578a47369bde40388ec02bcedfa33 (diff)
downloadvyos-1x-ee5af5ddc65333c76baa498d6131f69073e39a7e.tar.gz
vyos-1x-ee5af5ddc65333c76baa498d6131f69073e39a7e.zip
Merge pull request #1019 from jestabro/interface-names
T3869: Rewrite vyatta_net_name/vyatta_interface_rescan in Python
Diffstat (limited to 'src/etc/udev/rules.d/65-vyos-net.rules')
-rw-r--r--src/etc/udev/rules.d/65-vyos-net.rules26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/etc/udev/rules.d/65-vyos-net.rules b/src/etc/udev/rules.d/65-vyos-net.rules
new file mode 100644
index 000000000..c8d5750dd
--- /dev/null
+++ b/src/etc/udev/rules.d/65-vyos-net.rules
@@ -0,0 +1,26 @@
+# These rules use vyos_net_name to persistently name network interfaces
+# per "hwid" association in the VyOS configuration file.
+
+ACTION!="add", GOTO="vyos_net_end"
+SUBSYSTEM!="net", GOTO="vyos_net_end"
+
+# ignore the interface if a name has already been set
+NAME=="?*", GOTO="vyos_net_end"
+
+# Do name change for ethernet and wireless devices only
+KERNEL!="eth*|wlan*", GOTO="vyos_net_end"
+
+# ignore "secondary" monitor interfaces of mac80211 drivers
+KERNEL=="wlan*", ATTRS{type}=="803", GOTO="vyos_net_end"
+
+# If using VyOS predefined names
+ENV{VYOS_IFNAME}!="eth*", GOTO="end_vyos_predef_names"
+
+DRIVERS=="?*", PROGRAM="vyos_net_name %k $attr{address} $env{VYOS_IFNAME}", NAME="%c", GOTO="vyos_net_end"
+
+LABEL="end_vyos_predef_names"
+
+# ignore interfaces without a driver link like bridges and VLANs
+DRIVERS=="?*", PROGRAM="vyos_net_name %k $attr{address}", NAME="%c"
+
+LABEL="vyos_net_end"