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

udev: Use $name in issuegen rule #102

Merged
merged 1 commit into from
Sep 4, 2023
Merged

Conversation

jepio
Copy link
Member

@jepio jepio commented Sep 4, 2023

udev: Use $name in issuegen rule

A user is trying to rename network interfaces. This is working but the login issue file still has the initial network interface names. This appears to be similar to thkukuk/issue-generator#6, fix it by using $name instead of $ENV{INTERACE}, so that the rule runs with a changed name.

How to use

Testing done

Ran a qemu vm with the following udev rules:

# cd /etc/udev/rules.d
# cat 60-net.rules
SUBSYSTEMS=="pci", ACTION=="add", DRIVERS=="?*", KERNELS=="0000:00:03.0", NAME="ge0"
# cat 90-issuegen.rules
ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="e*", RUN+="/usr/lib/flatcar/issuegen add $name"
ACTION=="remove", SUBSYSTEM=="net", ENV{INTERFACE}=="e*", RUN+="/usr/lib/flatcar/issuegen remove $name"

issue is correct:

This is localhost (Linux x86_64 6.1.37-flatcar) 12:40:59
SSH host key: SHA256:BLiSc209qqCjiSEAZ0HR3jskm9iluPTkHEFtcfL5qvE (ECDSA)
SSH host key: SHA256:P2B0BvpZjOdylo5auGGLOLqdpH51TpzKoB6hcgUc6v0 (RSA)
SSH host key: SHA256:6op7WJi6lY61NwhRkNoxWzNO+9bOHXiZ+PG3w+Gfpdc (ED25519)
ge0: 10.0.2.15 fec0::5054:ff:fe12:3456
  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

A user is trying to rename network interfaces. This is working but the login
issue file still has the initial network interface names. This appears to be
similar to thkukuk/issue-generator#6, fix it by using
$name instead of $ENV{INTERACE}, so that the rule runs with a changed name.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@jepio jepio requested a review from a team September 4, 2023 12:42
Copy link
Member

@pothos pothos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that also work when the interface name is set from a networkd unit?

@jepio
Copy link
Member Author

jepio commented Sep 4, 2023

Does that also work when the interface name is set from a networkd unit?

Yes, i just tested this now. Without this branch renaming from a networkd unit has the same bug. Fixed with this change.

jepio added a commit to flatcar/scripts that referenced this pull request Sep 4, 2023
This pulls in flatcar/init#102 which moves the issuegen
udev rule to using $name. This lets the rule correctly handle renamed
interfaces.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@jepio jepio merged commit 235b614 into flatcar-master Sep 4, 2023
@jepio jepio deleted the issuegen-if-rename-fix branch September 4, 2023 15:18
jepio added a commit to flatcar/scripts that referenced this pull request Sep 5, 2023
This pulls in flatcar/init#102 which moves the issuegen
udev rule to using $name. This lets the rule correctly handle renamed
interfaces.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants