summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/arp
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-01-31 18:18:41 +0000
committergVisor bot <gvisor-bot@google.com>2021-01-31 18:18:41 +0000
commit1c971ad0ae2dda7664c2e92bb4df9a2b8f3e53a4 (patch)
tree341161664df67886a5cadf41b27d3f183b5f8b8d /pkg/tcpip/network/arp
parent58fdf2ff47e75ee26f845e29de1dc4d857ba55f0 (diff)
parentdaeb06d2cbf5509bd53dc67138504e51d0fcfae8 (diff)
Merge release-20210125.0-40-gdaeb06d2c (automated)
Diffstat (limited to 'pkg/tcpip/network/arp')
-rw-r--r--pkg/tcpip/network/arp/arp.go27
1 files changed, 7 insertions, 20 deletions
diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go
index 5c79d6485..5fd4c5574 100644
--- a/pkg/tcpip/network/arp/arp.go
+++ b/pkg/tcpip/network/arp/arp.go
@@ -50,10 +50,8 @@ type endpoint struct {
// Must be accessed using atomic operations.
enabled uint32
- nic stack.NetworkInterface
- linkAddrCache stack.LinkAddressCache
- nud stack.NUDHandler
- stats sharedStats
+ nic stack.NetworkInterface
+ stats sharedStats
}
func (e *endpoint) Enable() tcpip.Error {
@@ -150,11 +148,7 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) {
remoteAddr := tcpip.Address(h.ProtocolAddressSender())
remoteLinkAddr := tcpip.LinkAddress(h.HardwareAddressSender())
- if e.nud == nil {
- e.linkAddrCache.AddLinkAddress(remoteAddr, remoteLinkAddr)
- } else {
- e.nud.HandleProbe(remoteAddr, ProtocolNumber, remoteLinkAddr, e)
- }
+ e.nic.HandleNeighborProbe(remoteAddr, remoteLinkAddr, e)
respPkt := stack.NewPacketBuffer(stack.PacketBufferOptions{
ReserveHeaderBytes: int(e.nic.MaxHeaderLength()) + header.ARPSize,
@@ -194,14 +188,9 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) {
addr := tcpip.Address(h.ProtocolAddressSender())
linkAddr := tcpip.LinkAddress(h.HardwareAddressSender())
- if e.nud == nil {
- e.linkAddrCache.AddLinkAddress(addr, linkAddr)
- return
- }
-
// The solicited, override, and isRouter flags are not available for ARP;
// they are only available for IPv6 Neighbor Advertisements.
- e.nud.HandleConfirmation(addr, linkAddr, stack.ReachabilityConfirmationFlags{
+ e.nic.HandleNeighborConfirmation(addr, linkAddr, stack.ReachabilityConfirmationFlags{
// Solicited and unsolicited (also referred to as gratuitous) ARP Replies
// are handled equivalently to a solicited Neighbor Advertisement.
Solicited: true,
@@ -234,12 +223,10 @@ func (*protocol) ParseAddresses(buffer.View) (src, dst tcpip.Address) {
return "", ""
}
-func (p *protocol) NewEndpoint(nic stack.NetworkInterface, linkAddrCache stack.LinkAddressCache, nud stack.NUDHandler, dispatcher stack.TransportDispatcher) stack.NetworkEndpoint {
+func (p *protocol) NewEndpoint(nic stack.NetworkInterface, dispatcher stack.TransportDispatcher) stack.NetworkEndpoint {
e := &endpoint{
- protocol: p,
- nic: nic,
- linkAddrCache: linkAddrCache,
- nud: nud,
+ protocol: p,
+ nic: nic,
}
tcpip.InitStatCounters(reflect.ValueOf(&e.stats.localStats).Elem())