2007-08-02 23:19:41 +04:00
# do not edit this file, it will be overwritten on update
2006-09-05 17:20:28 +04:00
# these rules generate rules for persistent network device naming
2007-09-21 19:42:46 +04:00
#
# 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
2006-09-05 17:20:28 +04:00
2007-08-02 23:19:41 +04:00
ACTION!="add", GOTO="persistent_net_generator_end"
SUBSYSTEM!="net", GOTO="persistent_net_generator_end"
# ignore the interface if a name has already been set
NAME=="?*", GOTO="persistent_net_generator_end"
2006-09-05 17:20:28 +04:00
2007-09-21 19:42:46 +04:00
# 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"
2007-08-02 23:19:41 +04:00
# ignore Xen virtual interfaces
SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end"
2006-09-09 16:45:45 +04:00
2007-09-21 19:42:46 +04:00
# 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:
2007-07-25 17:42:39 +04:00
SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)"
SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
2007-07-25 20:16:11 +04:00
SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)"
2006-09-09 16:45:45 +04:00
SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})"
2006-09-05 17:20:28 +04:00
2007-09-21 19:42:46 +04:00
# 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"
2007-08-02 23:19:41 +04:00
2007-09-21 19:42:46 +04:00
# write rule
DRIVERS=="?*", IMPORT{program}="write_net_rules"
2007-08-02 23:19:41 +04:00
2007-09-21 19:42:46 +04:00
# rename interface if needed
2006-09-05 17:20:28 +04:00
ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"
LABEL="persistent_net_generator_end"