diff options
Diffstat (limited to 'pkg/tcpip/transport/udp')
-rw-r--r-- | pkg/tcpip/transport/udp/endpoint.go | 13 | ||||
-rw-r--r-- | pkg/tcpip/transport/udp/udp_state_autogen.go | 3 |
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) |