Now that rtrequest1(9) properly set RTF_UP when a route is added,
there's no need to pass it to rt_ifa_add(9).
rt_ifa_del(9) never needed it, but it has been set for documentation.
ok?
Index: net/route.c
===================================================================
RCS file: /cvs/src/sys/net/route.c,v
retrieving revision 1.237
diff -u -p -r1.237 route.c
--- net/route.c 11 Sep 2015 20:03:40 -0000 1.237
+++ net/route.c 12 Sep 2015 08:03:05 -0000
@@ -1322,7 +1322,7 @@ rt_ifa_addlocal(struct ifaddr *ifa)
/* If there is no loopback entry, allocate one. */
rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain);
if (rt == NULL || !ISSET(rt->rt_flags, flags))
- error = rt_ifa_add(ifa, RTF_UP | flags, ifa->ifa_addr);
+ error = rt_ifa_add(ifa, flags, ifa->ifa_addr);
if (rt)
rtfree(rt);
Index: net/if_mpe.c
===================================================================
RCS file: /cvs/src/sys/net/if_mpe.c,v
retrieving revision 1.46
diff -u -p -r1.46 if_mpe.c
--- net/if_mpe.c 30 Jun 2015 13:54:42 -0000 1.46
+++ net/if_mpe.c 12 Sep 2015 08:01:30 -0000
@@ -124,7 +124,7 @@ mpe_clone_destroy(struct ifnet *ifp)
if (mpeif->sc_smpls.smpls_label) {
s = splsoftnet();
- rt_ifa_del(&mpeif->sc_ifa, RTF_MPLS | RTF_UP,
+ rt_ifa_del(&mpeif->sc_ifa, RTF_MPLS,
smplstosa(&mpeif->sc_smpls));
splx(s);
}
@@ -323,12 +323,12 @@ mpeioctl(struct ifnet *ifp, u_long cmd,
s = splsoftnet();
if (ifm->sc_smpls.smpls_label) {
/* remove old MPLS route */
- rt_ifa_del(&ifm->sc_ifa, RTF_MPLS | RTF_UP,
+ rt_ifa_del(&ifm->sc_ifa, RTF_MPLS,
smplstosa(&ifm->sc_smpls));
}
/* add new MPLS route */
ifm->sc_smpls.smpls_label = shim.shim_label;
- error = rt_ifa_add(&ifm->sc_ifa, RTF_MPLS | RTF_UP,
+ error = rt_ifa_add(&ifm->sc_ifa, RTF_MPLS,
smplstosa(&ifm->sc_smpls));
splx(s);
if (error) {
@@ -342,7 +342,7 @@ mpeioctl(struct ifnet *ifp, u_long cmd,
if (ifr->ifr_rdomainid != ifp->if_rdomain) {
if (ifm->sc_smpls.smpls_label) {
s = splsoftnet();
- rt_ifa_add(&ifm->sc_ifa, RTF_MPLS | RTF_UP,
+ rt_ifa_add(&ifm->sc_ifa, RTF_MPLS,
smplstosa(&ifm->sc_smpls));
splx(s);
}
Index: net/if_mpw.c
===================================================================
RCS file: /cvs/src/sys/net/if_mpw.c,v
retrieving revision 1.5
diff -u -p -r1.5 if_mpw.c
--- net/if_mpw.c 10 Sep 2015 16:41:30 -0000 1.5
+++ net/if_mpw.c 12 Sep 2015 08:01:30 -0000
@@ -128,7 +128,7 @@ mpw_clone_destroy(struct ifnet *ifp)
if (sc->sc_smpls.smpls_label) {
s = splsoftnet();
- rt_ifa_del(&sc->sc_ifa, RTF_MPLS | RTF_UP,
+ rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
smplstosa(&sc->sc_smpls));
splx(s);
}
@@ -189,7 +189,7 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd,
sin = (struct sockaddr_in *) &imr.imr_nexthop;
if (sin->sin_addr.s_addr == 0) {
s = splsoftnet();
- if (rt_ifa_del(&sc->sc_ifa, RTF_MPLS | RTF_UP,
+ if (rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
smplstosa(&sc->sc_smpls)) == 0)
sc->sc_smpls.smpls_label = 0;
splx(s);
@@ -220,11 +220,11 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd,
if (sc->sc_smpls.smpls_label != imr.imr_lshim.shim_label) {
s = splsoftnet();
if (sc->sc_smpls.smpls_label)
- rt_ifa_del(&sc->sc_ifa, RTF_MPLS | RTF_UP,
+ rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
smplstosa(&sc->sc_smpls));
sc->sc_smpls.smpls_label = imr.imr_lshim.shim_label;
- error = rt_ifa_add(&sc->sc_ifa, RTF_MPLS | RTF_UP,
+ error = rt_ifa_add(&sc->sc_ifa, RTF_MPLS,
smplstosa(&sc->sc_smpls));
splx(s);
if (error != 0) {
Index: netinet/in.c
===================================================================
RCS file: /cvs/src/sys/netinet/in.c,v
retrieving revision 1.122
diff -u -p -r1.122 in.c
--- netinet/in.c 9 Sep 2015 20:12:36 -0000 1.122
+++ netinet/in.c 12 Sep 2015 08:01:30 -0000
@@ -713,7 +713,7 @@ in_purgeaddr(struct ifaddr *ifa)
int
in_addhost(struct in_ifaddr *ia, struct sockaddr_in *dst)
{
- return rt_ifa_add(&ia->ia_ifa, RTF_UP|RTF_HOST, sintosa(dst));
+ return rt_ifa_add(&ia->ia_ifa, RTF_HOST, sintosa(dst));
}
int
@@ -731,13 +731,12 @@ in_insert_prefix(struct in_ifaddr *ia)
struct ifaddr *ifa = &ia->ia_ifa;
int error;
- error = rt_ifa_add(ifa, RTF_UP | RTF_CLONING | RTF_CONNECTED,
- ifa->ifa_addr);
+ error = rt_ifa_add(ifa, RTF_CLONING | RTF_CONNECTED, ifa->ifa_addr);
if (error)
return (error);
if (ia->ia_broadaddr.sin_addr.s_addr != 0)
- error = rt_ifa_add(ifa, RTF_UP | RTF_HOST | RTF_BROADCAST,
+ error = rt_ifa_add(ifa, RTF_HOST | RTF_BROADCAST,
ifa->ifa_broadaddr);
return (error);
Index: netinet6/in6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.174
diff -u -p -r1.174 in6.c
--- netinet6/in6.c 10 Sep 2015 16:39:39 -0000 1.174
+++ netinet6/in6.c 12 Sep 2015 08:01:30 -0000
@@ -501,8 +501,8 @@ in6_control(struct socket *so, u_long cm
}
s = splsoftnet();
- error = rt_ifa_add(&ia6->ia_ifa,
- RTF_UP|RTF_CLONING|RTF_CONNECTED, ia6->ia_ifa.ifa_addr);
+ error = rt_ifa_add(&ia6->ia_ifa, RTF_CLONING | RTF_CONNECTED,
+ ia6->ia_ifa.ifa_addr);
if (error) {
in6_purgeaddr(&ia6->ia_ifa);
splx(s);
@@ -807,7 +807,7 @@ in6_update_ifa(struct ifnet *ifp, struct
info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr);
/* XXX: we need RTF_CLONING to fake nd6_rtrequest */
- info.rti_flags = RTF_UP | RTF_CLONING;
+ info.rti_flags = RTF_CLONING;
error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, NULL,
ifp->if_rdomain);
if (error)
@@ -863,7 +863,7 @@ in6_update_ifa(struct ifnet *ifp, struct
info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr);
info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr);
- info.rti_flags = RTF_UP | RTF_CLONING;
+ info.rti_flags = RTF_CLONING;
error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, NULL,
ifp->if_rdomain);
if (error)
@@ -1255,7 +1255,7 @@ in6_ifinit(struct ifnet *ifp, struct in6
if ((ifp->if_flags & IFF_POINTOPOINT) && plen == 128 &&
ia6->ia_dstaddr.sin6_family == AF_INET6) {
ifa = &ia6->ia_ifa;
- error = rt_ifa_add(ifa, RTF_UP | RTF_HOST, ifa->ifa_dstaddr);
+ error = rt_ifa_add(ifa, RTF_HOST, ifa->ifa_dstaddr);
if (error != 0)
return (error);
ia6->ia_flags |= IFA_ROUTE;
Index: netinet6/in6_ifattach.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6_ifattach.c,v
retrieving revision 1.95
diff -u -p -r1.95 in6_ifattach.c
--- netinet6/in6_ifattach.c 3 Sep 2015 16:42:01 -0000 1.95
+++ netinet6/in6_ifattach.c 12 Sep 2015 08:01:30 -0000
@@ -356,7 +356,7 @@ in6_ifattach_linklocal(struct ifnet *ifp
}
s = splsoftnet();
- error = rt_ifa_add(&ia6->ia_ifa, RTF_UP|RTF_CLONING|RTF_CONNECTED,
+ error = rt_ifa_add(&ia6->ia_ifa, RTF_CLONING | RTF_CONNECTED,
ia6->ia_ifa.ifa_addr);
if (error) {
in6_purgeaddr(&ia6->ia_ifa);
Index: netinet6/nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.150
diff -u -p -r1.150 nd6.c
--- netinet6/nd6.c 10 Sep 2015 17:52:05 -0000 1.150
+++ netinet6/nd6.c 12 Sep 2015 08:01:30 -0000
@@ -667,7 +667,7 @@ nd6_lookup(struct in6_addr *addr6, int c
* called in rtrequest1 via ifa->ifa_rtrequest.
*/
bzero(&info, sizeof(info));
- info.rti_flags = RTF_UP | RTF_HOST | RTF_LLINFO;
+ info.rti_flags = RTF_HOST | RTF_LLINFO;
info.rti_info[RTAX_DST] = sin6tosa(&sin6);
info.rti_info[RTAX_GATEWAY] =
(struct sockaddr *)ifp->if_sadl;
Index: netinet6/nd6_rtr.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6_rtr.c,v
retrieving revision 1.123
diff -u -p -r1.123 nd6_rtr.c
--- netinet6/nd6_rtr.c 11 Sep 2015 08:17:06 -0000 1.123
+++ netinet6/nd6_rtr.c 12 Sep 2015 08:01:30 -0000
@@ -1723,7 +1723,7 @@ nd6_prefix_onlink(struct nd_prefix *pr)
struct nd_prefix *opr;
struct rtentry *rt;
char addr[INET6_ADDRSTRLEN];
- u_long rtflags;
+ u_long rtflags = 0;
int error;
/* sanity check */
@@ -1788,9 +1788,7 @@ nd6_prefix_onlink(struct nd_prefix *pr)
mask6.sin6_addr = pr->ndpr_mask;
if (nd6_need_cache(ifp))
- rtflags = (RTF_UP | RTF_CLONING | RTF_CONNECTED);
- else
- rtflags = RTF_UP;
+ rtflags = RTF_CLONING | RTF_CONNECTED;
bzero(&info, sizeof(info));
info.rti_flags = rtflags;