Refactored icmpkick6
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 24 Jun 2014 17:39:27 +0000 (10:39 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 24 Jun 2014 17:39:27 +0000 (10:39 -0700)
Can't test it, but this will get rid of the warnings.  No one has tested any of
the v6 functions yet.

kern/src/net/icmp6.c

index 678f0e3..e85f6b0 100644 (file)
@@ -287,17 +287,23 @@ static void icmpkick6(void *x, struct block *bp)
                ipmove(raddr, bp->rp);
                bp->rp += IPaddrlen;
                bp = padblock(bp, sizeof(struct ip6hdr));
-       }
 
-       if (blocklen(bp) < sizeof(struct IPICMP)) {
-               freeblist(bp);
-               return;
-       }
-       p = (struct IPICMP *)(bp->rp);
-       if (icb->headers == 6) {
+               if (blocklen(bp) < sizeof(struct IPICMP)) {
+                       freeblist(bp);
+                       return;
+               }
+               p = (struct IPICMP *)(bp->rp);
+
                ipmove(p->dst, raddr);
                ipmove(p->src, laddr);
+
        } else {
+               if (blocklen(bp) < sizeof(struct IPICMP)) {
+                       freeblist(bp);
+                       return;
+               }
+               p = (struct IPICMP *)(bp->rp);
+
                ipmove(p->dst, c->raddr);
                ipmove(p->src, c->laddr);
                hnputs(p->icmpid, c->lport);