On Thu, Mar 03, 2016 at 02:38:16PM +0100, Martin Pieuchot wrote:
> 
> So you found a regression due to a change in arptfree().  Previously the
> function was looking as its reference counter to decide if it should
> delete the route or not.  I changed that do stop look at the reference
> because this behavior is racy and wont fly as soon as route lookups are
> done without holding the KERNEL_LOCK.
> 
> But we could decide not to remove ARP entries with the RTF_STATIC bit
> set.  The others will automatically be re-created by a cloning route.
> 
> Does the diff below restore the previous behavior for you?

Yes it does.  

On my test network, when the ARP entry expires the routing table looks like:

Internet:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            10.0.31.1          UGS        0       12     -     8 vr0  
10.0.31.1          link#1             UHLS       1       20     -     8 vr0  
10.0.32.1          00:00:24:cd:7e:50  UHLl       0       28     -     1 vr0  
10.0.32.1/32       10.0.32.1          UC         0        0     -     4 vr0  
127/8              127.0.0.1          UGRS       0        0 32768     8 lo0  
127.0.0.1          127.0.0.1          UHl        0        0 32768     1 lo0  
224/4              127.0.0.1          URS        0        0 32768     8 lo0  


# arp -an             
Host                                 Ethernet Address   Netif Expire     Flags
10.0.31.1                            (incomplete)         vr0 expired    
10.0.32.1                            00:00:24:cd:7e:50    vr0 permanent  l

and as soon as it's used the arp request is emitted and 'link#1' is 
replaced by the actual MAC address of the router again.


> 
> Index: netinet/if_ether.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/if_ether.c,v
> retrieving revision 1.201
> diff -u -p -r1.201 if_ether.c
> --- netinet/if_ether.c        21 Jan 2016 03:34:05 -0000      1.201
> +++ netinet/if_ether.c        3 Mar 2016 13:28:03 -0000
> @@ -667,7 +667,8 @@ arptfree(struct rtentry *rt)
>               la->la_asked = 0;
>       }
>  
> -     rtdeletemsg(rt, ifp, ifp->if_rdomain);
> +     if (!ISSET(rt->rt_flags, RTF_STATIC))
> +             rtdeletemsg(rt, ifp, ifp->if_rdomain);
>       if_put(ifp);
>  }
>  
> Index: netinet6/nd6.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/nd6.c,v
> retrieving revision 1.176
> diff -u -p -r1.176 nd6.c
> --- netinet6/nd6.c    3 Dec 2015 21:57:59 -0000       1.176
> +++ netinet6/nd6.c    3 Mar 2016 13:28:02 -0000
> @@ -833,7 +833,8 @@ nd6_free(struct rtentry *rt, int gc)
>        * caches, and disable the route entry not to be used in already
>        * cached routes.
>        */
> -     rtdeletemsg(rt, ifp, ifp->if_rdomain);
> +     if (!ISSET(rt->rt_flags, RTF_STATIC))
> +             rtdeletemsg(rt, ifp, ifp->if_rdomain);
>       splx(s);
>  
>       if_put(ifp);

-- 
Matthieu Herrb

Attachment: pgpi1hBL1HBVZ.pgp
Description: PGP signature

Reply via email to