From 51f9bba1cda63133e7405fa9e7a1956fead0bc1f Mon Sep 17 00:00:00 2001 From: adrianc Date: Wed, 6 Dec 2023 16:52:14 +0200 Subject: [PATCH] Allow NLMSG_DONE with no data certain implementations in kernel return NLMSG_DONE with no data. If that is the case, assume no error occured. Signed-off-by: adrianc --- nl/nl_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nl/nl_linux.go b/nl/nl_linux.go index e318e099..c2ca015e 100644 --- a/nl/nl_linux.go +++ b/nl/nl_linux.go @@ -565,6 +565,11 @@ done: } if m.Header.Type == unix.NLMSG_DONE || m.Header.Type == unix.NLMSG_ERROR { + // NLMSG_DONE might have no payload, if so assume no error. + if m.Header.Type == unix.NLMSG_DONE && len(m.Data) == 0 { + break done + } + native := NativeEndian() errno := int32(native.Uint32(m.Data[0:4])) if errno == 0 {