-/* $OpenBSD: frag6.c,v 1.67 2016/03/07 18:44:00 naddy Exp $ */
+/* $OpenBSD: frag6.c,v 1.68 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
/* dequeue the fragment. */
LIST_REMOVE(af6, ip6af_list);
- free(af6, M_FTABLE, 0);
+ free(af6, M_FTABLE, sizeof(*af6));
/* adjust pointer. */
ip6err = mtod(merr, struct ip6_hdr *);
ecn0 = (ntohl(af6->ip6af_flow) >> 20) & IPTOS_ECN_MASK;
if (ecn == IPTOS_ECN_CE) {
if (ecn0 == IPTOS_ECN_NOTECT) {
- free(ip6af, M_FTABLE, 0);
+ free(ip6af, M_FTABLE, sizeof(*ip6af));
goto dropfrag;
}
if (ecn0 != IPTOS_ECN_CE)
af6->ip6af_flow |= htonl(IPTOS_ECN_CE << 20);
}
if (ecn == IPTOS_ECN_NOTECT && ecn0 != IPTOS_ECN_NOTECT) {
- free(ip6af, M_FTABLE, 0);
+ free(ip6af, M_FTABLE, sizeof(*ip6af));
goto dropfrag;
}
i,
inet_ntop(AF_INET6, &q6->ip6q_src, ip, sizeof(ip)));
#endif
- free(ip6af, M_FTABLE, 0);
+ free(ip6af, M_FTABLE, sizeof(*ip6af));
goto flushfrags;
}
}
i,
inet_ntop(AF_INET6, &q6->ip6q_src, ip, sizeof(ip)));
#endif
- free(ip6af, M_FTABLE, 0);
+ free(ip6af, M_FTABLE, sizeof(*ip6af));
goto flushfrags;
}
}
t = t->m_next;
t->m_next = IP6_REASS_MBUF(af6);
m_adj(t->m_next, af6->ip6af_offset);
- free(af6, M_FTABLE, 0);
+ free(af6, M_FTABLE, sizeof(*af6));
}
/* adjust offset to point where the original next header starts */
offset = ip6af->ip6af_offset - sizeof(struct ip6_frag);
- free(ip6af, M_FTABLE, 0);
+ free(ip6af, M_FTABLE, sizeof(*ip6af));
ip6 = mtod(m, struct ip6_hdr *);
ip6->ip6_plen = htons((u_short)next + offset - sizeof(struct ip6_hdr));
ip6->ip6_src = q6->ip6q_src;
if (frag6_deletefraghdr(m, offset) != 0) {
TAILQ_REMOVE(&frag6_queue, q6, ip6q_queue);
frag6_nfrags -= q6->ip6q_nfrag;
- free(q6, M_FTABLE, 0);
+ free(q6, M_FTABLE, sizeof(*q6));
frag6_nfragpackets--;
goto dropfrag;
}
TAILQ_REMOVE(&frag6_queue, q6, ip6q_queue);
frag6_nfrags -= q6->ip6q_nfrag;
- free(q6, M_FTABLE, 0);
+ free(q6, M_FTABLE, sizeof(*q6));
frag6_nfragpackets--;
if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */
while ((af6 = LIST_FIRST(&q6->ip6q_asfrag)) != NULL) {
LIST_REMOVE(af6, ip6af_list);
m_freem(IP6_REASS_MBUF(af6));
- free(af6, M_FTABLE, 0);
+ free(af6, M_FTABLE, sizeof(*af6));
}
ip6stat.ip6s_fragdropped += q6->ip6q_nfrag;
TAILQ_REMOVE(&frag6_queue, q6, ip6q_queue);
frag6_nfrags -= q6->ip6q_nfrag;
- free(q6, M_FTABLE, 0);
+ free(q6, M_FTABLE, sizeof(*q6));
frag6_nfragpackets--;
dropfrag:
ICMP6_TIME_EXCEED_REASSEMBLY, 0);
} else
m_freem(m);
- free(af6, M_FTABLE, 0);
+ free(af6, M_FTABLE, sizeof(*af6));
}
TAILQ_REMOVE(&frag6_queue, q6, ip6q_queue);
frag6_nfrags -= q6->ip6q_nfrag;
- free(q6, M_FTABLE, 0);
+ free(q6, M_FTABLE, sizeof(*q6));
frag6_nfragpackets--;
}
-/* $OpenBSD: in6.c,v 1.190 2016/08/08 13:09:36 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.191 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
struct in6_ifextra *ext = (struct in6_ifextra *)aux;
nd6_ifdetach(ext->nd_ifinfo);
- free(ext, M_IFADDR, 0);
+ free(ext, M_IFADDR, sizeof(*ext));
}
-/* $OpenBSD: ip6_output.c,v 1.211 2016/07/01 18:18:57 jca Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.212 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
* Only turning off any previous options, regardless of
* whether the opt is just created or given.
*/
- free(opt, M_IP6OPT, 0);
+ free(opt, M_IP6OPT, sizeof(*opt));
return (0);
}
if ((error = ip6_setpktopts(m, opt, NULL, priv,
so->so_proto->pr_protocol)) != 0) {
ip6_clearpktopts(opt, -1); /* XXX discard all options */
- free(opt, M_IP6OPT, 0);
+ free(opt, M_IP6OPT, sizeof(*opt));
return (error);
}
*pktopt = opt;
-/* $OpenBSD: nd6.c,v 1.188 2016/07/13 08:40:46 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.189 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
nd6_ifdetach(struct nd_ifinfo *nd)
{
- free(nd, M_IP6NDP, 0);
+ free(nd, M_IP6NDP, sizeof(*nd));
}
void
ol = oldlenp ? *oldlenp : 0;
if (oldp) {
- p = malloc(*oldlenp, M_TEMP, M_WAITOK | M_CANFAIL);
+ p = malloc(ol, M_TEMP, M_WAITOK | M_CANFAIL);
if (!p)
return ENOMEM;
} else
error = ENOPROTOOPT;
break;
}
- if (p)
- free(p, M_TEMP, 0);
+ free(p, M_TEMP, ol);
return (error);
}
-/* $OpenBSD: nd6_nbr.c,v 1.108 2016/08/04 20:46:24 vgross Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.109 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
nd6_dad_stoptimer(dp);
TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list);
- free(dp, M_IP6NDP, 0);
+ free(dp, M_IP6NDP, sizeof(*dp));
dp = NULL;
ifafree(ifa);
ip6_dad_pending--;
ifa->ifa_ifp->if_xname));
TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list);
- free(dp, M_IP6NDP, 0);
+ free(dp, M_IP6NDP, sizeof(*dp));
dp = NULL;
ifafree(ifa);
ip6_dad_pending--;
addr, sizeof(addr))));
TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list);
- free(dp, M_IP6NDP, 0);
+ free(dp, M_IP6NDP, sizeof(*dp));
dp = NULL;
ifafree(ifa);
ip6_dad_pending--;
TAILQ_REMOVE(&dadq, dp, dad_list);
ifafree(dp->dad_ifa);
- free(dp, M_IP6NDP, 0);
+ free(dp, M_IP6NDP, sizeof(*dp));
ip6_dad_pending--;
}
-/* $OpenBSD: nd6_rtr.c,v 1.140 2016/07/05 10:17:14 mpi Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.141 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
dr->ifp->if_xname);
}
- free(dr, M_IP6NDP, 0);
+ free(dr, M_IP6NDP, sizeof(*dr));
}
/*
pfxrtr_del(struct nd_pfxrouter *pfr)
{
LIST_REMOVE(pfr, pfr_entry);
- free(pfr, M_IP6NDP, 0);
+ free(pfr, M_IP6NDP, sizeof(*pfr));
}
struct nd_prefix *
/* free list of routers that adversed the prefix */
LIST_FOREACH_SAFE(pfr, &pr->ndpr_advrtrs, pfr_entry, next)
- free(pfr, M_IP6NDP, 0);
+ free(pfr, M_IP6NDP, sizeof(*pfr));
ext->nprefixes--;
if (ext->nprefixes < 0) {
pr->ndpr_ifp->if_xname);
}
- free(pr, M_IP6NDP, 0);
+ free(pr, M_IP6NDP, sizeof(*pr));
pfxlist_onlink_check();
splx(s);
-/* $OpenBSD: raw_ip6.c,v 1.94 2016/08/04 20:46:24 vgross Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.95 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
if (so == ip6_mrouter)
ip6_mrouter_done();
#endif
- if (in6p->inp_icmp6filt) {
- free(in6p->inp_icmp6filt, M_PCB, 0);
- in6p->inp_icmp6filt = NULL;
- }
+ free(in6p->inp_icmp6filt, M_PCB, sizeof(struct icmp6_filter));
+ in6p->inp_icmp6filt = NULL;
+
in_pcbdetach(in6p);
break;