Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Dec 2000 16:48:55 -0600
From:      Jonathan Lemon <jlemon@flugsvamp.com>
To:        freebsd-security@freebsd.org, mouss <usebsd@free.fr>
Subject:   Re: ipfw/dummy: memory leak or what?
Message-ID:  <20001204164855.I56974@prism.flugsvamp.com>

next in thread | raw e-mail | index | archive | help
In <XFMail.001204142832.jhb@FreeBSD.org>, John Baldwin wrote:
>
>         if (m->m_type == MT_DUMMYNET) {
>             rule = (struct ip_fw_chain *)(m->m_data) ;
>             m = m->m_next ;
>             ip = mtod(m, struct ip *);
>             hlen = IP_VHL_HL(ip->ip_vhl) << 2;
>             goto iphack ;
>         } else

This isn't (theoretically) a leak.  Dummynet works by prepending
a private data structure onto the mbuf chain; this structure is 
not an mbuf, and should not be passed to m_freem().

Instead, look at the following fragment of code within
ip_dummynet.c:transmit_event(), which takes care of freeing
the data structure:

        switch (pkt->dn_dir) {

        case DN_TO_IP_IN :
            ip_input((struct mbuf *)pkt) ;
            break ;

        }
        FREE(pkt, M_IPFW);
 

Although this is quite non-obvious, from my point of view.
--
Jonathan


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001204164855.I56974>