Skip to content

Commit

Permalink
Add IFLA_PARENT_DEV_NAME / IFLA_PARENT_DEV_BUS_NAME to links
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
akerouanton committed Jan 20, 2025
1 parent 68cf136 commit bc9fc1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 4 additions & 0 deletions link_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}

Expand Down

0 comments on commit bc9fc1d

Please sign in to comment.