diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-09-13 14:40:18 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-09-13 14:42:49 -0700 |
commit | e07fd058ec474d801748a849d9c5d1c6118c3c11 (patch) | |
tree | 90220570c93945df850284b88c3e29480d5e92a5 /pkg/tcpip/network/ipv4 | |
parent | 79834ce16c5a32b7694c2f00e6bdd0cbdb6b947a (diff) |
Set NICID before delivering packet to raw endpoint
...as raw endpoints expect the packet's NICID to be set.
PiperOrigin-RevId: 396446552
Diffstat (limited to 'pkg/tcpip/network/ipv4')
-rw-r--r-- | pkg/tcpip/network/ipv4/ipv4.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/tcpip/network/ipv4/ipv4.go b/pkg/tcpip/network/ipv4/ipv4.go index 44c85bdb8..e2472c851 100644 --- a/pkg/tcpip/network/ipv4/ipv4.go +++ b/pkg/tcpip/network/ipv4/ipv4.go @@ -856,6 +856,8 @@ func (e *endpoint) handleLocalPacket(pkt *stack.PacketBuffer, canSkipRXChecksum } func (e *endpoint) handleValidatedPacket(h header.IPv4, pkt *stack.PacketBuffer, inNICName string) { + pkt.NICID = e.nic.ID() + // Raw socket packets are delivered based solely on the transport protocol // number. We only require that the packet be valid IPv4, and that they not // be fragmented. @@ -863,7 +865,6 @@ func (e *endpoint) handleValidatedPacket(h header.IPv4, pkt *stack.PacketBuffer, e.dispatcher.DeliverRawPacket(h.TransportProtocol(), pkt) } - pkt.NICID = e.nic.ID() stats := e.stats stats.ip.ValidPacketsReceived.Increment() |