diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-29 04:49:11 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-29 04:49:11 +0000 |
commit | f2280a58b62bf7f468b44a1ab79910ca0c6cf9a3 (patch) | |
tree | 6393d3c5b0426285e3ef4bcd31ee4fc5f39ae285 /pkg/tcpip/stack/pending_packets.go | |
parent | 95a799b374287ea444e1827a89e228f5236a56e5 (diff) | |
parent | d6a39734c4934aa98141074c67389e80ed130a94 (diff) |
Merge release-20210125.0-25-gd6a39734c (automated)
Diffstat (limited to 'pkg/tcpip/stack/pending_packets.go')
-rw-r--r-- | pkg/tcpip/stack/pending_packets.go | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/pkg/tcpip/stack/pending_packets.go b/pkg/tcpip/stack/pending_packets.go index c6adfb27b..1c651e216 100644 --- a/pkg/tcpip/stack/pending_packets.go +++ b/pkg/tcpip/stack/pending_packets.go @@ -114,20 +114,6 @@ func (f *packetsPendingLinkResolution) dequeue(ch <-chan struct{}, linkAddr tcpi } } -func (f *packetsPendingLinkResolution) writePacketBuffer(r RouteInfo, gso *GSO, proto tcpip.NetworkProtocolNumber, pkt pendingPacketBuffer) (int, tcpip.Error) { - switch pkt := pkt.(type) { - case *PacketBuffer: - if err := f.nic.writePacket(r, gso, proto, pkt); err != nil { - return 0, err - } - return 1, nil - case *PacketBufferList: - return f.nic.writePackets(r, gso, proto, *pkt) - default: - panic(fmt.Sprintf("unrecognized pending packet buffer type = %T", pkt)) - } -} - // enqueue a packet to be sent once link resolution completes. // // If the maximum number of pending resolutions is reached, the packets @@ -151,7 +137,7 @@ func (f *packetsPendingLinkResolution) enqueue(r *Route, gso *GSO, proto tcpip.N // The route resolved immediately, so we don't need to wait for link // resolution to send the packet. f.mu.Unlock() - return f.writePacketBuffer(routeInfo, gso, proto, pkt) + return f.nic.writePacketBuffer(routeInfo, gso, proto, pkt) case *tcpip.ErrWouldBlock: // We need to wait for link resolution to complete. default: @@ -225,7 +211,7 @@ func (f *packetsPendingLinkResolution) dequeuePackets(packets []pendingPacket, l for _, p := range packets { if success { p.routeInfo.RemoteLinkAddress = linkAddr - _, _ = f.writePacketBuffer(p.routeInfo, p.gso, p.proto, p.pkt) + _, _ = f.nic.writePacketBuffer(p.routeInfo, p.gso, p.proto, p.pkt) } else { f.incrementOutgoingPacketErrors(p.proto, p.pkt) |