On 07/07/15(Tue) 18:02, Martin Pieuchot wrote:
> Maybe not yet but at least I'd like to do the ARP request a bit later.
>
> We create a RTF_LOCAL route entry for every configured address. So
> use this information to emit a "who-has" for the configured address.
>
> This also has the advantage of *not* sending an ARP request if
> something wrong happens between the SIOCSIFADDR ioctl and the
> RTF_LOCAL route creation.
Anybody?
> Ok?
>
> Index: netinet/if_ether.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/if_ether.c,v
> retrieving revision 1.157
> diff -u -p -r1.157 if_ether.c
> --- netinet/if_ether.c 7 Jul 2015 14:22:25 -0000 1.157
> +++ netinet/if_ether.c 7 Jul 2015 15:56:15 -0000
> @@ -196,8 +196,11 @@ arp_rtrequest(int req, struct rtentry *r
> if ((rt->rt_flags & RTF_CLONING) != 0)
> break;
> }
> - /* Announce a new entry if requested. */
> - if (rt->rt_flags & RTF_ANNOUNCE)
> + /*
> + * Announce a new entry if requested or warn the user
> + * if another station has this IP address.
> + */
> + if (rt->rt_flags & (RTF_ANNOUNCE|RTF_LOCAL))
> arprequest(ifp,
> &satosin(rt_key(rt))->sin_addr.s_addr,
> &satosin(rt_key(rt))->sin_addr.s_addr,
> @@ -850,12 +853,6 @@ arpproxy(struct in_addr in, u_int rdomai
> void
> arp_ifinit(struct arpcom *ac, struct ifaddr *ifa)
> {
> -
> - /* Warn the user if another station has this IP address. */
> - arprequest(&ac->ac_if,
> - &satosin(ifa->ifa_addr)->sin_addr.s_addr,
> - &satosin(ifa->ifa_addr)->sin_addr.s_addr,
> - ac->ac_enaddr);
> ifa->ifa_rtrequest = arp_rtrequest;
> }
>
>