Re: [systemd-devel] [systemd.link] How to use NamePolicy=mac?

2014-10-22 Thread Tom Gundersen
On Wed, Oct 8, 2014 at 10:04 AM, Moviuro movi...@gmail.com wrote:
 Hi all!

 In order to fix in an easily predictable manner the interfaces' names, I went
 and wrote the following .link file:

 /etc/systemd/network/00-default.link
 [Link]
 NamePolicy=mac
 MACAddressPolicy=persistent

Looks good.

 I daemon-reload, reboot:

 $ ip a
 [...]
 4: eth0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP
 group default qlen 1000
 link/ether b8:27:eb:aa:aa:d2 brd ff:ff:ff:ff:ff:ff
 [...]
 [...]

 However,
 $ udevadm test-builtin net_setup_link /sys/class/net/eth0
 calling: test-builtin
 load module index
 timestamp of '/etc/systemd/network' changed
 Parsed configuration file /usr/lib/systemd/network/99-default.link
 Parsed configuration file /etc/systemd/network/00-default.link
 Created link configuration context.
 ID_NET_DRIVER=smsc95xx
 Config file /etc/systemd/network/00-default.link applies to device eth0
 ID_NET_NAME=enxb827ebd2

Looks bad. This is a bug somewhere, if ID_NET_NAME is set, then also
your if should get renamed. Does this also happen if you reboot, and
can you reproduce with current git?

I'll take a look. Thanks for the report!

Cheers,

Tom

 unload module index
 Unloaded link configuration context.

 Also,
 # /lib/systemd/systemd-udevd --debug
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram9'
 restoring old watch on '/dev/ram9'
 adding watch on '/dev/ram9'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram8'
 restoring old watch on '/dev/ram8'
 adding watch on '/dev/ram8'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram7'
 restoring old watch on '/dev/ram7'
 adding watch on '/dev/ram7'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram5'
 restoring old watch on '/dev/ram5'
 adding watch on '/dev/ram5'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram14'
 restoring old watch on '/dev/ram14'
 adding watch on '/dev/ram14'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram2'
 restoring old watch on '/dev/ram2'
 adding watch on '/dev/ram2'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram15'
 restoring old watch on '/dev/ram15'
 adding watch on '/dev/ram15'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram6'
 restoring old watch on '/dev/ram6'
 adding watch on '/dev/ram6'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram4'
 restoring old watch on '/dev/ram4'
 adding watch on '/dev/ram4'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram3'
 restoring old watch on '/dev/ram3'
 adding watch on '/dev/ram3'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram13'
 restoring old watch on '/dev/ram13'
 adding watch on '/dev/ram13'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram11'
 restoring old watch on '/dev/ram11'
 adding watch on '/dev/ram11'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop6'
 restoring old watch on '/dev/loop6'
 adding watch on '/dev/loop6'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram12'
 restoring old watch on '/dev/ram12'
 adding watch on '/dev/ram12'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop3'
 restoring old watch on '/dev/loop3'
 adding watch on '/dev/loop3'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop5'
 restoring old watch on '/dev/loop5'
 adding watch on '/dev/loop5'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram1'
 restoring old watch on '/dev/ram1'
 adding watch on '/dev/ram1'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram0'
 restoring old watch on '/dev/ram0'
 adding watch on '/dev/ram0'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop7'
 restoring old watch on '/dev/loop7'
 adding watch on '/dev/loop7'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/ram10'
 restoring old watch on '/dev/ram10'
 adding watch on '/dev/ram10'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop1'
 restoring old watch on '/dev/loop1'
 adding watch on '/dev/loop1'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop2'
 restoring old watch on '/dev/loop2'
 adding watch on '/dev/loop2'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop4'
 restoring old watch on '/dev/loop4'
 adding watch on '/dev/loop4'
 device 0xb78bb3f8 has devpath '/devices/virtual/block/loop0'
 restoring old watch on '/dev/loop0'
 adding watch on '/dev/loop0'
 device 0xb78bb3f8 has devpath '/devices/platform/mmc-
 bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0/mmcblk0p2'
 restoring old watch on '/dev/mmcblk0p2'
 adding watch on '/dev/mmcblk0p2'
 device 0xb78bb3f8 has devpath '/devices/platform/mmc-
 bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0/mmcblk0p1'
 restoring old watch on '/dev/mmcblk0p1'
 adding watch on '/dev/mmcblk0p1'
 device 0xb78bb3f8 has devpath '/devices/platform/mmc-
 bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0'
 restoring old watch on '/dev/mmcblk0'
 adding watch on '/dev/mmcblk0'
 === trie on-disk ===
 tool version:  216
 file size: 

