summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2014-01-22 06:28:10 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2014-01-22 06:28:10 +0000
commitb006e72e2efed980643ce42730d58f77e91b7c5c (patch)
tree6bc038768ab58057cf33a28d6aaee9e583e2e156 /sys/net
parent368a2ec2c2c87dc09e3d917f566e5c8b6bc65bac (diff)
Remove genmask support from the kernel. rtmsgs with RTA_GENMASK set will
now cause a EINVAL. The RTA_GENMASK and RTAX_GENMASK defines are kept for compatibility reasons. OK benno@ and agreed by dlg@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/route.c5
-rw-r--r--sys/net/route.h3
-rw-r--r--sys/net/rtsock.c27
3 files changed, 7 insertions, 28 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index b024f73c6de..2cf4a792764 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.149 2014/01/10 14:29:08 tedu Exp $ */
+/* $OpenBSD: route.c,v 1.150 2014/01/22 06:28:09 claudio Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -813,8 +813,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
info->rti_flags = rt->rt_flags & ~(RTF_CLONING | RTF_STATIC);
info->rti_flags |= RTF_CLONED;
info->rti_info[RTAX_GATEWAY] = rt->rt_gateway;
- if ((info->rti_info[RTAX_NETMASK] = rt->rt_genmask) == NULL)
- info->rti_flags |= RTF_HOST;
+ info->rti_flags |= RTF_HOST;
info->rti_info[RTAX_LABEL] =
rtlabel_id2sa(rt->rt_labelid, &sa_rl2);
/* FALLTHROUGH */
diff --git a/sys/net/route.h b/sys/net/route.h
index 2007dda702f..38ad42b0eb6 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.85 2014/01/20 22:44:41 claudio Exp $ */
+/* $OpenBSD: route.h,v 1.86 2014/01/22 06:28:09 claudio Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -104,7 +104,6 @@ struct rtentry {
int rt_refcnt; /* # held references */
struct ifnet *rt_ifp; /* the answer: interface to use */
struct ifaddr *rt_ifa; /* the answer: interface addr to use */
- struct sockaddr *rt_genmask; /* for generation of cloned routes */
caddr_t rt_llinfo; /* pointer to link level info cache or
to an MPLS structure */
struct rt_kmetrics rt_rmx; /* metrics used by rx'ing protocols */
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 6cbcc87076e..f1410ee6637 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.136 2014/01/21 10:08:02 mpi Exp $ */
+/* $OpenBSD: rtsock.c,v 1.137 2014/01/22 06:28:09 claudio Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -560,25 +560,11 @@ route_output(struct mbuf *m, ...)
if (info.rti_info[RTAX_DST] == NULL ||
info.rti_info[RTAX_DST]->sa_family >= AF_MAX ||
(info.rti_info[RTAX_GATEWAY] != NULL &&
- info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) {
+ info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX) ||
+ info.rti_info[RTAX_GENMASK] != NULL) {
error = EINVAL;
goto flush;
}
- if (info.rti_info[RTAX_GENMASK] != NULL) {
- struct radix_node *t;
- t = rn_addmask(info.rti_info[RTAX_GENMASK], 0, 1);
- if (t && info.rti_info[RTAX_GENMASK]->sa_len >=
- ((struct sockaddr *)t->rn_key)->sa_len &&
- memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1,
- (caddr_t *)t->rn_key + 1,
- ((struct sockaddr *)t->rn_key)->sa_len) - 1)
- info.rti_info[RTAX_GENMASK] =
- (struct sockaddr *)(t->rn_key);
- else {
- error = ENOBUFS;
- goto flush;
- }
- }
#ifdef MPLS
info.rti_mpls = rtm->rtm_mpls;
#endif
@@ -595,7 +581,6 @@ route_output(struct mbuf *m, ...)
rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx,
&saved_nrt->rt_rmx);
saved_nrt->rt_refcnt--;
- saved_nrt->rt_genmask = info.rti_info[RTAX_GENMASK];
/* write back the priority the kernel used */
rtm->rtm_priority = saved_nrt->rt_priority & RTP_MASK;
rtm->rtm_index = saved_nrt->rt_ifp->if_index;
@@ -701,7 +686,6 @@ report:
info.rti_info[RTAX_DST] = rt_key(rt);
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
- info.rti_info[RTAX_GENMASK] = rt->rt_genmask;
if (rt->rt_labelid) {
bzero(&sa_rt, sizeof(sa_rt));
@@ -868,8 +852,6 @@ report:
rtm->rtm_flags = rt->rt_flags;
if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt);
- if (info.rti_info[RTAX_GENMASK])
- rt->rt_genmask = info.rti_info[RTAX_GENMASK];
if (info.rti_info[RTAX_LABEL] != NULL) {
char *rtlabel = ((struct sockaddr_rtlabel *)
info.rti_info[RTAX_LABEL])->sr_label;
@@ -1059,7 +1041,7 @@ again:
for (i = 0; i < RTAX_MAX; i++) {
struct sockaddr *sa;
- if ((sa = rtinfo->rti_info[i]) == 0)
+ if ((sa = rtinfo->rti_info[i]) == NULL)
continue;
rtinfo->rti_addrs |= (1 << i);
dlen = ROUNDUP(sa->sa_len);
@@ -1280,7 +1262,6 @@ sysctl_dumpentry(struct radix_node *rn, void *v, u_int id)
info.rti_info[RTAX_DST] = rt_key(rt);
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
- info.rti_info[RTAX_GENMASK] = rt->rt_genmask;
if (rt->rt_ifp) {
info.rti_info[RTAX_IFP] =
TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;