diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2021-10-13 15:17:23 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-10-13 15:20:21 -0700 |
commit | 4e2cc2bef3220bb77a60b4a33fb02f491d5acf98 (patch) | |
tree | 2a312dc5db6dff26b5016351e2a7a089d9730511 /pkg/tcpip/link/sharedmem/sharedmem.go | |
parent | 1796cd89d516033800f9c887250481c26bab0ae0 (diff) |
Minor fixes to sharedmem.
Use route/protocol from packetbuffer.
Sharedmem implementation should use the EgressRoute/NetworkProtocolNumber
embedded in the packetbuffer rather than what is passed as parameters to
Write(Raw)Packet(s).
PiperOrigin-RevId: 402934171
Diffstat (limited to 'pkg/tcpip/link/sharedmem/sharedmem.go')
-rw-r--r-- | pkg/tcpip/link/sharedmem/sharedmem.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/tcpip/link/sharedmem/sharedmem.go b/pkg/tcpip/link/sharedmem/sharedmem.go index bcb37a465..b75522a51 100644 --- a/pkg/tcpip/link/sharedmem/sharedmem.go +++ b/pkg/tcpip/link/sharedmem/sharedmem.go @@ -343,10 +343,10 @@ func (e *endpoint) writePacketLocked(r stack.RouteInfo, protocol tcpip.NetworkPr // WritePacket writes outbound packets to the file descriptor. If it is not // currently writable, the packet is dropped. -func (e *endpoint) WritePacket(r stack.RouteInfo, protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) tcpip.Error { +func (e *endpoint) WritePacket(_ stack.RouteInfo, _ tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) tcpip.Error { e.mu.Lock() defer e.mu.Unlock() - if err := e.writePacketLocked(r, protocol, pkt); err != nil { + if err := e.writePacketLocked(pkt.EgressRoute, pkt.NetworkProtocolNumber, pkt); err != nil { return err } e.tx.notify() @@ -354,13 +354,13 @@ func (e *endpoint) WritePacket(r stack.RouteInfo, protocol tcpip.NetworkProtocol } // WritePackets implements stack.LinkEndpoint.WritePackets. -func (e *endpoint) WritePackets(r stack.RouteInfo, pkts stack.PacketBufferList, protocol tcpip.NetworkProtocolNumber) (int, tcpip.Error) { +func (e *endpoint) WritePackets(_ stack.RouteInfo, pkts stack.PacketBufferList, protocol tcpip.NetworkProtocolNumber) (int, tcpip.Error) { n := 0 var err tcpip.Error e.mu.Lock() defer e.mu.Unlock() for pkt := pkts.Front(); pkt != nil; pkt = pkt.Next() { - if err = e.writePacketLocked(r, pkt.NetworkProtocolNumber, pkt); err != nil { + if err = e.writePacketLocked(pkt.EgressRoute, pkt.NetworkProtocolNumber, pkt); err != nil { break } n++ |