diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-05-09 15:48:16 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-05-09 15:48:16 +0000 |
commit | e2ba8b745514265f25b0060fb1e692dca7f05475 (patch) | |
tree | 7871ba0cdf4da912a55a7a93b812744c0b6f7ccf | |
parent | 7feb1ee395340d36c066ad3ba49948799a9d3614 (diff) |
replace rtrequest() with corresponding rtrequest1() replacement.
OK henning@
-rw-r--r-- | sys/net/pfkeyv2.c | 19 | ||||
-rw-r--r-- | sys/net/route.c | 24 |
2 files changed, 27 insertions, 16 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index e5e6bbf559a..3b666a9ed68 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.118 2007/11/24 12:59:28 jmc Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.119 2008/05/09 15:48:15 claudio Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -1723,12 +1723,17 @@ pfkeyv2_send(struct socket *socket, void *message, int len) /* Flow type */ if (!exists) { /* Add SPD entry */ - if ((rval = rtrequest(RTM_ADD, - (struct sockaddr *) &encapdst, - (struct sockaddr *) &encapgw, - (struct sockaddr *) &encapnetmask, - RTF_UP | RTF_GATEWAY | RTF_STATIC, - (struct rtentry **) 0, 0)) != 0) { + struct rt_addrinfo info; + + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = (struct sockaddr *)&encapdst; + info.rti_info[RTAX_GATEWAY] = + (struct sockaddr *)&encapgw; + info.rti_info[RTAX_NETMASK] = + (struct sockaddr *)&encapnetmask; + info.rti_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; + if ((rval = rtrequest1(RTM_ADD, &info, RTP_DEFAULT, + NULL, 0)) != 0) { /* Remove from linked list of policies on TDB */ if (ipo->ipo_tdb) TAILQ_REMOVE(&ipo->ipo_tdb->tdb_policy_head, diff --git a/sys/net/route.c b/sys/net/route.c index 1ee1d81b842..280bbfa0215 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.91 2008/05/09 07:33:13 henning Exp $ */ +/* $OpenBSD: route.c,v 1.92 2008/05/09 15:48:15 claudio Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -281,13 +281,16 @@ rtalloc2(struct sockaddr *dst, int report, int howstrict) struct rt_addrinfo info; int s = splnet(), err = 0, msgtype = RTM_MISS; + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = dst; + rnh = rt_gettable(dst->sa_family, 0); if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && ((rn->rn_flags & RNF_ROOT) == 0)) { newrt = rt = (struct rtentry *)rn; if (report && (rt->rt_flags & RTF_CLONING) && okaytoclone(rt->rt_flags, howstrict)) { - err = rtrequest(RTM_RESOLVE, dst, SA(0), SA(0), 0, + err = rtrequest1(RTM_RESOLVE, &info, RTP_DEFAULT, &newrt, 0); if (err) { newrt = rt; @@ -304,8 +307,6 @@ rtalloc2(struct sockaddr *dst, int report, int howstrict) rtstat.rts_unreach++; miss: if (report) { - bzero((caddr_t)&info, sizeof(info)); - info.rti_info[RTAX_DST] = dst; rt_missmsg(msgtype, &info, 0, NULL, err, 0); } } @@ -335,13 +336,16 @@ rtalloc1(struct sockaddr *dst, int report, u_int tableid) struct rt_addrinfo info; int s = splsoftnet(), err = 0, msgtype = RTM_MISS; + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = dst; + rnh = rt_gettable(dst->sa_family, tableid); if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && ((rn->rn_flags & RNF_ROOT) == 0)) { newrt = rt = (struct rtentry *)rn; if (report && (rt->rt_flags & RTF_CLONING)) { - err = rtrequest(RTM_RESOLVE, dst, SA(NULL), - SA(NULL), 0, &newrt, tableid); + err = rtrequest1(RTM_RESOLVE, &info, RTP_DEFAULT, + &newrt, tableid); if (err) { newrt = rt; rt->rt_refcnt++; @@ -1092,9 +1096,11 @@ static int rt_init_done = 0; if (r->rtt_func != NULL) { \ (*r->rtt_func)(r->rtt_rt, r); \ } else { \ - rtrequest((int) RTM_DELETE, \ - (struct sockaddr *)rt_key(r->rtt_rt), \ - 0, 0, 0, 0, 0); \ + struct rt_addrinfo info; \ + bzero(&info, sizeof(info)); \ + info.rti_info[RTAX_DST] = rt_key(r->rtt_rt); \ + rtrequest1(RTM_DELETE, &info, \ + r->rtt_rt->rt_priority, NULL, 0 /* XXX */); \ } \ } |