From 241d179eba0fba0d180926123b9de15b48e46cbe Mon Sep 17 00:00:00 2001 From: "Zvi \"CtrlZvi\" Effron" Date: Sat, 2 Sep 2017 20:24:57 +0000 Subject: [PATCH] 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. --- link_linux.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/link_linux.go b/link_linux.go index 5bdff5f..ed35c0d 100644 --- a/link_linux.go +++ b/link_linux.go @@ -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) }