diff options
author | 2014-10-14 09:52:25 +0000 | |
---|---|---|
committer | 2014-10-14 09:52:25 +0000 | |
commit | 27ae666c98839b54ee31f46d4088ba4f1bccd084 (patch) | |
tree | d31864036956f5d7a0710856890ab05ec1501154 | |
parent | sync (diff) | |
download | wireguard-openbsd-27ae666c98839b54ee31f46d4088ba4f1bccd084.tar.xz wireguard-openbsd-27ae666c98839b54ee31f46d4088ba4f1bccd084.zip |
Use rtfree() instead of RTFREE(), NULLify some free'd route pointers and
kill the macro.
ok mikeb@, henning@
-rw-r--r-- | sys/net/if_gre.c | 8 | ||||
-rw-r--r-- | sys/net/if_mpe.c | 4 | ||||
-rw-r--r-- | sys/net/pf.c | 10 | ||||
-rw-r--r-- | sys/net/pfkeyv2.c | 4 | ||||
-rw-r--r-- | sys/net/route.c | 13 | ||||
-rw-r--r-- | sys/net/route.h | 9 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 20 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 14 | ||||
-rw-r--r-- | sys/netinet/ip_spd.c | 6 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 8 | ||||
-rw-r--r-- | sys/netinet6/frag6.c | 8 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 18 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 14 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 16 | ||||
-rw-r--r-- | sys/netinet6/ip6_forward.c | 14 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 6 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 14 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 10 | ||||
-rw-r--r-- | sys/netmpls/mpls_input.c | 10 |
21 files changed, 106 insertions, 112 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 7eb3ab496d3..980c7a31462 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.70 2014/07/22 11:06:09 mpi Exp $ */ +/* $OpenBSD: if_gre.c,v 1.71 2014/10/14 09:52:25 mpi Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -519,8 +519,10 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) recompute: if ((sc->g_src.s_addr != INADDR_ANY) && (sc->g_dst.s_addr != INADDR_ANY)) { - if (sc->route.ro_rt != 0) - RTFREE(sc->route.ro_rt); + if (sc->route.ro_rt != NULL) { + rtfree(sc->route.ro_rt); + sc->route.ro_rt = NULL; + } /* ip_output() will do the lookup */ bzero(&sc->route, sizeof(sc->route)); ifp->if_flags |= IFF_UP; diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index d601111c899..0c0dedbd528 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.36 2014/10/07 08:59:50 mpi Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.37 2014/10/14 09:52:25 mpi Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -186,7 +186,7 @@ mpestart(struct ifnet *ifp) sa->sa_family = AF_MPLS; mpls_output(rt->rt_ifp, m, sa, rt); - RTFREE(rt); + rtfree(rt); } } diff --git a/sys/net/pf.c b/sys/net/pf.c index 2050b684f9c..c9c8c8c4d72 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.888 2014/10/08 07:37:01 mpi Exp $ */ +/* $OpenBSD: pf.c,v 1.889 2014/10/14 09:52:25 mpi Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2992,7 +2992,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) if (rt && rt->rt_ifp) { mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr); mss = max(tcp_mssdflt, mss); - RTFREE(rt); + rtfree(rt); } mss = min(mss, offer); mss = max(mss, 64); /* sanity - at least max opt space */ @@ -5467,7 +5467,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, ret = 0; out: if (ro.ro_rt != NULL) - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); return (ret); } @@ -5511,7 +5511,7 @@ pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw, if (ro.ro_rt != NULL) { if (ro.ro_rt->rt_labelid == aw->v.rtlabel) ret = 1; - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); } return (ret); @@ -5688,7 +5688,7 @@ done: if (r->rt != PF_DUPTO) *m = NULL; if (ro == &iproute && ro->ro_rt) - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); return; bad: diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 7197bbcee2d..f3c1154e715 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.134 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.135 2014/10/14 09:52:26 mpi Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -1573,7 +1573,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len) re.re_tableid); if (re.re_rt != NULL) { ipo = ((struct sockaddr_encap *) re.re_rt->rt_gateway)->sen_ipsp; - RTFREE(re.re_rt); + rtfree(re.re_rt); /* Verify that the entry is identical */ if (bcmp(&ipo->ipo_addr, &encapdst, diff --git a/sys/net/route.c b/sys/net/route.c index cf073915238..227dd53810a 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.186 2014/10/08 07:37:02 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.187 2014/10/14 09:52:26 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -368,8 +368,7 @@ rtfree(struct rtentry *rt) { struct ifaddr *ifa; - if (rt == NULL) - panic("rtfree"); + KASSERT(rt != NULL); rt->rt_refcnt--; @@ -788,8 +787,8 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, panic ("rtrequest delete"); if (rt->rt_gwroute) { - rt = rt->rt_gwroute; RTFREE(rt); - (rt = (struct rtentry *)rn)->rt_gwroute = NULL; + rtfree(rt->rt_gwroute); + rt->rt_gwroute = NULL; } if (rt->rt_parent) { @@ -971,7 +970,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, (caddr_t)info->rti_info[RTAX_NETMASK], rnh, rt->rt_nodes, rt->rt_priority); } - RTFREE(crt); + rtfree(crt); } if (rn == 0) { ifafree(ifa); @@ -1028,7 +1027,7 @@ rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate, free(old, M_RTABLE, 0); } if (rt->rt_gwroute != NULL) { - RTFREE(rt->rt_gwroute); + rtfree(rt->rt_gwroute); rt->rt_gwroute = NULL; } if (rt->rt_flags & RTF_GATEWAY) { diff --git a/sys/net/route.h b/sys/net/route.h index ffe30d4fbed..041cfcf37a9 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.98 2014/10/08 07:37:02 mpi Exp $ */ +/* $OpenBSD: route.h,v 1.99 2014/10/14 09:52:26 mpi Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -330,13 +330,6 @@ u_int16_t rtlabel_name2id(char *); struct sockaddr *rtlabel_id2sa(u_int16_t, struct sockaddr_rtlabel *); void rtlabel_unref(u_int16_t); -#define RTFREE(rt) do { \ - if ((rt)->rt_refcnt <= 1) \ - rtfree(rt); \ - else \ - (rt)->rt_refcnt--; \ -} while (/* CONSTCOND */0) - /* * Values for additional argument to rtalloc1() */ diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index f799797cc73..6a6cb1c12bd 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.159 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.160 2014/10/14 09:52:26 mpi Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -742,7 +742,7 @@ in_pcbrtentry(struct inpcb *inp) /* check if route is still valid */ if (ro->ro_rt && (ro->ro_rt->rt_flags & RTF_UP) == 0) { - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); ro->ro_rt = NULL; } @@ -832,7 +832,7 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin, */ if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || (satosin(&ro->ro_dst)->sin_addr.s_addr != sin->sin_addr.s_addr))) { - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); ro->ro_rt = NULL; } if ((ro->ro_rt == NULL || ro->ro_rt->rt_ifp == NULL)) { diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 030cca4de7a..3324b736687 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.237 2014/09/30 08:21:21 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.238 2014/10/14 09:52:26 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -964,8 +964,8 @@ ip_slowtimo(void) } } if (ipforward_rt.ro_rt) { - RTFREE(ipforward_rt.ro_rt); - ipforward_rt.ro_rt = 0; + rtfree(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = NULL; } splx(s); } @@ -1244,8 +1244,8 @@ ip_rtaddr(struct in_addr dst, u_int rtableid) if (ipforward_rt.ro_rt == 0 || dst.s_addr != sin->sin_addr.s_addr) { if (ipforward_rt.ro_rt) { - RTFREE(ipforward_rt.ro_rt); - ipforward_rt.ro_rt = 0; + rtfree(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = NULL; } sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); @@ -1418,12 +1418,12 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt) rtableid = m->m_pkthdr.ph_rtableid; sin = satosin(&ipforward_rt.ro_dst); - if ((rt = ipforward_rt.ro_rt) == 0 || + if ((rt = ipforward_rt.ro_rt) == NULL || ip->ip_dst.s_addr != sin->sin_addr.s_addr || rtableid != ipforward_rt.ro_tableid) { if (ipforward_rt.ro_rt) { - RTFREE(ipforward_rt.ro_rt); - ipforward_rt.ro_rt = 0; + rtfree(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = NULL; } sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); @@ -1560,8 +1560,8 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt) #ifndef SMALL_KERNEL if (ipmultipath && ipforward_rt.ro_rt && (ipforward_rt.ro_rt->rt_flags & RTF_MPATH)) { - RTFREE(ipforward_rt.ro_rt); - ipforward_rt.ro_rt = 0; + rtfree(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = NULL; } #endif return; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 68032bc96d0..8fd2a91f27a 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.268 2014/10/08 07:33:42 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.269 2014/10/14 09:52:26 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -177,8 +177,8 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_addr.s_addr != ip->ip_dst.s_addr || ro->ro_tableid != m->m_pkthdr.ph_rtableid)) { - RTFREE(ro->ro_rt); - ro->ro_rt = (struct rtentry *)0; + rtfree(ro->ro_rt); + ro->ro_rt = NULL; } if (ro->ro_rt == 0) { @@ -328,8 +328,8 @@ reroute: if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_addr.s_addr != ip->ip_dst.s_addr || ro->ro_tableid != m->m_pkthdr.ph_rtableid)) { - RTFREE(ro->ro_rt); - ro->ro_rt = (struct rtentry *)0; + rtfree(ro->ro_rt); + ro->ro_rt = NULL; } if (ro->ro_rt == 0) { @@ -582,7 +582,7 @@ sendit: if (rt != NULL) { rt->rt_rmx.rmx_mtu = icmp_mtu; if (ro && ro->ro_rt != NULL) { - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT, m->m_pkthdr.ph_rtableid); } @@ -717,7 +717,7 @@ sendit: done: if (ro == &iproute && ro->ro_rt) - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); return (error); bad: #ifdef IPSEC diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index 815a175924e..b35a20350d1 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.73 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.74 2014/10/14 09:52:26 mpi Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -260,14 +260,14 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, if ((re->re_rt->rt_gateway == NULL) || (((struct sockaddr_encap *) re->re_rt->rt_gateway)->sen_type != SENT_IPSP)) { - RTFREE(re->re_rt); + rtfree(re->re_rt); *error = EHOSTUNREACH; DPRINTF(("ip_spd_lookup: no gateway in SPD entry!")); return NULL; } ipo = ((struct sockaddr_encap *) (re->re_rt->rt_gateway))->sen_ipsp; - RTFREE(re->re_rt); + rtfree(re->re_rt); if (ipo == NULL) { *error = EHOSTUNREACH; DPRINTF(("ip_spd_lookup: no policy attached to SPD entry!")); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 9f782e3477f..13f8b62be71 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.279 2014/10/08 20:19:58 bluhm Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.280 2014/10/14 09:52:26 mpi Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -3372,8 +3372,10 @@ syn_cache_put(struct syn_cache *sc) { if (sc->sc_ipopts) (void) m_free(sc->sc_ipopts); - if (sc->sc_route4.ro_rt != NULL) - RTFREE(sc->sc_route4.ro_rt); + if (sc->sc_route4.ro_rt != NULL) { + rtfree(sc->sc_route4.ro_rt); + sc->sc_route4.ro_rt = NULL; + } timeout_set(&sc->sc_timer, syn_cache_reaper, sc); timeout_add(&sc->sc_timer, 0); } diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 356b45ad66a..f23534f9b94 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frag6.c,v 1.55 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: frag6.c,v 1.56 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -200,7 +200,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL) dstifp = ifatoia6(ro.ro_rt->rt_ifa)->ia_ifp; if (ro.ro_rt != NULL) { - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); ro.ro_rt = NULL; } #else @@ -673,8 +673,8 @@ frag6_slowtimo(void) * destination and the cache is never replaced. */ if (ip6_forward_rt.ro_rt) { - RTFREE(ip6_forward_rt.ro_rt); - ip6_forward_rt.ro_rt = 0; + rtfree(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = NULL; } splx(s); diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index c43857759d6..6aa29fa05bc 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.148 2014/08/27 14:04:16 florian Exp $ */ +/* $OpenBSD: icmp6.c,v 1.149 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1046,9 +1046,8 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) rt->rt_rmx.rmx_mtu = mtu; } } - if (rt) { /* XXX: need braces to avoid conflict with else in RTFREE. */ - RTFREE(rt); - } + if (rt) + rtfree(rt); /* * Notify protocols that the MTU for this destination @@ -1281,9 +1280,8 @@ icmp6_reflect(struct mbuf *m, size_t off) bzero(&ro, sizeof(ro)); error = in6_selectsrc(&src, &sa6_src, NULL, NULL, &ro, NULL, m->m_pkthdr.ph_rtableid); - if (ro.ro_rt) { /* XXX: see comments in icmp6_mtudisc_update */ - RTFREE(ro.ro_rt); /* XXX: we could use this */ - } + if (ro.ro_rt) + rtfree(ro.ro_rt); /* XXX: we could use this */ if (error) { nd6log((LOG_DEBUG, "icmp6_reflect: source can't be determined: " @@ -1442,7 +1440,7 @@ icmp6_redirect_input(struct mbuf *m, int off) "ICMP6 redirect rejected; no route " "with inet6 gateway found for redirect dst: %s\n", icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); - RTFREE(rt); + rtfree(rt); goto bad; } @@ -1454,7 +1452,7 @@ icmp6_redirect_input(struct mbuf *m, int off) "%s\n", inet_ntop(AF_INET6, gw6, addr, sizeof(addr)), icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); - RTFREE(rt); + rtfree(rt); goto bad; } } else { @@ -1464,7 +1462,7 @@ icmp6_redirect_input(struct mbuf *m, int off) icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); goto bad; } - RTFREE(rt); + rtfree(rt); rt = NULL; } diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 1c6faae9cd1..98ef79db83a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.141 2014/10/07 08:47:28 mpi Exp $ */ +/* $OpenBSD: in6.c,v 1.142 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -878,7 +878,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, if (memcmp(&mltaddr.sin6_addr, &satosin6(rt_key(rt))->sin6_addr, 32 / 8)) { - RTFREE(rt); + rtfree(rt); rt = NULL; } } @@ -897,7 +897,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, if (error) goto cleanup; } else { - RTFREE(rt); + rtfree(rt); } imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error); if (!imm) { @@ -947,7 +947,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, if (memcmp(&mltaddr.sin6_addr, &satosin6(rt_key(rt))->sin6_addr, 32 / 8)) { - RTFREE(rt); + rtfree(rt); rt = NULL; } } @@ -965,7 +965,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, if (error) goto cleanup; } else { - RTFREE(rt); + rtfree(rt); } imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error); if (!imm) { @@ -1620,11 +1620,11 @@ in6_ifpprefix(const struct ifnet *ifp, const struct in6_addr *addr) rt->rt_ifp->if_carpdev != ifp->if_carpdev) && #endif 1)) { - RTFREE(rt); + rtfree(rt); return (0); } - RTFREE(rt); + rtfree(rt); return (1); } diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 85a1153d97a..5fc56b90951 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.46 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: in6_src.c,v 1.47 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -248,8 +248,8 @@ in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock, if (ro) { if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst))) { - RTFREE(ro->ro_rt); - ro->ro_rt = (struct rtentry *)0; + rtfree(ro->ro_rt); + ro->ro_rt = NULL; } if (ro->ro_rt == (struct rtentry *)0 || ro->ro_rt->rt_ifp == (struct ifnet *)0) { @@ -375,7 +375,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, !IN6_ARE_ADDR_EQUAL(&ron->ro_dst.sin6_addr, &sin6_next->sin6_addr)) { if (ron->ro_rt) { - RTFREE(ron->ro_rt); + rtfree(ron->ro_rt); ron->ro_rt = NULL; } ron->ro_dst = *sin6_next; @@ -387,7 +387,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, if (ron->ro_rt == NULL || (ron->ro_rt->rt_flags & RTF_GATEWAY)) { if (ron->ro_rt) { - RTFREE(ron->ro_rt); + rtfree(ron->ro_rt); ron->ro_rt = NULL; } error = EHOSTUNREACH; @@ -395,7 +395,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, } } if (!nd6_is_addr_neighbor(sin6_next, ron->ro_rt->rt_ifp)) { - RTFREE(ron->ro_rt); + rtfree(ron->ro_rt); ron->ro_rt = NULL; error = EHOSTUNREACH; goto done; @@ -421,7 +421,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, (!(ro->ro_rt->rt_flags & RTF_UP) || sin6tosa(&ro->ro_dst)->sa_family != AF_INET6 || !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst))) { - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); ro->ro_rt = NULL; } if (ro->ro_rt == NULL) { @@ -449,7 +449,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, ifp = ro->ro_rt->rt_ifp; if (ifp == NULL) { /* can this really happen? */ - RTFREE(ro->ro_rt); + rtfree(ro->ro_rt); ro->ro_rt = NULL; } } diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 70513db5259..7f45088d854 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_forward.c,v 1.68 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: ip6_forward.c,v 1.69 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */ /* @@ -245,8 +245,8 @@ reroute: (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0 || ip6_forward_rt.ro_tableid != rtableid) { if (ip6_forward_rt.ro_rt) { - RTFREE(ip6_forward_rt.ro_rt); - ip6_forward_rt.ro_rt = 0; + rtfree(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = NULL; } /* this probably fails but give it a try again */ ip6_forward_rt.ro_tableid = rtableid; @@ -271,8 +271,8 @@ reroute: !IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst->sin6_addr) || ip6_forward_rt.ro_tableid != rtableid) { if (ip6_forward_rt.ro_rt) { - RTFREE(ip6_forward_rt.ro_rt); - ip6_forward_rt.ro_rt = 0; + rtfree(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = NULL; } bzero(dst, sizeof(*dst)); dst->sin6_len = sizeof(struct sockaddr_in6); @@ -546,8 +546,8 @@ senderr: #ifndef SMALL_KERNEL if (ip6_multipath && ip6_forward_rt.ro_rt && (ip6_forward_rt.ro_rt->rt_flags & RTF_MPATH)) { - RTFREE(ip6_forward_rt.ro_rt); - ip6_forward_rt.ro_rt = 0; + rtfree(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = NULL; } #endif return; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 14c681791b9..76424275ee3 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.129 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.130 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -439,8 +439,8 @@ ip6_input(struct mbuf *m) if (ip6_forward_rt.ro_rt) { /* route is down or destination is different */ ip6stat.ip6s_forward_cachemiss++; - RTFREE(ip6_forward_rt.ro_rt); - ip6_forward_rt.ro_rt = 0; + rtfree(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = NULL; } bzero(&ip6_forward_rt.ro_dst, sizeof(struct sockaddr_in6)); diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 5b1dce4e0a2..357b9b3ddcb 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.159 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.160 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -958,10 +958,10 @@ reroute: ip6stat.ip6s_fragmented++; done: - if (ro == &ip6route && ro->ro_rt) { /* brace necessary for RTFREE */ - RTFREE(ro->ro_rt); + if (ro == &ip6route && ro->ro_rt) { + rtfree(ro->ro_rt); } else if (ro_pmtu == &ip6route && ro_pmtu->ro_rt) { - RTFREE(ro_pmtu->ro_rt); + rtfree(ro_pmtu->ro_rt); } return (error); @@ -1219,7 +1219,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro, if (ro_pmtu->ro_rt && ((ro_pmtu->ro_rt->rt_flags & RTF_UP) == 0 || !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst))) { - RTFREE(ro_pmtu->ro_rt); + rtfree(ro_pmtu->ro_rt); ro_pmtu->ro_rt = NULL; } if (ro_pmtu->ro_rt == 0) { @@ -2256,7 +2256,7 @@ ip6_clearpktopts(struct ip6_pktopts *pktopt, int optname) pktopt->ip6po_tclass = -1; if (optname == -1 || optname == IPV6_NEXTHOP) { if (pktopt->ip6po_nextroute.ro_rt) { - RTFREE(pktopt->ip6po_nextroute.ro_rt); + rtfree(pktopt->ip6po_nextroute.ro_rt); pktopt->ip6po_nextroute.ro_rt = NULL; } if (pktopt->ip6po_nexthop) @@ -2278,7 +2278,7 @@ ip6_clearpktopts(struct ip6_pktopts *pktopt, int optname) free(pktopt->ip6po_rhinfo.ip6po_rhi_rthdr, M_IP6OPT, 0); pktopt->ip6po_rhinfo.ip6po_rhi_rthdr = NULL; if (pktopt->ip6po_route.ro_rt) { - RTFREE(pktopt->ip6po_route.ro_rt); + rtfree(pktopt->ip6po_route.ro_rt); pktopt->ip6po_route.ro_rt = NULL; } } diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index e2d018fc4c9..4fb5ebd2a25 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.122 2014/08/25 14:00:34 florian Exp $ */ +/* $OpenBSD: nd6.c,v 1.123 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -664,8 +664,8 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp, * interface route. */ if (create) { - RTFREE(rt); - rt = 0; + rtfree(rt); + rt = NULL; } } if (!rt) { diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index c8a3e543c2f..555509dbc16 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.80 2014/07/12 18:44:23 tedu Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.81 2014/10/14 09:52:26 mpi Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -528,13 +528,13 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++; if (ro.ro_rt) { /* we don't cache this route. */ - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); } return; bad: if (ro.ro_rt) { - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); } m_freem(m); return; @@ -1044,13 +1044,13 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]++; if (ro.ro_rt) { /* we don't cache this route. */ - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); } return; bad: if (ro.ro_rt) { - RTFREE(ro.ro_rt); + rtfree(ro.ro_rt); } m_freem(m); return; diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c index 768de856e5e..4a5aba55f3c 100644 --- a/sys/netmpls/mpls_input.c +++ b/sys/netmpls/mpls_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_input.c,v 1.38 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: mpls_input.c,v 1.39 2014/10/14 09:52:26 mpi Exp $ */ /* * Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org> @@ -325,7 +325,7 @@ do_v6: if (ifp != NULL && rt_mpls->mpls_operation != MPLS_OP_LOCAL) break; - RTFREE(rt); + rtfree(rt); rt = NULL; } @@ -355,7 +355,7 @@ do_v6: (*ifp->if_ll_output)(ifp, m, smplstosa(smpls), rt); done: if (rt) - RTFREE(rt); + rtfree(rt); } int @@ -468,12 +468,12 @@ mpls_do_error(struct mbuf *m, int type, int code, int destmtu) * less interface we need to find some other IP to * use as source. */ - RTFREE(rt); + rtfree(rt); m_freem(m); return (NULL); } rt->rt_use++; - RTFREE(rt); + rtfree(rt); if (icmp_reflect(m, NULL, ia)) return (NULL); |