summaryrefslogtreecommitdiffstats
path: root/debian/extra/rules/73-usb-net-by-mac.rules
blob: 20c3e84ff0eef9e3f21aae0f5932a4cf53437a33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Use MAC based names for network interfaces which are directly or indirectly
# on USB and have an universally administered (stable) MAC address (second bit
# is 0). Don't do this when ifnames is disabled via kernel command line or
# customizing/disabling 99-default.link (or previously 80-net-setup-link.rules)
# or if the interface name was provided by user-space.

ACTION=="remove", GOTO="usb_net_by_mac_end"
SUBSYSTEM!="net", GOTO="usb_net_by_mac_end"
ATTR{name_assign_type}=="3", GOTO="usb_net_by_mac_end"

IMPORT{cmdline}="net.ifnames"
ENV{net.ifnames}=="0", GOTO="usb_net_by_mac_end"

SUBSYSTEMS=="usb", NAME=="", \
    ATTR{address}=="?[014589cd]:*", \
    TEST!="/etc/udev/rules.d/80-net-setup-link.rules", \
    TEST!="/etc/systemd/network/99-default.link", \
    IMPORT{builtin}="net_id", NAME="$env{ID_NET_NAME_MAC}"

LABEL="usb_net_by_mac_end"