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]: 00e77ed8e6

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton
2025-01-19 12:52:48 +01:00
committed by Alessandro Boch
parent 3642538757
commit 7c2350bd14
2 changed files with 6 additions and 0 deletions

View File

@@ -56,6 +56,8 @@ type LinkAttrs struct {
Vfs []VfInfo // virtual functions available on link
Group uint32
PermHWAddr net.HardwareAddr
ParentDev string
ParentDevBus string
Slave LinkSlave
}

View File

@@ -2263,6 +2263,10 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) {
break
}
}
case unix.IFLA_PARENT_DEV_NAME:
base.ParentDev = string(attr.Value[:len(attr.Value)-1])
case unix.IFLA_PARENT_DEV_BUS_NAME:
base.ParentDevBus = string(attr.Value[:len(attr.Value)-1])
}
}