summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-01-19 20:27:01 +0000
committergVisor bot <gvisor-bot@google.com>2021-01-19 20:27:01 +0000
commita0340632a1440c8864527cd6a09aa14a272ec8d3 (patch)
tree37c6f5232b621230749cfb293d6ad4719d60424d
parent1578e225d816fa47899c4e43d29ee87e018a0dc9 (diff)
parenta2ec1932c9b76d80d3af93aa74acf945829cd582 (diff)
Merge release-20210112.0-43-ga2ec1932c (automated)
-rw-r--r--pkg/tcpip/network/arp/arp.go24
-rw-r--r--pkg/tcpip/stack/registration.go4
2 files changed, 9 insertions, 19 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)
}
diff --git a/pkg/tcpip/stack/registration.go b/pkg/tcpip/stack/registration.go
index 68c113b6a..a73bc7007 100644
--- a/pkg/tcpip/stack/registration.go
+++ b/pkg/tcpip/stack/registration.go
@@ -829,10 +829,6 @@ type LinkAddressResolver interface {
// A LinkAddressCache caches link addresses.
type LinkAddressCache interface {
- // CheckLocalAddress determines if the given local address exists, and if it
- // does not exist.
- CheckLocalAddress(nicID tcpip.NICID, protocol tcpip.NetworkProtocolNumber, addr tcpip.Address) tcpip.NICID
-
// AddLinkAddress adds a link address to the cache.
AddLinkAddress(nicID tcpip.NICID, addr tcpip.Address, linkAddr tcpip.LinkAddress)
}