Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd-udevd: DEVPATH and INTERFACE properties are not updated when network device name is changed more than one time #9426

Closed
keecin opened this issue Jun 26, 2018 · 4 comments
Labels

Comments

@keecin
Copy link

keecin commented Jun 26, 2018

systemd version the issue has been seen with

V238

Used distribution

Fedora 28

Expected behaviour you didn't see

DEVPATH and INTERFACE properties are not updated when network device name is changed more than one time

Unexpected behaviour you saw

DEVPATH and INTERFACE properties are not updated when network device name is changed more than one time

Steps to reproduce the problem

  1. create a virtual network device named veth0 and show properties of DEVPATH and INTERFACE
    ip link add name veth0 type veth peer name veth1
    udevadm info -p /sys/devices/virtual/net/veth0 | grep -e INTERFACE -e DEVPATH
    output is veht0 as what we expected

E: DEVPATH=/devices/virtual/net/veth0
E: INTERFACE=veth0

  1. rename veth0 to veth2
    ip link set dev veth0 name veth2
    udevadm info -p /sys/devices/virtual/net/veth2 | grep -e INTERFACE -e DEVPATH
    output is veht2 as what we expected

E: DEVPATH=/devices/virtual/net/veth2
E: INTERFACE=veth2

  1. rename veth2 to veth3
    ip link set dev veth2 name veth3
    udevadm info -p /sys/devices/virtual/net/veth3 | grep -e INTERFACE -e DEVPATH
    this time output is veth2, not veth3

E: DEVPATH=/devices/virtual/net/veth2
E: INTERFACE=veth2

  1. rename veth3 to veth4
    ip link set dev veth3 name veth4
    udevadm info -p /sys/devices/virtual/net/veth3 | grep -e INTERFACE -e DEVPATH
    output is still veth2, not veth4

E: DEVPATH=/devices/virtual/net/veth2
E: INTERFACE=veth2

The full script for the above steps.
`ip link add name veth0 type veth peer name veth1
udevadm info -p /sys/devices/virtual/net/veth0 | grep -e INTERFACE -e DEVPATH

sleep 1
ip link set dev veth0 name veth2
echo "after changing to veth2"
udevadm info -p /sys/devices/virtual/net/veth2 | grep -e INTERFACE -e DEVPATH

sleep 1
echo "after changing to veth3"
ip link set dev veth2 name veth3
udevadm info -p /sys/devices/virtual/net/veth3 | grep -e INTERFACE -e DEVPATH

sleep 1
echo "after changing to veth4"
ip link set dev veth3 name veth4
udevadm info -p /sys/devices/virtual/net/veth4 | grep -e INTERFACE -e DEVPATH`

This problem can also be reproduced on V219 and V239

@arvidjaar
Copy link
Contributor

arvidjaar commented Jun 30, 2018

Likely duplicate of issue #9006

@poettering
Copy link
Member

@keecin hmm, do you see udev events being generated for these events? does "udevadm monitor" show the renames properly?

@poettering poettering added the udev label Jul 4, 2018
@keecin
Copy link
Author

keecin commented Jul 10, 2018

@poettering

from the second rename, DEVPATH and INTERFACE always shown as "veth2" from "udevadm monitor -p"

The output from first rename(veth0->veth2) is below.

ACTION=move
DEVPATH=/devices/virtual/net/veth2
DEVPATH_OLD=/devices/virtual/net/veth0
IFINDEX=8
INTERFACE=veth2
SEQNUM=2437
SUBSYSTEM=net

UDEV  [7635.858142] move     /devices/virtual/net/veth2 (net)
ACTION=move
DEVPATH=/devices/virtual/net/veth2
DEVPATH_OLD=/devices/virtual/net/veth0
ID_NET_DRIVER=veth
IFINDEX=8
INTERFACE=veth2
SEQNUM=2437
SUBSYSTEM=net
SYSTEMD_ALIAS=/sys/subsystem/net/devices/veth0 /sys/subsystem/net/devices/veth2
TAGS=:systemd:
UDEV_BIOSDEVNAME=0
USEC_INITIALIZED=23027908
biosdevname=0
net.ifnames=0

The output from second rename(veth2->veth3) is below, this time it is still shown as eth2.

ACTION=move
DEVPATH=/devices/virtual/net/veth3
DEVPATH_OLD=/devices/virtual/net/veth2
IFINDEX=8
INTERFACE=veth3
SEQNUM=2438
SUBSYSTEM=net

UDEV  [7661.882324] move     /devices/virtual/net/veth2 (net)
ACTION=move
**DEVPATH=/devices/virtual/net/veth2**
DEVPATH_OLD=/devices/virtual/net/veth2
ID_NET_DRIVER=veth
IFINDEX=8
**INTERFACE=veth2**
SEQNUM=2438
SUBSYSTEM=net
SYSTEMD_ALIAS=/sys/subsystem/net/devices/veth0 /sys/subsystem/net/devices/veth2 /sys/subsystem/net/devices/veth3
TAGS=:systemd:
UDEV_BIOSDEVNAME=0
USEC_INITIALIZED=23027908
biosdevname=0
net.ifnames=0

yuwata added a commit to yuwata/systemd that referenced this issue Jan 19, 2019
yuwata added a commit to yuwata/systemd that referenced this issue Jan 19, 2019
On move uevent, DEVPATH and ITERFACE properties are overwritten
by the value stored in the db under /run/udev/data/.
So, let's recover these properties by correct values.

Fixes systemd#9426.
yuwata added a commit to yuwata/systemd that referenced this issue Jan 19, 2019
On move uevent, DEVPATH and INTERFACE properties are overwritten
by the value stored in the db under /run/udev/data/.
So, let's recover these properties by the correct values.

Fixes systemd#9426.
@yuwata
Copy link
Member

yuwata commented Jan 19, 2019

Fix is waiting in #11501. PTAL.

yuwata added a commit to yuwata/systemd that referenced this issue Jan 22, 2019
…database

Previously, device_copy_properties() copies all properties to both
sd_device::properties and ::properties_db. Thus, on move uevent,
also tentative properties, e.g. DEVPATH or INTERFACE, are stored to
::properties_db, and saved to udev database.

This makes such tentative properties be copied to only ::properties,
and thus not saved to udev database.

Fixes systemd#9426.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants