git: kernel - network protocol thread routing

Sepherosa Ziehau sepherosa at gmail.com
Thu Sep 9 01:54:37 PDT 2010


On Thu, Sep 9, 2010 at 4:35 PM, Matthew Dillon
<dillon at crater.dragonflybsd.org> wrote:
>
> commit 6a704092ee2b3384906df96bf4b66575a12f38e2
> Author: Matthew Dillon <dillon at apollo.backplane.com>
> Date:   Thu Sep 9 01:32:07 2010 -0700
>
>    kernel - network protocol thread routing
>
>    * ip_input() now calls ip_mport() unconditionally and physically compares
>      the port to &curthread->td_msgport.  If they do not match the packet
>      will be forwarded to the correct protocol thread.
>

@@ -610,7 +625,6 @@ iphack:
                return;
        }
        if (m->m_pkthdr.fw_flags & FW_MBUF_REDISPATCH) {
-               needredispatch = TRUE;
                m->m_pkthdr.fw_flags &= ~FW_MBUF_REDISPATCH;
        }
 pass:
@@ -866,8 +880,6 @@ ours:

                /* Get the header length of the reassembled packet */
                hlen = IP_VHL_HL(ip->ip_vhl) << 2;
-
-               needredispatch = TRUE;
        } else {
                ip->ip_len -= hlen;
        }

I think we still need the 'needredispatch' flag.  e.g. after ip defrag
(fragments are default to netisr0) and NAT.

Following code probably should be put before (port != &curthread->td_msgport):

if (needredispatch) {
    ip->ip_off = htons(ip->ip_off);
    ip->ip_len = htons(ip->ip_len + hlen);

    port = ip_mport_in(&m);
    if (port == NULL)
        return;

    ip = mtod(m, struct ip *);
    ip->ip_len = ntohs(ip->ip_len) - hlen;
    ip->ip_off = ntohs(ip->ip_off);
}

if (port != &curthread->td_msgport) {
    ...
}

Best Regards,
sephe

-- 
Live Free or Die






More information about the Commits mailing list