Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194010
b: refs/heads/master
c: 419f9f8
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Apr 11, 2010
1 parent 7f3fb50 commit 0e9afe5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 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: 871039f02f8ec4ab2e5e9010718caa8e085786f1
refs/heads/master: 419f9f896074ce8b21e88066e6f3515f18e5641c
31 changes: 14 additions & 17 deletions trunk/net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,26 +519,31 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
sock_put(sk);
}

/* This routine computes an IPv4 TCP checksum. */
void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
static void __tcp_v4_send_check(struct sk_buff *skb,
__be32 saddr, __be32 daddr)
{
struct inet_sock *inet = inet_sk(sk);
struct tcphdr *th = tcp_hdr(skb);

if (skb->ip_summed == CHECKSUM_PARTIAL) {
th->check = ~tcp_v4_check(len, inet->inet_saddr,
inet->inet_daddr, 0);
th->check = ~tcp_v4_check(skb->len, saddr, daddr, 0);
skb->csum_start = skb_transport_header(skb) - skb->head;
skb->csum_offset = offsetof(struct tcphdr, check);
} else {
th->check = tcp_v4_check(len, inet->inet_saddr,
inet->inet_daddr,
th->check = tcp_v4_check(skb->len, saddr, daddr,
csum_partial(th,
th->doff << 2,
skb->csum));
}
}

/* This routine computes an IPv4 TCP checksum. */
void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
{
struct inet_sock *inet = inet_sk(sk);

__tcp_v4_send_check(skb, inet->inet_saddr, inet->inet_daddr);
}

int tcp_v4_gso_send_check(struct sk_buff *skb)
{
const struct iphdr *iph;
Expand All @@ -551,10 +556,8 @@ int tcp_v4_gso_send_check(struct sk_buff *skb)
th = tcp_hdr(skb);

th->check = 0;
th->check = ~tcp_v4_check(skb->len, iph->saddr, iph->daddr, 0);
skb->csum_start = skb_transport_header(skb) - skb->head;
skb->csum_offset = offsetof(struct tcphdr, check);
skb->ip_summed = CHECKSUM_PARTIAL;
__tcp_v4_send_check(skb, iph->saddr, iph->daddr);
return 0;
}

Expand Down Expand Up @@ -763,13 +766,7 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
skb = tcp_make_synack(sk, dst, req, rvp);

if (skb) {
struct tcphdr *th = tcp_hdr(skb);

th->check = tcp_v4_check(skb->len,
ireq->loc_addr,
ireq->rmt_addr,
csum_partial(th, skb->len,
skb->csum));
__tcp_v4_send_check(skb, ireq->loc_addr, ireq->rmt_addr);

err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
ireq->rmt_addr,
Expand Down

0 comments on commit 0e9afe5

Please sign in to comment.