network - Fix altq_red
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 5 Oct 2010 00:44:24 +0000 (17:44 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 5 Oct 2010 00:44:24 +0000 (17:44 -0700)
* altq_red was asserting that it could only be called from PF when in fact
  it can also be called via ifq_enqueue().

* Add code to handle the ifq_enqueue path.

Reported-by: Francois Tigeot <ftigeot@wolfpond.org>
sys/net/altq/altq_red.c

index d9f750a..1b70522 100644 (file)
@@ -423,9 +423,15 @@ mark_ecn(struct mbuf *m, struct altq_pktattr *pktattr, int flags)
        void *hdr;
        int  af;
 
-       KKASSERT(m->m_pkthdr.fw_flags & PF_MBUF_STRUCTURE);
-       af = m->m_pkthdr.pf.ecn_af;
-       hdr = m->m_pkthdr.pf.hdr;
+       if (m->m_pkthdr.fw_flags & PF_MBUF_STRUCTURE) {
+               af = m->m_pkthdr.pf.ecn_af;
+               hdr = m->m_pkthdr.pf.hdr;
+       } else if (pktattr) {
+               af = pktattr->pattr_af;
+               hdr = pktattr->pattr_hdr;
+       } else {
+               return (0);
+       }
 
        if (af != AF_INET && af != AF_INET6)
                return (0);