summaryrefslogtreecommitdiffstats
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorqingli <qingli@FreeBSD.org>2013-06-25 00:10:49 +0000
committerqingli <qingli@FreeBSD.org>2013-06-25 00:10:49 +0000
commit2160365ab5c063efe55ccfd0d3879669e3f26170 (patch)
tree7aa10a9ada51cdb348b341252da27d8c72eb1c13 /sys/net/rtsock.c
parentac847054f7eaa1e775d5102eace816afbbf9daae (diff)
downloadFreeBSD-src-2160365ab5c063efe55ccfd0d3879669e3f26170.zip
FreeBSD-src-2160365ab5c063efe55ccfd0d3879669e3f26170.tar.gz
Due to the routing related networking kernel redesign work
in FBSD 8.0, interface routes have been returened to the applications without the RTF_GATEWAY bit. This incompatibility has caused some issues with Zebra, Qugga and the like. This patch provides the RTF_GATEWAY flag bit in returned interface routes so to behave similarly to pre 8.0 systems. Reviewed by: hrs Verified by: mackn at opendns dot com
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index c3781d5..d665280 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -652,8 +652,10 @@ route_output(struct mbuf *m, struct socket *so)
*/
if (gw_ro.ro_rt != NULL &&
gw_ro.ro_rt->rt_gateway->sa_family == AF_LINK &&
- gw_ro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK)
+ gw_ro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) {
info.rti_flags &= ~RTF_GATEWAY;
+ info.rti_flags |= RTF_GWFLAG_COMPAT;
+ }
if (gw_ro.ro_rt != NULL)
RTFREE(gw_ro.ro_rt);
}
@@ -853,7 +855,11 @@ route_output(struct mbuf *m, struct socket *so)
Free(rtm); rtm = new_rtm;
}
(void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, NULL);
- rtm->rtm_flags = rt->rt_flags;
+ if (rt->rt_flags & RTF_GWFLAG_COMPAT)
+ rtm->rtm_flags = RTF_GATEWAY |
+ (rt->rt_flags & ~RTF_GWFLAG_COMPAT);
+ else
+ rtm->rtm_flags = rt->rt_flags;
rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx);
rtm->rtm_addrs = info.rti_addrs;
break;
@@ -905,6 +911,7 @@ route_output(struct mbuf *m, struct socket *so)
RT_UNLOCK(rt);
senderr(error);
}
+ rt->rt_flags &= ~RTF_GATEWAY;
rt->rt_flags |= (RTF_GATEWAY & info.rti_flags);
}
if (info.rti_ifa != NULL &&
@@ -1591,7 +1598,11 @@ sysctl_dumpentry(struct radix_node *rn, void *vw)
if (w->w_req && w->w_tmem) {
struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem;
- rtm->rtm_flags = rt->rt_flags;
+ if (rt->rt_flags & RTF_GWFLAG_COMPAT)
+ rtm->rtm_flags = RTF_GATEWAY |
+ (rt->rt_flags & ~RTF_GWFLAG_COMPAT);
+ else
+ rtm->rtm_flags = rt->rt_flags;
/*
* let's be honest about this being a retarded hack
*/
OpenPOWER on IntegriCloud