summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/udp
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-09-18 03:03:37 +0000
committergVisor bot <gvisor-bot@google.com>2020-09-18 03:03:37 +0000
commite6486141a9b379f06e841b86d867ef4f09421d3a (patch)
tree5be402dc35fdf8360f474172afa6f4cbd4fa0106 /pkg/tcpip/transport/udp
parente6af9699c8065e6f9f578bdf0213853dcbe07bbd (diff)
parentd34bda027309695e3e6fb6f92a5839cd1f21173e (diff)
Merge release-20200907.0-134-gd34bda027 (automated)
Diffstat (limited to 'pkg/tcpip/transport/udp')
-rw-r--r--pkg/tcpip/transport/udp/endpoint.go13
-rw-r--r--pkg/tcpip/transport/udp/udp_state_autogen.go3
2 files changed, 16 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/udp/endpoint.go b/pkg/tcpip/transport/udp/endpoint.go
index b572c39db..518f636f0 100644
--- a/pkg/tcpip/transport/udp/endpoint.go
+++ b/pkg/tcpip/transport/udp/endpoint.go
@@ -154,6 +154,9 @@ type endpoint struct {
// owner is used to get uid and gid of the packet.
owner tcpip.PacketOwner
+
+ // linger is used for SO_LINGER socket option.
+ linger tcpip.LingerOption
}
// +stateify savable
@@ -810,6 +813,11 @@ func (e *endpoint) SetSockOpt(opt tcpip.SettableSocketOption) *tcpip.Error {
case *tcpip.SocketDetachFilterOption:
return nil
+
+ case *tcpip.LingerOption:
+ e.mu.Lock()
+ e.linger = *v
+ e.mu.Unlock()
}
return nil
}
@@ -966,6 +974,11 @@ func (e *endpoint) GetSockOpt(opt tcpip.GettableSocketOption) *tcpip.Error {
*o = tcpip.BindToDeviceOption(e.bindToDevice)
e.mu.RUnlock()
+ case *tcpip.LingerOption:
+ e.mu.RLock()
+ *o = e.linger
+ e.mu.RUnlock()
+
default:
return tcpip.ErrUnknownProtocolOption
}
diff --git a/pkg/tcpip/transport/udp/udp_state_autogen.go b/pkg/tcpip/transport/udp/udp_state_autogen.go
index 50fd0f186..ce3b1df48 100644
--- a/pkg/tcpip/transport/udp/udp_state_autogen.go
+++ b/pkg/tcpip/transport/udp/udp_state_autogen.go
@@ -85,6 +85,7 @@ func (x *endpoint) StateFields() []string {
"multicastMemberships",
"effectiveNetProtos",
"owner",
+ "linger",
}
}
@@ -125,6 +126,7 @@ func (x *endpoint) StateSave(m state.Sink) {
m.Save(30, &x.multicastMemberships)
m.Save(31, &x.effectiveNetProtos)
m.Save(32, &x.owner)
+ m.Save(33, &x.linger)
}
func (x *endpoint) StateLoad(m state.Source) {
@@ -159,6 +161,7 @@ func (x *endpoint) StateLoad(m state.Source) {
m.Load(30, &x.multicastMemberships)
m.Load(31, &x.effectiveNetProtos)
m.Load(32, &x.owner)
+ m.Load(33, &x.linger)
m.LoadValue(5, new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
m.LoadValue(22, new(string), func(y interface{}) { x.loadLastError(y.(string)) })
m.AfterLoad(x.afterLoad)