diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-10-25 15:24:04 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-10-25 15:24:04 +0000 |
commit | 054a2e192246eb601ef0869f3da1c0ef5ebc88c7 (patch) | |
tree | c6d74420db01d105738619fe56843f4c48022e35 /sys/net | |
parent | a62211d9649075e39d1181355ef73b969f0c9faf (diff) |
Simple sizes for free(9).
ok claudio@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 5d0d707913a..7fa49885452 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.263 2015/10/25 14:48:51 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.264 2015/10/25 15:24:03 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -369,11 +369,11 @@ rtfree(struct rtentry *rt) rtlabel_unref(rt->rt_labelid); #ifdef MPLS if (rt->rt_flags & RTF_MPLS) - free(rt->rt_llinfo, M_TEMP, 0); + free(rt->rt_llinfo, M_TEMP, sizeof(struct rt_mpls)); #endif if (rt->rt_gateway) free(rt->rt_gateway, M_RTABLE, 0); - free(rt_key(rt), M_RTABLE, 0); + free(rt_key(rt), M_RTABLE, rt_key(rt)->sa_len); KERNEL_UNLOCK(); pool_put(&rtentry_pool, rt); @@ -733,27 +733,12 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, switch (req) { case RTM_DELETE: rt = rtable_lookup(tableid, info->rti_info[RTAX_DST], - info->rti_info[RTAX_NETMASK]); - if (rt == NULL) - return (ESRCH); -#ifndef SMALL_KERNEL - rt = rtable_mpath_match(tableid, rt, - info->rti_info[RTAX_GATEWAY], prio); + info->rti_info[RTAX_NETMASK], info->rti_info[RTAX_GATEWAY], + prio ); if (rt == NULL) return (ESRCH); /* - * If we got multipath routes, we require users to specify - * a matching gateway. - */ - if ((rt->rt_flags & RTF_MPATH) && - info->rti_info[RTAX_GATEWAY] == NULL) { - rtfree(rt); - return (ESRCH); - } -#endif - - /* * Since RTP_LOCAL cannot be set by userland, make * sure that local routes are only modified by the * kernel. @@ -1386,7 +1371,7 @@ rt_timer_queue_destroy(struct rttimer_queue *rtq) } LIST_REMOVE(rtq, rtq_link); - free(rtq, M_RTABLE, 0); + free(rtq, M_RTABLE, sizeof(*rtq)); } unsigned long @@ -1572,7 +1557,7 @@ rtlabel_unref(u_int16_t id) if (id == p->rtl_id) { if (--p->rtl_ref == 0) { TAILQ_REMOVE(&rt_labels, p, rtl_entry); - free(p, M_TEMP, 0); + free(p, M_TEMP, sizeof(*p)); } break; } |