Save XDP attach mode into LinkXdp.

This commit is contained in:
Konstantin Belyalov 2020-01-23 12:15:42 -08:00 committed by Flavio Crisciani
parent 0f858a2aeb
commit b2372689b9
3 changed files with 15 additions and 5 deletions

View File

@ -196,10 +196,11 @@ type LinkStatistics64 struct {
}
type LinkXdp struct {
Fd int
Attached bool
Flags uint32
ProgId uint32
Fd int
Attached bool
AttachMode uint32
Flags uint32
ProgId uint32
}
// Device links cannot be created via netlink. These links

View File

@ -2513,7 +2513,8 @@ func parseLinkXdp(data []byte) (*LinkXdp, error) {
case nl.IFLA_XDP_FD:
xdp.Fd = int(native.Uint32(attr.Value[0:4]))
case nl.IFLA_XDP_ATTACHED:
xdp.Attached = attr.Value[0] != 0
xdp.AttachMode = uint32(attr.Value[0])
xdp.Attached = xdp.AttachMode != 0
case nl.IFLA_XDP_FLAGS:
xdp.Flags = native.Uint32(attr.Value[0:4])
case nl.IFLA_XDP_PROG_ID:

View File

@ -478,6 +478,14 @@ const (
IFLA_XDP_MAX = IFLA_XDP_PROG_ID
)
// XDP program attach mode (used as dump value for IFLA_XDP_ATTACHED)
const (
XDP_ATTACHED_NONE = iota
XDP_ATTACHED_DRV
XDP_ATTACHED_SKB
XDP_ATTACHED_HW
)
const (
IFLA_IPTUN_UNSPEC = iota
IFLA_IPTUN_LINK