Removing queue length check in ip_output (was Re: buf_ring in HEAD is racy)

Adrian Chadd adrian at freebsd.org
Wed Dec 18 21:04:45 UTC 2013


How about we can this check in ip_output():

        /*
         * Verify that we have any chance at all of being able to queue the
         * packet or packet fragments, unless ALTQ is enabled on the given
         * interface in which case packetdrop should be done by queueing.
         */
        n = ip_len / mtu + 1; /* how many fragments ? */
        if (
#ifdef ALTQ
            (!ALTQ_IS_ENABLED(&ifp->if_snd)) &&
#endif /* ALTQ */
            (ifp->if_snd.ifq_len + n) >= ifp->if_snd.ifq_maxlen ) {
                error = ENOBUFS;
                IPSTAT_INC(ips_odropped);
                ifp->if_snd.ifq_drops += n;
                goto bad;
        }

.. it's totally bogus in an if_transmit / SMP world. There's no
locking and there's no guarantee that there will be headroom in the
queue between this point and the later call to the if_output() method.



-adrian


More information about the freebsd-net mailing list