From 547f60b4c507778099635f5d2ec4919e1beb6a57 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 19 Mar 2018 01:11:08 +0100 Subject: devip: pick source address for neighbor solicitations as of rfc4861 7.2.2, cleanup rfc4861 7.2.2: If the source address of the packet prompting the solicitation is the same as one of the addresses assigned to the outgoing interface, that address SHOULD be placed in the IP Source Address of the outgoing solicitation. this change adds ndbsendsol() which handles the source address selection and also handles the arp table locking; avoiding access to the arp entry after the arp table is unlocked. cleanups: - use ipmove() instead of memmove(). - useless extern qualifiers --- sys/src/9/ip/ethermedium.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'sys/src/9/ip/ethermedium.c') diff --git a/sys/src/9/ip/ethermedium.c b/sys/src/9/ip/ethermedium.c index d8691b0e7..9b1962450 100644 --- a/sys/src/9/ip/ethermedium.c +++ b/sys/src/9/ip/ethermedium.c @@ -498,7 +498,6 @@ resolveaddr6(Ipifc *ifc, Arpent *a) { Block *bp; Etherrock *er = ifc->arg; - uchar ipsrc[IPaddrlen]; /* don't do anything if it's been less than a second since the last */ if(NOW - a->ctime < ReTransTimer){ @@ -523,10 +522,7 @@ resolveaddr6(Ipifc *ifc, Arpent *a) } a->rxtsrem--; - arprelease(er->f->arp, a); - - if(ipv6local(ifc, ipsrc, a->ip)) - icmpns(er->f, ipsrc, SRC_UNI, a->ip, TARG_MULTI, ifc->mac); + ndpsendsol(er->f, ifc, a); /* unlocks arp */ } /* @@ -610,7 +606,7 @@ recvarp(Ipifc *ifc) case ARPREQUEST: /* don't answer arps till we know who we are */ - if(ifc->lifc == 0) + if(ifc->lifc == nil) break; /* check for machine using my ip or ether address */ -- cgit v1.2.3