MCPcopy
hub / github.com/google/gvisor / SetBindToDevice

Method SetBindToDevice

pkg/tcpip/socketops.go:697–704  ·  view source on GitHub ↗

SetBindToDevice sets value for SO_BINDTODEVICE option. If bindToDevice is zero, the socket device binding is removed.

(bindToDevice int32)

Source from the content-addressed store, hash-verified

695// SetBindToDevice sets value for SO_BINDTODEVICE option. If bindToDevice is
696// zero, the socket device binding is removed.
697func (so *SocketOptions) SetBindToDevice(bindToDevice int32) Error {
698 if bindToDevice != 0 && !so.handler.HasNIC(bindToDevice) {
699 return &ErrUnknownDevice{}
700 }
701
702 so.bindToDevice.Store(bindToDevice)
703 return nil
704}
705
706// GetSendBufferSize gets value for SO_SNDBUF option.
707func (so *SocketOptions) GetSendBufferSize() int64 {

Callers 7

SetSockOptSocketFunction · 0.80
TestIPv6PacketInfoFunction · 0.80
TestBindToDeviceOptionFunction · 0.80
TestConnectBindToDeviceFunction · 0.80
TestBindToDeviceOptionFunction · 0.80

Calls 2

HasNICMethod · 0.65
StoreMethod · 0.65

Tested by 6

TestIPv6PacketInfoFunction · 0.64
TestBindToDeviceOptionFunction · 0.64
TestConnectBindToDeviceFunction · 0.64
TestBindToDeviceOptionFunction · 0.64