Skip to content

Commit

Permalink
bridge: multicast: call skb_checksum_{simple_, }validate
Browse files Browse the repository at this point in the history
Let's use these new, neat helpers.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
T-X authored and davem330 committed May 4, 2015
1 parent c19ae86 commit 3c9e4f8
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions net/bridge/br_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,16 +1610,8 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
if (!pskb_may_pull(skb2, sizeof(*ih)))
goto out;

switch (skb2->ip_summed) {
case CHECKSUM_COMPLETE:
if (!csum_fold(skb2->csum))
break;
/* fall through */
case CHECKSUM_NONE:
skb2->csum = 0;
if (skb_checksum_complete(skb2))
goto out;
}
if (skb_checksum_simple_validate(skb2))
goto out;

err = 0;

Expand Down Expand Up @@ -1737,20 +1729,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,

ip6h = ipv6_hdr(skb2);

switch (skb2->ip_summed) {
case CHECKSUM_COMPLETE:
if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, skb2->len,
IPPROTO_ICMPV6, skb2->csum))
break;
/*FALLTHROUGH*/
case CHECKSUM_NONE:
skb2->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr,
&ip6h->daddr,
skb2->len,
IPPROTO_ICMPV6, 0));
if (__skb_checksum_complete(skb2))
goto out;
}
if (skb_checksum_validate(skb2, IPPROTO_ICMPV6, ip6_compute_pseudo))
goto out;

err = 0;

Expand Down

0 comments on commit 3c9e4f8

Please sign in to comment.