Fix failing XDP test

On newer linux kernels (4.12), netlink rejects a request to set an XDP
program with flags set to 0. Instead, flags need to not be specified if they
are 0.
This commit is contained in:
Zvi "CtrlZvi" Effron 2017-09-02 20:24:57 +00:00 committed by Vish (Ishaya) Abrams
parent 7d0c00f02e
commit 241d179eba
1 changed files with 4 additions and 2 deletions

View File

@ -1811,8 +1811,10 @@ func addXdpAttrs(xdp *LinkXdp, req *nl.NetlinkRequest) {
b := make([]byte, 4)
native.PutUint32(b, uint32(xdp.Fd))
nl.NewRtAttrChild(attrs, nl.IFLA_XDP_FD, b)
native.PutUint32(b, xdp.Flags)
nl.NewRtAttrChild(attrs, nl.IFLA_XDP_FLAGS, b)
if xdp.Flags != 0 {
native.PutUint32(b, xdp.Flags)
nl.NewRtAttrChild(attrs, nl.IFLA_XDP_FLAGS, b)
}
req.AddData(attrs)
}