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

(RHEL-1317) udev: allow/denylist for reading sysfs attributes when composing a NIC name #218

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

lnykryn
Copy link
Member

@lnykryn lnykryn commented Dec 19, 2023

Users can currently pick specific versions of NIC naming, but that does not guarantee that NIC names won't change after the kernel adds a new sysfs attribute.

This patch allows for an allow/deny list of sysfs attributes that could be used when composing the name.

These lists can be supplied as an hwdb entry in the form of /etc/udev/hwdb.d/50-net-naming-allowlist.hwdb
net:naming:drvirtio_net
ID_NET_NAME_ALLOW=0
ID_NET_NAME_ALLOW_ACPI_INDEX=1
ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1
ID_NET_NAME_ALLOW_ADDRESS=1
ID_NET_NAME_ALLOW_ARI_ENABLED=1
ID_NET_NAME_ALLOW_DEV_PORT=1
ID_NET_NAME_ALLOW_FUNCTION_ID=1
ID_NET_NAME_ALLOW_IFLINK=1
ID_NET_NAME_ALLOW_INDEX=1
ID_NET_NAME_ALLOW_LABEL=1
ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1
ID_NET_NAME_ALLOW_TYPE=1

(cherry picked from commit 3b2e7dc)

Resolves: RHEL-1317

…C name

Users can currently pick specific versions of NIC naming, but that
does not guarantee that NIC names won't change after the kernel adds
a new sysfs attribute.

This patch allows for an allow/deny list of sysfs attributes
that could be used when composing the name.

These lists can be supplied as an hwdb entry in the form of
/etc/udev/hwdb.d/50-net-naming-allowlist.hwdb
net:naming:drvirtio_net
  ID_NET_NAME_ALLOW=0
  ID_NET_NAME_ALLOW_ACPI_INDEX=1
  ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1
  ID_NET_NAME_ALLOW_ADDRESS=1
  ID_NET_NAME_ALLOW_ARI_ENABLED=1
  ID_NET_NAME_ALLOW_DEV_PORT=1
  ID_NET_NAME_ALLOW_FUNCTION_ID=1
  ID_NET_NAME_ALLOW_IFLINK=1
  ID_NET_NAME_ALLOW_INDEX=1
  ID_NET_NAME_ALLOW_LABEL=1
  ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1
  ID_NET_NAME_ALLOW_TYPE=1

(cherry picked from commit 3b2e7dc)

Resolves: RHEL-1317
Copy link

github-actions bot commented Dec 19, 2023

Tracker - RHEL-1317

The following commits meet all requirements

commit upstream
dc64d76 - udev: allow/denylist for reading sysfs attributes when composing a NIC… systemd/systemd@3b2e7dc
31ddc8f - man: environment value -> udev property systemd/systemd@044149e

@github-actions github-actions bot added pr/needs-ci Formerly needs-ci pr/needs-review Formerly needs-review labels Dec 19, 2023
@github-actions github-actions bot changed the title udev: allow/denylist for reading sysfs attributes when composing a NIC name (RHEL-1317) udev: allow/denylist for reading sysfs attributes when composing a NIC name Dec 19, 2023
@jamacku jamacku added this to the RHEL-9.4.0 milestone Dec 19, 2023
@github-actions github-actions bot removed the pr/needs-ci Formerly needs-ci label Dec 19, 2023
These are not environment variables, but udev properties.

Follow-up for 3b2e7dc.

(cherry picked from commit 044149e)

Resolves: RHEL-1317
@github-actions github-actions bot added pr/needs-ci Formerly needs-ci and removed pr/needs-ci Formerly needs-ci labels Jan 2, 2024
Copy link
Member

@msekletar msekletar left a comment

Choose a reason for hiding this comment

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

LGTM

Btw, while reviewing this I realized it would be kind of nice to enforce use of *_filtered() function variants in src/udev/udev-builtin-net_id.c.

@mrc0mmand do you think it would be possible to write CodeQL query that would enforce this policy?

@github-actions github-actions bot removed the pr/needs-review Formerly needs-review label Jan 5, 2024
@github-actions github-actions bot merged commit c5e8c81 into redhat-plumbers:main Jan 5, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants