Skip to content

sysfs: add the master device to NetClassIface - #891

Open
cvas22 wants to merge 1 commit into
prometheus:masterfrom
cvas22:feat/405-net-class-master
Open

cvas22 wants to merge 1 commit into
prometheus:masterfrom
cvas22:feat/405-net-class-master

Conversation

@cvas22

@cvas22 cvas22 commented Oct 23, 2026

Copy link
Copy Markdown

Closes #405

The issue asks for the VRF association of an interface to be available from NetClassIface. sysfs exposes the master device of an interface (a VRF, but also a bridge or bond) as the /sys/class/net/<iface>/master symlink, e.g. master -> ../VrfKamel. That avoids needing netlink, which was the alternative mentioned on the issue.

This adds a Master field holding the name of the master device (the last element of the symlink target). It stays empty if the interface has no master or the link cannot be read for an ignorable reason (missing, permission, not a symlink), the same way other attributes are handled.

Tests: added a master -> ../vrf0 symlink to the eth0 fixture in testdata/fixtures.ttar and the expectation in TestNetClass. I am on Windows, so I could not unpack the fixtures or run the sysfs tests locally (the package is Linux only and the fixtures need symlinks); I checked it with GOOS=linux go vet ./sysfs/ and the fixture entry follows the existing SymlinkTo format. CI should run the real test.

Expose the master device of a network interface (a VRF, bridge or bond),
which sysfs provides as the /sys/class/net/<iface>/master symlink.

Closes prometheus#405

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@cvas22

cvas22 commented Nov 11, 2026

Copy link
Copy Markdown
Author

@SuperQ @discordianfish could one of you take a look when you have a minute? thx

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.

VRF association in NetClassIface

1 participant