diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/rtsock.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index b01c6e46d6b..1a94cba0eab 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.28 2003/06/02 23:28:12 millert Exp $ */ +/* $OpenBSD: rtsock.c,v 1.29 2003/06/24 09:09:25 itojun Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -272,6 +272,22 @@ route_output(struct mbuf *m, ...) } rt = (struct rtentry *)rn; rt->rt_refcnt++; + if (rtm->rtm_type != RTM_GET) {/* XXX: too grotty */ + struct radix_node *rn; + extern struct radix_node_head *mask_rnhead; + + if (Bcmp(dst, rt_key(rt), dst->sa_len) != 0) + senderr(ESRCH); + if (netmask && (rn = rn_search(netmask, + mask_rnhead->rnh_treetop))) + netmask = (struct sockaddr *)rn->rn_key; + for (rn = rt->rt_nodes; rn; rn = rn->rn_dupedkey) + if (netmask == (struct sockaddr *)rn->rn_mask) + break; + if (rn == 0) + senderr(ETOOMANYREFS); + rt = (struct rtentry *)rn; + } switch (rtm->rtm_type) { |