Do all the length checks before returning even if "ip_mthread_enable"
authorJeffrey Hsu <hsu@dragonflybsd.org>
Tue, 23 Mar 2004 22:30:49 +0000 (22:30 +0000)
committerJeffrey Hsu <hsu@dragonflybsd.org>
Tue, 23 Mar 2004 22:30:49 +0000 (22:30 +0000)
is not enabled.

sys/netinet/ip_demux.c

index 588847f..a030770 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 2003 Jeffrey Hsu
  * All rights reserved.
  *
- * $DragonFly: src/sys/netinet/ip_demux.c,v 1.9 2004/03/22 06:38:17 hsu Exp $
+ * $DragonFly: src/sys/netinet/ip_demux.c,v 1.10 2004/03/23 22:30:49 hsu Exp $
  */
 
 #include "opt_inet.h"
@@ -72,9 +72,6 @@ ip_mport(struct mbuf *m)
        lwkt_port_t port;
        int cpu;
 
-       if (ip_mthread_enable == 0)
-               return (&netisr_cpu[0].td_msgport);
-
        if (m->m_pkthdr.len < sizeof(struct ip)) {
                ipstat.ips_tooshort++;
                return (NULL);
@@ -149,6 +146,9 @@ ip_mport(struct mbuf *m)
        }
        KKASSERT(port->mp_putport != NULL);
 
+       if (ip_mthread_enable == 0)
+               return (&netisr_cpu[0].td_msgport);
+
        return (port);
 }