diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-12-10 00:26:19 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-12-10 00:26:19 +0000 |
commit | 23f464469bb7ccd79928a7a749219336b7bcb2c0 (patch) | |
tree | e2e9e61f29e18cadb71aa78302865d807733f95a /pkg/tcpip/transport | |
parent | 1faf5799ed1fb83a36c6433b22a7c8f495395943 (diff) | |
parent | 92ca72ecb73d91e9def31e7f9835adf7a50b3d65 (diff) |
Merge release-20201130.0-74-g92ca72ecb (automated)
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/udp/endpoint.go | 18 | ||||
-rw-r--r-- | pkg/tcpip/transport/udp/udp_state_autogen.go | 19 |
2 files changed, 25 insertions, 12 deletions
diff --git a/pkg/tcpip/transport/udp/endpoint.go b/pkg/tcpip/transport/udp/endpoint.go index ee1bb29f8..04596183e 100644 --- a/pkg/tcpip/transport/udp/endpoint.go +++ b/pkg/tcpip/transport/udp/endpoint.go @@ -30,10 +30,11 @@ import ( // +stateify savable type udpPacket struct { udpPacketEntry - senderAddress tcpip.FullAddress - packetInfo tcpip.IPPacketInfo - data buffer.VectorisedView `state:".(buffer.VectorisedView)"` - timestamp int64 + senderAddress tcpip.FullAddress + destinationAddress tcpip.FullAddress + packetInfo tcpip.IPPacketInfo + data buffer.VectorisedView `state:".(buffer.VectorisedView)"` + timestamp int64 // tos stores either the receiveTOS or receiveTClass value. tos uint8 } @@ -323,6 +324,10 @@ func (e *endpoint) Read(addr *tcpip.FullAddress) (buffer.View, tcpip.ControlMess cm.HasIPPacketInfo = true cm.PacketInfo = p.packetInfo } + if e.ops.GetReceiveOriginalDstAddress() { + cm.HasOriginalDstAddress = true + cm.OriginalDstAddress = p.destinationAddress + } return p.data.ToView(), cm, nil } @@ -1314,6 +1319,11 @@ func (e *endpoint) HandlePacket(id stack.TransportEndpointID, pkt *stack.PacketB Addr: id.RemoteAddress, Port: hdr.SourcePort(), }, + destinationAddress: tcpip.FullAddress{ + NIC: pkt.NICID, + Addr: id.LocalAddress, + Port: header.UDP(hdr).DestinationPort(), + }, } packet.data = pkt.Data e.rcvList.PushBack(packet) diff --git a/pkg/tcpip/transport/udp/udp_state_autogen.go b/pkg/tcpip/transport/udp/udp_state_autogen.go index dc6afdff9..451d8eff0 100644 --- a/pkg/tcpip/transport/udp/udp_state_autogen.go +++ b/pkg/tcpip/transport/udp/udp_state_autogen.go @@ -15,6 +15,7 @@ func (u *udpPacket) StateFields() []string { return []string{ "udpPacketEntry", "senderAddress", + "destinationAddress", "packetInfo", "data", "timestamp", @@ -27,12 +28,13 @@ func (u *udpPacket) beforeSave() {} func (u *udpPacket) StateSave(stateSinkObject state.Sink) { u.beforeSave() var dataValue buffer.VectorisedView = u.saveData() - stateSinkObject.SaveValue(3, dataValue) + stateSinkObject.SaveValue(4, dataValue) stateSinkObject.Save(0, &u.udpPacketEntry) stateSinkObject.Save(1, &u.senderAddress) - stateSinkObject.Save(2, &u.packetInfo) - stateSinkObject.Save(4, &u.timestamp) - stateSinkObject.Save(5, &u.tos) + stateSinkObject.Save(2, &u.destinationAddress) + stateSinkObject.Save(3, &u.packetInfo) + stateSinkObject.Save(5, &u.timestamp) + stateSinkObject.Save(6, &u.tos) } func (u *udpPacket) afterLoad() {} @@ -40,10 +42,11 @@ func (u *udpPacket) afterLoad() {} func (u *udpPacket) StateLoad(stateSourceObject state.Source) { stateSourceObject.Load(0, &u.udpPacketEntry) stateSourceObject.Load(1, &u.senderAddress) - stateSourceObject.Load(2, &u.packetInfo) - stateSourceObject.Load(4, &u.timestamp) - stateSourceObject.Load(5, &u.tos) - stateSourceObject.LoadValue(3, new(buffer.VectorisedView), func(y interface{}) { u.loadData(y.(buffer.VectorisedView)) }) + stateSourceObject.Load(2, &u.destinationAddress) + stateSourceObject.Load(3, &u.packetInfo) + stateSourceObject.Load(5, &u.timestamp) + stateSourceObject.Load(6, &u.tos) + stateSourceObject.LoadValue(4, new(buffer.VectorisedView), func(y interface{}) { u.loadData(y.(buffer.VectorisedView)) }) } func (e *endpoint) StateTypeName() string { |