Skip to content

Commit bc9fc1d

Browse files
committed
Add IFLA_PARENT_DEV_NAME / IFLA_PARENT_DEV_BUS_NAME to links
These attributes are supported since kernel v5.14 (see [1]). Here's what iproute2 shows: ``` $ ip -d link show eth0 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65535 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 ... parentbus virtio parentdev virtio0 ``` [1]: torvalds/linux@00e77ed Signed-off-by: Albin Kerouanton <[email protected]>
1 parent 68cf136 commit bc9fc1d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: link.go

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ type LinkAttrs struct {
5656
Vfs []VfInfo // virtual functions available on link
5757
Group uint32
5858
PermHWAddr net.HardwareAddr
59+
ParentDev string
60+
ParentDevBus string
5961
Slave LinkSlave
6062
}
6163

Diff for: link_linux.go

+4
Original file line numberDiff line numberDiff line change
@@ -2263,6 +2263,10 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) {
22632263
break
22642264
}
22652265
}
2266+
case unix.IFLA_PARENT_DEV_NAME:
2267+
base.ParentDev = string(attr.Value[:len(attr.Value)-1])
2268+
case unix.IFLA_PARENT_DEV_BUS_NAME:
2269+
base.ParentDevBus = string(attr.Value[:len(attr.Value)-1])
22662270
}
22672271
}
22682272

0 commit comments

Comments
 (0)