Reset the RTF_CONNECTED flag when cloning an entry.
authormpi <mpi@openbsd.org>
Wed, 14 Oct 2015 10:18:03 +0000 (10:18 +0000)
committermpi <mpi@openbsd.org>
Wed, 14 Oct 2015 10:18:03 +0000 (10:18 +0000)
While here check for RTF_CLONED insted of RTM_RESOLVE when adding an
entry.

Found while debugging naddy@'s NFS vs em(4) vs rtisvalid(9) issue.

sys/net/route.c

index fcf6281..f995576 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: route.c,v 1.251 2015/10/14 10:09:30 mpi Exp $ */
+/*     $OpenBSD: route.c,v 1.252 2015/10/14 10:18:03 mpi Exp $ */
 /*     $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $      */
 
 /*
@@ -806,10 +806,9 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
                        info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
                }
 
-               info->rti_flags = rt->rt_flags & ~(RTF_CLONING | RTF_STATIC);
-               info->rti_flags |= RTF_CLONED;
+               info->rti_flags = rt->rt_flags | (RTF_CLONED|RTF_HOST);
+               info->rti_flags &= ~(RTF_CLONING|RTF_CONNECTED|RTF_STATIC);
                info->rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
-               info->rti_flags |= RTF_HOST;
                info->rti_info[RTAX_LABEL] =
                    rtlabel_id2sa(rt->rt_labelid, &sa_rl2);
                /* FALLTHROUGH */
@@ -905,7 +904,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
                ifa->ifa_refcnt++;
                rt->rt_ifa = ifa;
                rt->rt_ifp = ifa->ifa_ifp;
-               if (req == RTM_RESOLVE) {
+               if (rt->rt_flags & RTF_CLONED) {
                        /*
                         * If the ifa of the cloning route was stale, a
                         * successful lookup for an ifa with the same address