Hm, the logs you shared don't seem to show udev changing the MAC
address. In fact, it shows that udev sees the policy is "persistent",
and the addr_assign_type=0 (NET_ADDR_PERM), so it does not do anything:

nr@six:/t/tmp.xaCDBoIYgA$ grep -rn ens192 udev.log
udev.log:8817:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[632]: 
ens192: Device is queued (SEQNUM=4672, ACTION=add)
udev.log:8822:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[632]: 
ens192: SEQNUM=4672 blocked by SEQNUM=4668
udev.log:8859:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[632]: 
ens192: SEQNUM=4672 blocked by SEQNUM=4671
udev.log:8920:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[632]: 
ens192: Device ready for processing (SEQNUM=4672, ACTION=add)
udev.log:8921:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: Processing device (SEQNUM=4672, ACTION=add)
udev.log:8928:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[632]: 
ens192: sd-device-monitor: Passed 207 byte to netlink monitor
udev.log:8941:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: /usr/lib/udev/rules.d/75-net-description.rules:6 Importing properties 
from results of builtin command 'net_id'
udev.log:11204:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: /usr/lib/udev/rules.d/75-net-description.rules:12 Importing properties 
from results of builtin command 'hwdb --subsystem=pci'
udev.log:11208:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: hwdb modalias key: 
"pci:v000015ADd000007B0sv000015ADsd000007B0bc02sc00i00"
udev.log:11211:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: /usr/lib/udev/rules.d/80-ifupdown.rules:5 RUN 'ifupdown-hotplug'
udev.log:11215:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: /usr/lib/udev/rules.d/80-net-setup-link.rules:5 Importing properties 
from results of builtin command 'path_id'
udev.log:11220:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: /usr/lib/udev/rules.d/80-net-setup-link.rules:9 Importing properties 
from results of builtin command 'net_setup_link'
udev.log:11226:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: Device has name_assign_type=4
udev.log:11235:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: Config file /usr/lib/systemd/network/99-default.link is applied
udev.log:11236:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: Device has addr_assign_type=0
udev.log:11239:Apr 04 12:15:04 maglev-master-169-254-6-66 systemd-udevd[671]: 
ens192: MAC on the device already matches policy *persistent*

Are you sure these logs are taken from a time where the MAC address was
changed?

...

Where is this output from exactly?

> PID: 1760 (snmpd) changed MAC to 00:00:00:00:00:00
> PID: 1760 (snmpd) changed MAC to 00:00:00:00:00:00
> PID: 15073 (systemd-udevd) changed MAC to d2:29:6b:94:be:bd
> PID: 15073 (systemd-udevd) changed MAC to d2:29:6b:94:be:bd
> PID: 15073 (systemd-udevd) changed MAC to d2:29:6b:94:be:bd
> PID: 15084 (ip) changed MAC to d2:29:6b:94:be:bd
> PID: 15084 (ip) changed MAC to d2:29:6b:94:be:bd

I have no idea what snmpd is, but if it's clearing the MAC, and then
udev is triggered, in that case I would expect udev to generate a new
MAC. I'm not sure if that's what the output is suggesting, but that is a
very high PID for systemd-udevd, so it suggests that ran well after
boot. That could explain why the logs you shared don't indicate udev
generating a MAC.

** Changed in: systemd (Ubuntu Jammy)
       Status: New => Incomplete

** Changed in: systemd (Ubuntu)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2104155

Title:
  systemd-udev interferes with MAC addresses of interfaces

Status in systemd package in Ubuntu:
  Incomplete
Status in systemd source package in Jammy:
  Incomplete

Bug description:
  While configuring a system based on ubuntu 22.04 version , we found
  that a system-d udev rules assign a random mac address to one of the
  network interfaces .

  Kernel version

  uname -a

  5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
  x86_64 x86_64 GNU/Linux

  Ubunutu version

  root@maglev-master-10-106-0-137:~# lsb_release -a
  No LSB modules are available.
  Distributor ID: Ubuntu
  Description:    Ubuntu 22.04.5 LTS
  Release:        22.04
  Codename:       jammy

  ip addr show output which shows the mac address has been changed

   ens192: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master 
management state UP group default qlen 1000
      link/ether d2:29:6b:94:be:bd brd ff:ff:ff:ff:ff:ff permaddr 
