Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369214
b: refs/heads/master
c: bea8933
h: refs/heads/master
v: v3
  • Loading branch information
Jason Wang authored and David S. Miller committed Apr 12, 2013
1 parent 77cf583 commit 1ec2b5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6c6779856a294649dbb468ef46e893e80b0d72ad
refs/heads/master: bea893364784582d03494348a91b2c63e0d540d3
22 changes: 8 additions & 14 deletions trunk/drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,6 @@ static int netbk_set_skb_gso(struct xenvif *vif,
static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
{
struct iphdr *iph;
unsigned char *th;
int err = -EPROTO;
int recalculate_partial_csum = 0;

Expand All @@ -1180,28 +1179,26 @@ static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
goto out;

iph = (void *)skb->data;
th = skb->data + 4 * iph->ihl;
if (th >= skb_tail_pointer(skb))
goto out;

skb_set_transport_header(skb, 4 * iph->ihl);
skb->csum_start = th - skb->head;
switch (iph->protocol) {
case IPPROTO_TCP:
skb->csum_offset = offsetof(struct tcphdr, check);
if (!skb_partial_csum_set(skb, 4 * iph->ihl,
offsetof(struct tcphdr, check)))
goto out;

if (recalculate_partial_csum) {
struct tcphdr *tcph = (struct tcphdr *)th;
struct tcphdr *tcph = tcp_hdr(skb);
tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
skb->len - iph->ihl*4,
IPPROTO_TCP, 0);
}
break;
case IPPROTO_UDP:
skb->csum_offset = offsetof(struct udphdr, check);
if (!skb_partial_csum_set(skb, 4 * iph->ihl,
offsetof(struct udphdr, check)))
goto out;

if (recalculate_partial_csum) {
struct udphdr *udph = (struct udphdr *)th;
struct udphdr *udph = udp_hdr(skb);
udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
skb->len - iph->ihl*4,
IPPROTO_UDP, 0);
Expand All @@ -1215,9 +1212,6 @@ static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
goto out;
}

if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
goto out;

err = 0;

out:
Expand Down

0 comments on commit 1ec2b5f

Please sign in to comment.