Skip to content

Commit

Permalink
Allow NLMSG_DONE with no data
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
adrianchiris authored and aboch committed Jan 21, 2024
1 parent 4287122 commit 51f9bba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nl/nl_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 51f9bba

Please sign in to comment.