summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/socketops.go
diff options
context:
space:
mode:
authorNayana Bidari <nybidari@google.com>2020-12-14 10:20:49 -0800
committergVisor bot <gvisor-bot@google.com>2020-12-14 10:22:32 -0800
commitab593661efe4924369265a6b9f0dc719dcb371ab (patch)
tree9f9af7fb35147df2a1515bc84e57fdfe6bf1880e /pkg/tcpip/socketops.go
parent08d36b6c630846c4d9d812c25966639513ecd211 (diff)
Move SO_ERROR and SO_OOBINLINE option to socketops.
SO_OOBINLINE option is set/get as boolean value, which is the same as linux. As we currently do not support disabling this option, we always return it as true. PiperOrigin-RevId: 347413905
Diffstat (limited to 'pkg/tcpip/socketops.go')
-rw-r--r--pkg/tcpip/socketops.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/tcpip/socketops.go b/pkg/tcpip/socketops.go
index b14df9e09..3d29b31ee 100644
--- a/pkg/tcpip/socketops.go
+++ b/pkg/tcpip/socketops.go
@@ -37,6 +37,9 @@ type SocketOptionsHandler interface {
// OnCorkOptionSet is invoked when TCP_CORK is set for an endpoint.
OnCorkOptionSet(v bool)
+
+ // LastError is invoked when SO_ERROR is read for an endpoint.
+ LastError() *Error
}
// DefaultSocketOptionsHandler is an embeddable type that implements no-op
@@ -60,6 +63,11 @@ func (*DefaultSocketOptionsHandler) OnDelayOptionSet(bool) {}
// OnCorkOptionSet implements SocketOptionsHandler.OnCorkOptionSet.
func (*DefaultSocketOptionsHandler) OnCorkOptionSet(bool) {}
+// LastError implements SocketOptionsHandler.LastError.
+func (*DefaultSocketOptionsHandler) LastError() *Error {
+ return nil
+}
+
// SocketOptions contains all the variables which store values for SOL_SOCKET,
// SOL_IP, SOL_IPV6 and SOL_TCP level options.
//
@@ -316,3 +324,17 @@ func (so *SocketOptions) GetReceiveOriginalDstAddress() bool {
func (so *SocketOptions) SetReceiveOriginalDstAddress(v bool) {
storeAtomicBool(&so.receiveOriginalDstAddress, v)
}
+
+// GetLastError gets value for SO_ERROR option.
+func (so *SocketOptions) GetLastError() *Error {
+ return so.handler.LastError()
+}
+
+// GetOutOfBandInline gets value for SO_OOBINLINE option.
+func (*SocketOptions) GetOutOfBandInline() bool {
+ return true
+}
+
+// SetOutOfBandInline sets value for SO_OOBINLINE option. We currently do not
+// support disabling this option.
+func (*SocketOptions) SetOutOfBandInline(bool) {}