Update github.com/vishvananda/netlink to v1.2.0-beta
Latest version fixes a segfault when used on some ppp setup Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
This commit is contained in:
29
vendor/github.com/vishvananda/netlink/handle_linux.go
generated
vendored
29
vendor/github.com/vishvananda/netlink/handle_linux.go
generated
vendored
@ -15,7 +15,7 @@ var pkgHandle = &Handle{}
|
||||
// Handle is an handle for the netlink requests on a
|
||||
// specific network namespace. All the requests on the
|
||||
// same netlink family share the same netlink socket,
|
||||
// which gets released when the handle is deleted.
|
||||
// which gets released when the handle is Close'd.
|
||||
type Handle struct {
|
||||
sockets map[int]*nl.SocketHandle
|
||||
lookupByDump bool
|
||||
@ -107,6 +107,21 @@ func (h *Handle) GetSocketReceiveBufferSize() ([]int, error) {
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// SetStrictCheck sets the strict check socket option for each socket in the netlink handle. Returns early if any set operation fails
|
||||
func (h *Handle) SetStrictCheck(state bool) error {
|
||||
for _, sh := range h.sockets {
|
||||
var stateInt int = 0
|
||||
if state {
|
||||
stateInt = 1
|
||||
}
|
||||
err := unix.SetsockoptInt(sh.Socket.GetFd(), unix.SOL_NETLINK, unix.NETLINK_GET_STRICT_CHK, stateInt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewHandleAt returns a netlink handle on the network namespace
|
||||
// specified by ns. If ns=netns.None(), current network namespace
|
||||
// will be assumed
|
||||
@ -136,14 +151,22 @@ func newHandle(newNs, curNs netns.NsHandle, nlFamilies ...int) (*Handle, error)
|
||||
return h, nil
|
||||
}
|
||||
|
||||
// Delete releases the resources allocated to this handle
|
||||
func (h *Handle) Delete() {
|
||||
// Close releases the resources allocated to this handle
|
||||
func (h *Handle) Close() {
|
||||
for _, sh := range h.sockets {
|
||||
sh.Close()
|
||||
}
|
||||
h.sockets = nil
|
||||
}
|
||||
|
||||
// Delete releases the resources allocated to this handle
|
||||
//
|
||||
// Deprecated: use Close instead which is in line with typical resource release
|
||||
// patterns for files and other resources.
|
||||
func (h *Handle) Delete() {
|
||||
h.Close()
|
||||
}
|
||||
|
||||
func (h *Handle) newNetlinkRequest(proto, flags int) *nl.NetlinkRequest {
|
||||
// Do this so that package API still use nl package variable nextSeqNr
|
||||
if h.sockets == nil {
|
||||
|
Reference in New Issue
Block a user