summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/arp
diff options
context:
space:
mode:
authorArthur Sfez <asfez@google.com>2021-01-22 16:06:45 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-22 16:12:12 -0800
commit18ebec0ec957f1af0af3aa8fc2145c394552e042 (patch)
tree9889d79e4e05bbe4c690efca5fd4130e3fc226c2 /pkg/tcpip/network/arp
parent76da673a0ddaf33e410d48501a9b089979411d4d (diff)
Refactor GetMainNICAddress
It previously returned an error but it could only be UnknownNICID. It now returns a boolean to indicate whether the nic exists or not. PiperOrigin-RevId: 353337489
Diffstat (limited to 'pkg/tcpip/network/arp')
-rw-r--r--pkg/tcpip/network/arp/arp.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go
index 9255a4f6a..0616b10aa 100644
--- a/pkg/tcpip/network/arp/arp.go
+++ b/pkg/tcpip/network/arp/arp.go
@@ -262,10 +262,10 @@ func (p *protocol) LinkAddressRequest(targetAddr, localAddr tcpip.Address, remot
nicID := nic.ID()
if len(localAddr) == 0 {
- addr, err := p.stack.GetMainNICAddress(nicID, header.IPv4ProtocolNumber)
- if err != nil {
+ addr, ok := p.stack.GetMainNICAddress(nicID, header.IPv4ProtocolNumber)
+ if !ok {
stats.OutgoingRequestInterfaceHasNoLocalAddressErrors.Increment()
- return err
+ return tcpip.ErrUnknownNICID
}
if len(addr.Address) == 0 {