summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/packet
diff options
context:
space:
mode:
authorNayana Bidari <nybidari@google.com>2020-11-12 22:55:09 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-12 22:57:00 -0800
commit5bb64ce1b8c42fcd96e44a5be05e17f34a83f840 (patch)
tree6dbfa200de6de2d6d53ddd8f3e7d35518ef22203 /pkg/tcpip/transport/packet
parentbf392dcc7d7b1f256acfe8acd2758a77db3fc8a2 (diff)
Refactor SOL_SOCKET options
Store all the socket level options in a struct and call {Get/Set}SockOpt on this struct. This will avoid implementing socket level options on all endpoints. This CL contains implementing one socket level option for tcp and udp endpoints. PiperOrigin-RevId: 342203981
Diffstat (limited to 'pkg/tcpip/transport/packet')
-rw-r--r--pkg/tcpip/transport/packet/endpoint.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/packet/endpoint.go b/pkg/tcpip/transport/packet/endpoint.go
index 31831a6d8..3bff3755a 100644
--- a/pkg/tcpip/transport/packet/endpoint.go
+++ b/pkg/tcpip/transport/packet/endpoint.go
@@ -89,6 +89,9 @@ type endpoint struct {
// lastErrorMu protects lastError.
lastErrorMu sync.Mutex `state:"nosave"`
lastError *tcpip.Error `state:".(string)"`
+
+ // ops is used to get socket level options.
+ ops tcpip.SocketOptions
}
// NewEndpoint returns a new packet endpoint.
@@ -549,3 +552,7 @@ func (ep *endpoint) Stats() tcpip.EndpointStats {
}
func (ep *endpoint) SetOwner(owner tcpip.PacketOwner) {}
+
+func (ep *endpoint) SocketOptions() *tcpip.SocketOptions {
+ return &ep.ops
+}