mirror of https://github.com/vishvananda/netlink
Add field for permanent hardware address
Linux 5.6 and higher support IFLA_PERM_ADDRESS, which contains the permanent hardware address of the interface if an interface has such an address. This can be used to identify interfaces even when the normal hardware address has been changed. Signed-off-by: Lorenz Brun <lorenz@monogon.tech>
This commit is contained in:
parent
d237ee16c3
commit
306ce7b5b2
1
link.go
1
link.go
|
@ -55,6 +55,7 @@ type LinkAttrs struct {
|
|||
GROIPv4MaxSize uint32
|
||||
Vfs []VfInfo // virtual functions available on link
|
||||
Group uint32
|
||||
PermHWAddr net.HardwareAddr
|
||||
Slave LinkSlave
|
||||
}
|
||||
|
||||
|
|
|
@ -2246,6 +2246,13 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) {
|
|||
base.NumRxQueues = int(native.Uint32(attr.Value[0:4]))
|
||||
case unix.IFLA_GROUP:
|
||||
base.Group = native.Uint32(attr.Value[0:4])
|
||||
case unix.IFLA_PERM_ADDRESS:
|
||||
for _, b := range attr.Value {
|
||||
if b != 0 {
|
||||
base.PermHWAddr = attr.Value[:]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue