summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/arp
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-03-16 10:28:04 -0700
committergVisor bot <gvisor-bot@google.com>2021-03-16 10:29:49 -0700
commitebd7c1b889e5d212f4a694d3addbada241936e8e (patch)
tree3af9e3404d691cfe29508e74e971576f5ea1379c /pkg/tcpip/network/arp
parentf7e841c2cede357c4cbd6117605e3f3d54f1961c (diff)
Do not call into Stack from LinkAddressRequest
Calling into the stack from LinkAddressRequest is not needed as we already have a reference to the network endpoint (IPv6) or network interface (IPv4/ARP). PiperOrigin-RevId: 363213973
Diffstat (limited to 'pkg/tcpip/network/arp')
-rw-r--r--pkg/tcpip/network/arp/arp.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go
index ae0461a6d..43a4b7cac 100644
--- a/pkg/tcpip/network/arp/arp.go
+++ b/pkg/tcpip/network/arp/arp.go
@@ -305,8 +305,6 @@ func (*endpoint) LinkAddressProtocol() tcpip.NetworkProtocolNumber {
// LinkAddressRequest implements stack.LinkAddressResolver.LinkAddressRequest.
func (e *endpoint) LinkAddressRequest(targetAddr, localAddr tcpip.Address, remoteLinkAddr tcpip.LinkAddress) tcpip.Error {
- nicID := e.nic.ID()
-
stats := e.stats.arp
if len(remoteLinkAddr) == 0 {
@@ -314,9 +312,9 @@ func (e *endpoint) LinkAddressRequest(targetAddr, localAddr tcpip.Address, remot
}
if len(localAddr) == 0 {
- addr, ok := e.protocol.stack.GetMainNICAddress(nicID, header.IPv4ProtocolNumber)
- if !ok {
- return &tcpip.ErrUnknownNICID{}
+ addr, err := e.nic.PrimaryAddress(header.IPv4ProtocolNumber)
+ if err != nil {
+ return err
}
if len(addr.Address) == 0 {