Skip to content

Commit

Permalink
icmp6: Call skb_checksum_validate
Browse files Browse the repository at this point in the history
Use skb_checksum_validate to verify checksum.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tom Herbert authored and David S. Miller committed May 9, 2014
1 parent 29a96e1 commit 39471ac
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,22 +692,11 @@ static int icmpv6_rcv(struct sk_buff *skb)
saddr = &ipv6_hdr(skb)->saddr;
daddr = &ipv6_hdr(skb)->daddr;

/* Perform checksum. */
switch (skb->ip_summed) {
case CHECKSUM_COMPLETE:
if (!csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_ICMPV6,
skb->csum))
break;
/* fall through */
case CHECKSUM_NONE:
skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len,
IPPROTO_ICMPV6, 0));
if (__skb_checksum_complete(skb)) {
LIMIT_NETDEBUG(KERN_DEBUG
"ICMPv6 checksum failed [%pI6c > %pI6c]\n",
saddr, daddr);
goto csum_error;
}
if (skb_checksum_validate(skb, IPPROTO_ICMPV6, ip6_compute_pseudo)) {
LIMIT_NETDEBUG(KERN_DEBUG
"ICMPv6 checksum failed [%pI6c > %pI6c]\n",
saddr, daddr);
goto csum_error;
}

if (!pskb_pull(skb, sizeof(*hdr)))
Expand Down

0 comments on commit 39471ac

Please sign in to comment.