Skip to content

Commit 51f9bba

Browse files
adrianchirisaboch
authored andcommitted
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 <[email protected]>
1 parent 4287122 commit 51f9bba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nl/nl_linux.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ done:
565565
}
566566

567567
if m.Header.Type == unix.NLMSG_DONE || m.Header.Type == unix.NLMSG_ERROR {
568+
// NLMSG_DONE might have no payload, if so assume no error.
569+
if m.Header.Type == unix.NLMSG_DONE && len(m.Data) == 0 {
570+
break done
571+
}
572+
568573
native := NativeEndian()
569574
errno := int32(native.Uint32(m.Data[0:4]))
570575
if errno == 0 {

0 commit comments

Comments
 (0)