Skip to content

Commit aa4f20d

Browse files
adrianchirisaboch
authored andcommitted
fix: check nlmsghdr flags for interrupt
fail if NLM_F_DUMP_INTR flag is set Signed-off-by: adrianc <[email protected]>
1 parent 77df5d3 commit aa4f20d

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

nl/nl_linux.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,11 @@ done:
559559
if m.Header.Pid != pid {
560560
continue
561561
}
562+
563+
if m.Header.Flags&unix.NLM_F_DUMP_INTR != 0 {
564+
return nil, syscall.Errno(unix.EINTR)
565+
}
566+
562567
if m.Header.Type == unix.NLMSG_DONE || m.Header.Type == unix.NLMSG_ERROR {
563568
native := NativeEndian()
564569
errno := int32(native.Uint32(m.Data[0:4]))
@@ -661,12 +666,14 @@ func GetNetlinkSocketAt(newNs, curNs netns.NsHandle, protocol int) (*NetlinkSock
661666
// In case of success, the caller is expected to execute the returned function
662667
// at the end of the code that needs to be executed in the network namespace.
663668
// Example:
664-
// func jobAt(...) error {
665-
// d, err := executeInNetns(...)
666-
// if err != nil { return err}
667-
// defer d()
668-
// < code which needs to be executed in specific netns>
669-
// }
669+
//
670+
// func jobAt(...) error {
671+
// d, err := executeInNetns(...)
672+
// if err != nil { return err}
673+
// defer d()
674+
// < code which needs to be executed in specific netns>
675+
// }
676+
//
670677
// TODO: his function probably belongs to netns pkg.
671678
func executeInNetns(newNs, curNs netns.NsHandle) (func(), error) {
672679
var (

0 commit comments

Comments
 (0)