mirror of
https://github.com/vishvananda/netlink
synced 2025-03-25 04:26:51 +00:00
fix: check nlmsghdr flags for interrupt
fail if NLM_F_DUMP_INTR flag is set Signed-off-by: adrianc <adrianc@nvidia.com>
This commit is contained in:
parent
77df5d35f7
commit
aa4f20db57
@ -559,6 +559,11 @@ done:
|
||||
if m.Header.Pid != pid {
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Header.Flags&unix.NLM_F_DUMP_INTR != 0 {
|
||||
return nil, syscall.Errno(unix.EINTR)
|
||||
}
|
||||
|
||||
if m.Header.Type == unix.NLMSG_DONE || m.Header.Type == unix.NLMSG_ERROR {
|
||||
native := NativeEndian()
|
||||
errno := int32(native.Uint32(m.Data[0:4]))
|
||||
@ -661,12 +666,14 @@ func GetNetlinkSocketAt(newNs, curNs netns.NsHandle, protocol int) (*NetlinkSock
|
||||
// In case of success, the caller is expected to execute the returned function
|
||||
// at the end of the code that needs to be executed in the network namespace.
|
||||
// Example:
|
||||
// func jobAt(...) error {
|
||||
// d, err := executeInNetns(...)
|
||||
// if err != nil { return err}
|
||||
// defer d()
|
||||
// < code which needs to be executed in specific netns>
|
||||
// }
|
||||
//
|
||||
// func jobAt(...) error {
|
||||
// d, err := executeInNetns(...)
|
||||
// if err != nil { return err}
|
||||
// defer d()
|
||||
// < code which needs to be executed in specific netns>
|
||||
// }
|
||||
//
|
||||
// TODO: his function probably belongs to netns pkg.
|
||||
func executeInNetns(newNs, curNs netns.NsHandle) (func(), error) {
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user