[systemd-devel] [systemd.link] How to use NamePolicy=mac?

2014-10-08 Thread Moviuro
Hi all!

In order to fix in an easily predictable manner the interfaces' names, I went 
and wrote the following .link file:

/etc/systemd/network/00-default.link
[Link]
NamePolicy=mac
MACAddressPolicy=persistent

I daemon-reload, reboot:

$ ip a
[...]
4: eth0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP 
group default qlen 1000
link/ether b8:27:eb:aa:aa:d2 brd ff:ff:ff:ff:ff:ff
[...]
[...]

However,
$ udevadm test-builtin net_setup_link /sys/class/net/eth0 
calling: test-builtin
load module index
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /etc/systemd/network/00-default.link
Created link configuration context.
ID_NET_DRIVER=smsc95xx
Config file /etc/systemd/network/00-default.link applies to device eth0
ID_NET_NAME=enxb827ebd2
unload module index
Unloaded link configuration context.

Also,
# /lib/systemd/systemd-udevd --debug
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram9'
restoring old watch on '/dev/ram9'
adding watch on '/dev/ram9'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram8'
restoring old watch on '/dev/ram8'
adding watch on '/dev/ram8'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram7'
restoring old watch on '/dev/ram7'
adding watch on '/dev/ram7'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram5'
restoring old watch on '/dev/ram5'
adding watch on '/dev/ram5'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram14'
restoring old watch on '/dev/ram14'
adding watch on '/dev/ram14'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram2'
restoring old watch on '/dev/ram2'
adding watch on '/dev/ram2'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram15'
restoring old watch on '/dev/ram15'
adding watch on '/dev/ram15'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram6'
restoring old watch on '/dev/ram6'
adding watch on '/dev/ram6'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram4'
restoring old watch on '/dev/ram4'
adding watch on '/dev/ram4'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram3'
restoring old watch on '/dev/ram3'
adding watch on '/dev/ram3'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram13'
restoring old watch on '/dev/ram13'
adding watch on '/dev/ram13'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram11'
restoring old watch on '/dev/ram11'
adding watch on '/dev/ram11'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop6'
restoring old watch on '/dev/loop6'
adding watch on '/dev/loop6'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram12'
restoring old watch on '/dev/ram12'
adding watch on '/dev/ram12'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop3'
restoring old watch on '/dev/loop3'
adding watch on '/dev/loop3'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop5'
restoring old watch on '/dev/loop5'
adding watch on '/dev/loop5'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram1'
restoring old watch on '/dev/ram1'
adding watch on '/dev/ram1'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram0'
restoring old watch on '/dev/ram0'
adding watch on '/dev/ram0'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop7'
restoring old watch on '/dev/loop7'
adding watch on '/dev/loop7'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram10'
restoring old watch on '/dev/ram10'
adding watch on '/dev/ram10'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop1'
restoring old watch on '/dev/loop1'
adding watch on '/dev/loop1'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop2'
restoring old watch on '/dev/loop2'
adding watch on '/dev/loop2'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop4'
restoring old watch on '/dev/loop4'
adding watch on '/dev/loop4'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop0'
restoring old watch on '/dev/loop0'
adding watch on '/dev/loop0'
device 0xb78bb3f8 has devpath '/devices/platform/mmc-
bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0/mmcblk0p2'
restoring old watch on '/dev/mmcblk0p2'
adding watch on '/dev/mmcblk0p2'
device 0xb78bb3f8 has devpath '/devices/platform/mmc-
bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0/mmcblk0p1'
restoring old watch on '/dev/mmcblk0p1'
adding watch on '/dev/mmcblk0p1'
device 0xb78bb3f8 has devpath '/devices/platform/mmc-
bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0'
restoring old watch on '/dev/mmcblk0'
adding watch on '/dev/mmcblk0'
=== trie on-disk ===
tool version:  216
file size: 6486785 bytes
header size 80 bytes
strings1673705 bytes
nodes  4813000 bytes
load module index
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /etc/systemd/network/00-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
timestamp of '/usr/lib/udev/rules.d' changed