diff options
author | obrien <obrien@FreeBSD.org> | 2005-09-07 10:11:49 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2005-09-07 10:11:49 +0000 |
commit | c532dfe7456f7cfd69cc1875646ebbafd781ae5c (patch) | |
tree | a65b15f9016e79eeea392bd977253f6b4fb46d5e /sys/netinet6 | |
parent | b888392910bbf46a7bf35f9715822cfd277e96a9 (diff) | |
download | FreeBSD-src-c532dfe7456f7cfd69cc1875646ebbafd781ae5c.zip FreeBSD-src-c532dfe7456f7cfd69cc1875646ebbafd781ae5c.tar.gz |
IPv6 was improperly defining its malloc type the same as IPv4 (M_IPMADDR,
M_IPMOPTS, M_MRTABLE). Thus we had conflicting instantiations.
Create an IPv6-specific type to overcome this.
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 8 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 2 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 2 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 38 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 16 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 4 |
6 files changed, 35 insertions, 35 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index a5a7d04..fcf7aed 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -99,7 +99,7 @@ #include <net/net_osdep.h> -MALLOC_DEFINE(M_IPMADDR, "in6_multi", "internet multicast address"); +MALLOC_DEFINE(M_IP6MADDR, "in6_multi", "internet multicast address"); /* * Definitions of some costant IP6 addresses. @@ -1614,7 +1614,7 @@ in6_joingroup(ifp, addr, errorp) { struct in6_multi_mship *imm; - imm = malloc(sizeof(*imm), M_IPMADDR, M_NOWAIT); + imm = malloc(sizeof(*imm), M_IP6MADDR, M_NOWAIT); if (!imm) { *errorp = ENOBUFS; return NULL; @@ -1622,7 +1622,7 @@ in6_joingroup(ifp, addr, errorp) imm->i6mm_maddr = in6_addmulti(addr, ifp, errorp); if (!imm->i6mm_maddr) { /* *errorp is alrady set */ - free(imm, M_IPMADDR); + free(imm, M_IP6MADDR); return NULL; } return imm; @@ -1635,7 +1635,7 @@ in6_leavegroup(imm) if (imm->i6mm_maddr) in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + free(imm, M_IP6MADDR); return 0; } diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 5856512..ae89aa3 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -839,7 +839,7 @@ in6_pcbpurgeif0(head, ifp) if (imm->i6mm_maddr->in6m_ifp == ifp) { LIST_REMOVE(imm, i6mm_chain); in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + free(imm, M_IP6MADDR); } } } diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 34f52fd..148fdbd 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -476,7 +476,7 @@ extern struct in6_addr zeroin6_addr; extern u_char inet6ctlerrmap[]; extern unsigned long in6_maxmtu; #ifdef MALLOC_DECLARE -MALLOC_DECLARE(M_IPMADDR); +MALLOC_DECLARE(M_IP6MADDR); #endif /* MALLOC_DECLARE */ /* diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 7a87d8d..e51f08f 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -118,7 +118,7 @@ #include <net/net_osdep.h> -static MALLOC_DEFINE(M_MRTABLE, "mf6c", "multicast forwarding cache entry"); +static MALLOC_DEFINE(M_MRTABLE6, "mf6c", "multicast forwarding cache entry"); #define M_HASCL(m) ((m)->m_flags & M_EXT) @@ -538,12 +538,12 @@ ip6_mrouter_done() struct rtdetq *n = rte->next; m_free(rte->m); - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); rte = n; } frt = rt; rt = rt->mf6c_next; - free(frt, M_MRTABLE); + free(frt, M_MRTABLE6); } } @@ -780,7 +780,7 @@ add_m6fc(mfccp) #ifdef UPCALL_TIMING collate(&(rte->t)); #endif /* UPCALL_TIMING */ - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); rte = n; } rt->mf6c_stall = NULL; @@ -824,7 +824,7 @@ add_m6fc(mfccp) } if (rt == NULL) { /* no upcall, so make a new entry */ - rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE, + rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE6, M_NOWAIT); if (rt == NULL) { splx(s); @@ -923,7 +923,7 @@ del_m6fc(mfccp) } *nptr = rt->mf6c_next; - free(rt, M_MRTABLE); + free(rt, M_MRTABLE6); splx(s); @@ -1048,7 +1048,7 @@ ip6_mforward(ip6, ifp, m) * Allocate mbufs early so that we don't do extra work if we * are just going to fail anyway. */ - rte = (struct rtdetq *)malloc(sizeof(*rte), M_MRTABLE, + rte = (struct rtdetq *)malloc(sizeof(*rte), M_MRTABLE6, M_NOWAIT); if (rte == NULL) { splx(s); @@ -1063,7 +1063,7 @@ ip6_mforward(ip6, ifp, m) (M_HASCL(mb0) || mb0->m_len < sizeof(struct ip6_hdr))) mb0 = m_pullup(mb0, sizeof(struct ip6_hdr)); if (mb0 == NULL) { - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); splx(s); return (ENOBUFS); } @@ -1086,10 +1086,10 @@ ip6_mforward(ip6, ifp, m) #endif /* no upcall, so make a new entry */ - rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE, + rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE6, M_NOWAIT); if (rt == NULL) { - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); m_freem(mb0); splx(s); return (ENOBUFS); @@ -1101,9 +1101,9 @@ ip6_mforward(ip6, ifp, m) mm = m_copy(mb0, 0, sizeof(struct ip6_hdr)); if (mm == NULL) { - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); m_freem(mb0); - free(rt, M_MRTABLE); + free(rt, M_MRTABLE6); splx(s); return (ENOBUFS); } @@ -1131,9 +1131,9 @@ ip6_mforward(ip6, ifp, m) im->im6_mbz = 0; break; default: - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); m_freem(mb0); - free(rt, M_MRTABLE); + free(rt, M_MRTABLE6); splx(s); return (EINVAL); } @@ -1164,9 +1164,9 @@ ip6_mforward(ip6, ifp, m) log(LOG_WARNING, "ip6_mforward: ip6_mrouter " "socket queue full\n"); mrt6stat.mrt6s_upq_sockfull++; - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); m_freem(mb0); - free(rt, M_MRTABLE); + free(rt, M_MRTABLE6); splx(s); return (ENOBUFS); } @@ -1198,7 +1198,7 @@ ip6_mforward(ip6, ifp, m) for (p = &rt->mf6c_stall; *p != NULL; p = &(*p)->next) if (++npkts > MAX_UPQ6) { mrt6stat.mrt6s_upq_ovflw++; - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); m_freem(mb0); splx(s); return (0); @@ -1262,14 +1262,14 @@ expire_upcalls(unused) do { struct rtdetq *n = rte->next; m_freem(rte->m); - free(rte, M_MRTABLE); + free(rte, M_MRTABLE6); rte = n; } while (rte != NULL); mrt6stat.mrt6s_cache_cleanups++; n6expire[i]--; *nptr = mfc->mf6c_next; - free(mfc, M_MRTABLE); + free(mfc, M_MRTABLE6); } else { nptr = &mfc->mf6c_next; } diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 39ea602..5bdef30 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -113,7 +113,7 @@ #include <netinet6/ip6protosw.h> #include <netinet6/scope6_var.h> -static MALLOC_DEFINE(M_IPMOPTS, "ip6_moptions", "internet multicast options"); +static MALLOC_DEFINE(M_IP6MOPTS, "ip6_moptions", "internet multicast options"); struct ip6_exthdrs { struct mbuf *ip6e_ip6; @@ -2595,7 +2595,7 @@ ip6_setmoptions(optname, im6op, m) * allocate one and initialize to default values. */ im6o = (struct ip6_moptions *) - malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK); + malloc(sizeof(*im6o), M_IP6MOPTS, M_WAITOK); if (im6o == NULL) return (ENOBUFS); @@ -2764,14 +2764,14 @@ ip6_setmoptions(optname, im6op, m) * Everything looks good; add a new record to the multicast * address list for the given interface. */ - imm = malloc(sizeof(*imm), M_IPMADDR, M_WAITOK); + imm = malloc(sizeof(*imm), M_IP6MADDR, M_WAITOK); if (imm == NULL) { error = ENOBUFS; break; } if ((imm->i6mm_maddr = in6_addmulti(&mreq->ipv6mr_multiaddr, ifp, &error)) == NULL) { - free(imm, M_IPMADDR); + free(imm, M_IP6MADDR); break; } LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain); @@ -2861,7 +2861,7 @@ ip6_setmoptions(optname, im6op, m) */ LIST_REMOVE(imm, i6mm_chain); in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + free(imm, M_IP6MADDR); break; default: @@ -2876,7 +2876,7 @@ ip6_setmoptions(optname, im6op, m) im6o->im6o_multicast_hlim == ip6_defmcasthlim && im6o->im6o_multicast_loop == IPV6_DEFAULT_MULTICAST_LOOP && im6o->im6o_memberships.lh_first == NULL) { - free(*im6op, M_IPMOPTS); + free(*im6op, M_IP6MOPTS); *im6op = NULL; } @@ -2946,9 +2946,9 @@ ip6_freemoptions(im6o) LIST_REMOVE(imm, i6mm_chain); if (imm->i6mm_maddr) in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + free(imm, M_IP6MADDR); } - free(im6o, M_IPMOPTS); + free(im6o, M_IP6MOPTS); } /* diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 35236da..f5194b7 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -530,7 +530,7 @@ in6_addmulti(maddr6, ifp, errorp) /* XXX - if_addmulti uses M_WAITOK. Can this really be called at interrupt time? If so, need to fix if_addmulti. XXX */ - in6m = (struct in6_multi *)malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT); + in6m = (struct in6_multi *)malloc(sizeof(*in6m), M_IP6MADDR, M_NOWAIT); if (in6m == NULL) { splx(s); return (NULL); @@ -571,7 +571,7 @@ in6_delmulti(in6m) mld6_stop_listening(in6m); ifma->ifma_protospec = NULL; LIST_REMOVE(in6m, in6m_entry); - free(in6m, M_IPMADDR); + free(in6m, M_IP6MADDR); } /* XXX - should be separate API for when we have an ifma? */ if_delmulti(ifma->ifma_ifp, ifma->ifma_addr); |