00:50:56:b8:ed:a0
      altname enp11s0

  d2:29:6b:94:be:bd is being randomly assigned while permanent address
  is 00:50:56:b8:ed:a0

  root@maglev-master-10-106-0-137:~# ethtool -P ens192
  Permanent address: 00:50:56:b8:ed:a0

  PID: 1760 (snmpd) changed MAC to 00:00:00:00:00:00
  PID: 1760 (snmpd) changed MAC to 00:00:00:00:00:00
  PID: 15073 (systemd-udevd) changed MAC to d2:29:6b:94:be:bd
  PID: 15073 (systemd-udevd) changed MAC to d2:29:6b:94:be:bd
  PID: 15073 (systemd-udevd) changed MAC to d2:29:6b:94:be:bd
  PID: 15084 (ip) changed MAC to d2:29:6b:94:be:bd
  PID: 15084 (ip) changed MAC to d2:29:6b:94:be:bd

  bpftrace output

  Invoked kprobe:dev_set_mac_address_user with MAC d2:29:6b:94:be:bd
  Stack trace:

          dev_set_mac_address_user+1
          rtnl_setlink+246
          rtnetlink_rcv_msg+349
          netlink_rcv_skb+83
          rtnetlink_rcv+21
          netlink_unicast+538
          netlink_sendmsg+588
          sock_sendmsg+98
          __sys_sendto+275
          __x64_sys_sendto+36
          do_syscall_64+89
          entry_SYSCALL_64_after_hwframe+68

   systemd-udevd(7123)  systemd-udevd(6656)
  Invoked kprobe:dev_set_mac_address with MAC d2:29:6b:94:be:bd
  Stack trace:

          dev_set_mac_address+1
          do_setlink+2217
          rtnl_setlink+246
          rtnetlink_rcv_msg+349
          netlink_rcv_skb+83
          rtnetlink_rcv+21
          netlink_unicast+538
          netlink_sendmsg+588
          sock_sendmsg+98
          __sys_sendto+275
          __x64_sys_sendto+36
          do_syscall_64+89
          entry_SYSCALL_64_after_hwframe+68

   systemd-udevd(7123)  systemd-udevd(6656)
  Invoked kprobe:bond_set_mac_address with MAC d2:29:6b:94:be:bd
  Stack trace:

          bond_set_mac_address+1
          dev_set_mac_address_user+50
          do_setlink+2217
          rtnl_setlink+246
          rtnetlink_rcv_msg+349
          netlink_rcv_skb+83
          rtnetlink_rcv+21
          netlink_unicast+538
          netlink_sendmsg+588
          sock_sendmsg+98
          __sys_sendto+275
          __x64_sys_sendto+36
          do_syscall_64+89
          entry_SYSCALL_64_after_hwframe+68

   ip(7137)     sh(7135)        python3(7013)   twistd3(2045)   
web_install_ser(1959)
  Invoked kprobe:dev_set_mac_address with MAC d2:29:6b:94:be:bd
  Stack trace:

          dev_set_mac_address+1
          do_set_master+146
          do_setlink+684
          __rtnl_newlink+1560
          rtnl_newlink+73
          rtnetlink_rcv_msg+349
          netlink_rcv_skb+83
          rtnetlink_rcv+21
          netlink_unicast+538
          netlink_sendmsg+588
          sock_sendmsg+98
          ____sys_sendmsg+590
          ___sys_sendmsg+129
          __sys_sendmsg+98
          __x64_sys_sendmsg+29
          do_syscall_64+89
          entry_SYSCALL_64_after_hwframe+68

   ip(7137)     sh(7135)        python3(7013)   twistd3(2045)   
web_install_ser(1959)
  Invoked kprobe:vmxnet3_set_mac_addr with MAC d2:29:6b:94:be:bd
  Stack trace:

          vmxnet3_set_mac_addr+1
          bond_enslave+1521
          do_set_master+146
          do_setlink+684
          __rtnl_newlink+1560
          rtnl_newlink+73
          rtnetlink_rcv_msg+349
          netlink_rcv_skb+83
          rtnetlink_rcv+21
          netlink_unicast+538
          netlink_sendmsg+588
          sock_sendmsg+98
          ____sys_sendmsg+590
          ___sys_sendmsg+129
          __sys_sendmsg+98
          __x64_sys_sendmsg+29
          do_syscall_64+89
          entry_SYSCALL_64_after_hwframe+68

  Not able to understand  why this systemd rule is triggering and
  assigning MAC address randomly while we have a permanent Mac
  configured for that network interface .

  We found this reported issue in systemd .

  https://github.com/systemd/systemd/issues/21185 
  
https://github.com/systemd/systemd/commit/6d36464065601f79a352367cf099be8907d8f9aa

   are they reason we are also running into the issue and if so, how do
  we get away from this Other than setting MACAddressPolicy=none ?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2104155/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to