diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-16 01:04:25 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-16 01:04:25 +0000 |
commit | a22726e7b37507e88a2146509477ef5d400df23e (patch) | |
tree | b4372e37671eb1872b0a4f856bd2590e46bc0791 /pkg/tcpip/stack/nic.go | |
parent | 06bcbc23fd8a186b0314fc8aae50545a972d7f5c (diff) | |
parent | fd5b52c87ff8fbabf2b293fc95ec9f9f04e5621c (diff) |
Merge release-20210112.0-38-gfd5b52c87 (automated)
Diffstat (limited to 'pkg/tcpip/stack/nic.go')
-rw-r--r-- | pkg/tcpip/stack/nic.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index 8a946b4fa..c8d0323cb 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -321,21 +321,18 @@ func (n *NIC) WritePacket(r *Route, gso *GSO, protocol tcpip.NetworkProtocolNumb return err } - return n.writePacket(r, gso, protocol, pkt) + return n.writePacket(r.Fields(), gso, protocol, pkt) } // WritePacketToRemote implements NetworkInterface. func (n *NIC) WritePacketToRemote(remoteLinkAddr tcpip.LinkAddress, gso *GSO, protocol tcpip.NetworkProtocolNumber, pkt *PacketBuffer) *tcpip.Error { - r := Route{ - routeInfo: routeInfo{ - NetProto: protocol, - }, - } - r.ResolveWith(remoteLinkAddr) - return n.writePacket(&r, gso, protocol, pkt) + var r RouteInfo + r.NetProto = protocol + r.RemoteLinkAddress = remoteLinkAddr + return n.writePacket(r, gso, protocol, pkt) } -func (n *NIC) writePacket(r *Route, gso *GSO, protocol tcpip.NetworkProtocolNumber, pkt *PacketBuffer) *tcpip.Error { +func (n *NIC) writePacket(r RouteInfo, gso *GSO, protocol tcpip.NetworkProtocolNumber, pkt *PacketBuffer) *tcpip.Error { // WritePacket takes ownership of pkt, calculate numBytes first. numBytes := pkt.Size() @@ -352,7 +349,7 @@ func (n *NIC) writePacket(r *Route, gso *GSO, protocol tcpip.NetworkProtocolNumb func (n *NIC) WritePackets(r *Route, gso *GSO, pkts PacketBufferList, protocol tcpip.NetworkProtocolNumber) (int, *tcpip.Error) { // TODO(gvisor.dev/issue/4458): Queue packets whie link address resolution // is being peformed like WritePacket. - writtenPackets, err := n.LinkEndpoint.WritePackets(r, gso, pkts, protocol) + writtenPackets, err := n.LinkEndpoint.WritePackets(r.Fields(), gso, pkts, protocol) n.stats.Tx.Packets.IncrementBy(uint64(writtenPackets)) writtenBytes := 0 for i, pb := 0, pkts.Front(); i < writtenPackets && pb != nil; i, pb = i+1, pb.Next() { |