From 18ebec0ec957f1af0af3aa8fc2145c394552e042 Mon Sep 17 00:00:00 2001 From: Arthur Sfez Date: Fri, 22 Jan 2021 16:06:45 -0800 Subject: 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 --- pkg/tcpip/network/arp/arp.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg/tcpip/network/arp') 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 { -- cgit v1.2.3