Fixes loopback checksums
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 26 Nov 2014 00:14:15 +0000 (16:14 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 2 Dec 2014 22:57:07 +0000 (14:57 -0800)
The packet checksum finalization wasn't being performed for loopbacks,
preventing us from making any loopback connections.

kern/drivers/dev/ether.c

index af71126..b7641c1 100644 (file)
@@ -367,6 +367,7 @@ static int etheroq(struct ether *ether, struct block *bp)
 
        if (!(ether->netif.feat & NETF_SG))
                bp = linearizeblock(bp);
+       ptclcsum_finalize(bp, ether->netif.feat);
        /*
         * Check if the packet has to be placed back onto the input queue,
         * i.e. if it's a loopback or broadcast packet or the interface is
@@ -399,7 +400,6 @@ static int etheroq(struct ether *ether, struct block *bp)
                if ((ether->netif.feat & NETF_PADMIN) == 0 && BLEN(bp) < ether->minmtu)
                        bp = adjustblock(bp, ether->minmtu);
 
-               ptclcsum_finalize(bp, ether->netif.feat);
                qbwrite(ether->oq, bp);
                if (ether->transmit != NULL)
                        ether->transmit(ether);