summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/arp
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-01-19 12:06:08 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-19 12:08:36 -0800
commita2ec1932c9b76d80d3af93aa74acf945829cd582 (patch)
tree86a7d00bf7c9f5cc407999b794def4c208d41c3b /pkg/tcpip/network/arp
parent1a072e298e76c59083f2732b24f9291f888d6c66 (diff)
Drop CheckLocalAddress from LinkAddressCache
PiperOrigin-RevId: 352623277
Diffstat (limited to 'pkg/tcpip/network/arp')
-rw-r--r--pkg/tcpip/network/arp/arp.go24
1 files changed, 9 insertions, 15 deletions
diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go
index 3259d052f..d54e7fe86 100644
--- a/pkg/tcpip/network/arp/arp.go
+++ b/pkg/tcpip/network/arp/arp.go
@@ -138,23 +138,17 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) {
stats.RequestsReceived.Increment()
localAddr := tcpip.Address(h.ProtocolAddressTarget())
- if e.nud == nil {
- if e.linkAddrCache.CheckLocalAddress(e.nic.ID(), header.IPv4ProtocolNumber, localAddr) == 0 {
- stats.RequestsReceivedUnknownTargetAddress.Increment()
- return // we have no useful answer, ignore the request
- }
+ if e.protocol.stack.CheckLocalAddress(e.nic.ID(), header.IPv4ProtocolNumber, localAddr) == 0 {
+ stats.RequestsReceivedUnknownTargetAddress.Increment()
+ return // we have no useful answer, ignore the request
+ }
- addr := tcpip.Address(h.ProtocolAddressSender())
- linkAddr := tcpip.LinkAddress(h.HardwareAddressSender())
- e.linkAddrCache.AddLinkAddress(e.nic.ID(), addr, linkAddr)
- } else {
- if e.protocol.stack.CheckLocalAddress(e.nic.ID(), header.IPv4ProtocolNumber, localAddr) == 0 {
- stats.RequestsReceivedUnknownTargetAddress.Increment()
- return // we have no useful answer, ignore the request
- }
+ remoteAddr := tcpip.Address(h.ProtocolAddressSender())
+ remoteLinkAddr := tcpip.LinkAddress(h.HardwareAddressSender())
- remoteAddr := tcpip.Address(h.ProtocolAddressSender())
- remoteLinkAddr := tcpip.LinkAddress(h.HardwareAddressSender())
+ if e.nud == nil {
+ e.linkAddrCache.AddLinkAddress(e.nic.ID(), remoteAddr, remoteLinkAddr)
+ } else {
e.nud.HandleProbe(remoteAddr, ProtocolNumber, remoteLinkAddr, e.protocol)
}