Add support for IFLA_XDP_PROG_ID

Allow to get IFLA_XDP_PROG_ID which will be part of Linux kernel 4.13+.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
Tobias Klauser 2017-07-07 10:19:10 +02:00 committed by Vish (Ishaya) Abrams
parent b1eba2e916
commit 8c5a115d79
3 changed files with 5 additions and 1 deletions

View File

@ -171,6 +171,7 @@ type LinkXdp struct {
Fd int
Attached bool
Flags uint32
ProgId uint32
}
// Device links cannot be created via netlink. These links

View File

@ -1668,6 +1668,8 @@ func parseLinkXdp(data []byte) (*LinkXdp, error) {
xdp.Attached = attr.Value[0] != 0
case nl.IFLA_XDP_FLAGS:
xdp.Flags = native.Uint32(attr.Value[0:4])
case nl.IFLA_XDP_PROG_ID:
xdp.ProgId = native.Uint32(attr.Value[0:4])
}
}
return xdp, nil

View File

@ -424,7 +424,8 @@ const (
IFLA_XDP_FD /* fd of xdp program to attach, or -1 to remove */
IFLA_XDP_ATTACHED /* read-only bool indicating if prog is attached */
IFLA_XDP_FLAGS /* xdp prog related flags */
IFLA_XDP_MAX = IFLA_XDP_FLAGS
IFLA_XDP_PROG_ID /* xdp prog id */
IFLA_XDP_MAX = IFLA_XDP_PROG_ID
)
const (