chiark / gitweb /
rules: Debian update
[elogind.git] / rules / debian / 75-persistent-net-generator.rules
1 # These rules generate rules to keep network interface names unchanged
2 # across reboots and write them to /etc/udev/rules.d/70-persistent-net.rules.
3
4 # variables used to communicate:
5 #   MATCHADDR           MAC address used for the match
6 #   MATCHID             bus_id used for the match
7 #   MATCHDRV            driver name used for the match
8 #   MATCHIFTYPE         interface type match
9 #   COMMENT             comment to add to the generated rule
10 #   INTERFACE_NAME      requested name supplied by external tool
11 #   INTERFACE_NEW       new interface name returned by rule writer
12
13 ACTION!="add",                          GOTO="persistent_net_generator_end"
14 SUBSYSTEM!="net",                       GOTO="persistent_net_generator_end"
15
16 # ignore the interface if a name has already been set
17 NAME=="?*",                             GOTO="persistent_net_generator_end"
18
19 # device name whitelist
20 KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \
21                                         GOTO="persistent_net_generator_end"
22
23 # ignore Xen virtual interfaces
24 SUBSYSTEMS=="xen",                      GOTO="persistent_net_generator_end"
25
26 # ignore UML virtual interfaces
27 DRIVERS=="uml-netdev",                  GOTO="persistent_net_generator_end"
28
29 # ignore "secondary" raw interfaces of the madwifi driver
30 KERNEL=="ath*", ATTRS{type}=="802",     GOTO="persistent_net_generator_end"
31
32 # ignore "secondary" monitor interfaces of mac80211 drivers
33 KERNEL=="wlan*", ATTRS{type}=="803",    GOTO="persistent_net_generator_end"
34
35 # by default match on the MAC address and interface type
36 ENV{MATCHADDR}="$attr{address}"
37 ENV{MATCHIFTYPE}="$attr{type}"
38
39 # ignore interfaces with locally administered or null MAC addresses
40 # and VMWare virtual interfaces
41 ENV{MATCHADDR}=="?[2367abef]:*",        ENV{MATCHADDR}=""
42 ENV{MATCHADDR}=="00:00:00:00:00:00",    ENV{MATCHADDR}=""
43 ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}=""
44
45 # ibmveth interfaces have stable locally administered MAC addresses
46 SUBSYSTEMS=="ibmveth",                  ENV{MATCHADDR}="$attr{address}"
47
48 # S/390 interfaces are matched only by id
49 SUBSYSTEMS=="ccwgroup", \
50         ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}=""
51
52 # terminate processing if there are not enough conditions to create a rule
53 ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \
54                                         GOTO="persistent_net_generator_end"
55
56
57 # provide nice comments for the generated rules
58 SUBSYSTEMS=="pci", \
59  ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}"
60 SUBSYSTEMS=="pcmcia", \
61  ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}"
62 SUBSYSTEMS=="usb", \
63  ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}"
64 SUBSYSTEMS=="ccwgroup", \
65  ENV{COMMENT}="S/390 device at $id"
66 SUBSYSTEMS=="ibmveth", \
67  ENV{COMMENT}="LPAR virtual device at $id"
68 SUBSYSTEMS=="ieee1394", \
69  ENV{COMMENT}="Firewire device $attr{host_id}"
70 ENV{COMMENT}=="", \
71  ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})"
72 ATTRS{driver}=="?*", \
73  ENV{COMMENT}="$env{COMMENT} ($attr{driver})"
74
75
76 # ignore interfaces without a driver link like bridges and VLANs, otherwise
77 # generate and write the rule
78 DRIVERS=="?*", IMPORT{program}="write_net_rules"
79
80 # rename the interface if requested
81 ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"
82
83 LABEL="persistent_net_generator_end"
84