summaryrefslogtreecommitdiff
path: root/extras/rule_generator/75-persistent-net-generator.rules
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-09-21 17:42:46 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-09-21 17:42:46 +0200
commitc746922ca26fe18f6b3f3a4516e7236bfc0106b7 (patch)
tree80fa9a6e1cb00a5f0313ee346c572a391b63442b /extras/rule_generator/75-persistent-net-generator.rules
parentb317b96c15bc61d59f138515e71f05bbd8f7b2ff (diff)
rule_generator: move all policy from write_net_rules to the rules file
Diffstat (limited to 'extras/rule_generator/75-persistent-net-generator.rules')
-rw-r--r--extras/rule_generator/75-persistent-net-generator.rules43
1 files changed, 33 insertions, 10 deletions
diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules
index f88627d384..d09bc38028 100644
--- a/extras/rule_generator/75-persistent-net-generator.rules
+++ b/extras/rule_generator/75-persistent-net-generator.rules
@@ -1,33 +1,56 @@
# do not edit this file, it will be overwritten on update
# these rules generate rules for persistent network device naming
+#
+# variables used to communicate:
+# MATCHADDR MAC address used for the match
+# MATCHID bus_id used for the match
+# MATCHDRV driver name used for the match
+# MATCHIFTYPE interface type match
+# COMMENT comment to add to the generated rule
+# INTERFACE_NAME requested name supplied by external tool
+# INTERFACE_NEW new interface name returned by rule writer
ACTION!="add", GOTO="persistent_net_generator_end"
SUBSYSTEM!="net", GOTO="persistent_net_generator_end"
-# device name whitelist
-KERNEL!="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
-
# ignore the interface if a name has already been set
NAME=="?*", GOTO="persistent_net_generator_end"
+# device name whitelist
+KERNEL!="eth*|ath*|wlan*[0-9]|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
+
+# add interface type match for some devices
+KERNEL=="wlan*|ath*", ENV{MATCHIFTYPE}="1"
+
# ignore Xen virtual interfaces
SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end"
-# build device description string to add a comment to the generated rule
+# read MAC address
+ENV{MATCHADDR}="$attr{address}"
+
+# do not use "locally administered" MAC address
+ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}=""
+
+# do not use empty address
+ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}=""
+
+# build comment line for generated rule:
SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)"
SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)"
-SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}="$id", ENV{NETDRV}="$driver"
SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})"
-ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($driver)"
-DRIVERS=="?*", ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}"
+# S/390 uses id matches only, do not use MAC address match
+SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}=""
+
+# default comment
+ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device"
-# skip "locally administered" MAC addresses
-ATTR{address}=="?[2367abef]:*", GOTO="persistent_net_generator_end"
+# write rule
+DRIVERS=="?*", IMPORT{program}="write_net_rules"
-DRIVERS=="?*", ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}"
+# rename interface if needed
ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"
LABEL="persistent_net_generator_end"