[TCP]: remove tcp header from tcp_v4_check (take #2)
authorFrederik Deweerdt <frederik.deweerdt@gmail.com>
Mon, 5 Feb 2007 04:15:27 +0000 (20:15 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 8 Feb 2007 20:38:44 +0000 (12:38 -0800)
The tcphdr struct passed to tcp_v4_check is not used, the following
patch removes it from the parameter list.

This adds the netfilter modifications missing in the patch I sent
for rc3-mm1.

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/netfilter/ip_nat_helper.c
net/ipv4/netfilter/ipt_REJECT.c
net/ipv4/netfilter/nf_nat_helper.c
net/ipv4/tcp_ipv4.c

index cd8fa0c858aedfd0a7295a9c9b84130fc8f339e7..5c472f255b770179c51c95aa1d4d982760c0b72c 100644 (file)
@@ -802,9 +802,8 @@ static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
 /*
  * Calculate(/check) TCP checksum
  */
-static inline __sum16 tcp_v4_check(struct tcphdr *th, int len,
-                              __be32 saddr, __be32 daddr,
-                              __wsum base)
+static inline __sum16 tcp_v4_check(int len, __be32 saddr,
+                                  __be32 daddr, __wsum base)
 {
        return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
 }
index ee80feb4b2a986a5fa5526834a50f458f5d23459..2e5c4bc52a60d99f3641a5ffe91fdf3681cad5e6 100644 (file)
@@ -183,7 +183,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb,
        datalen = (*pskb)->len - iph->ihl*4;
        if ((*pskb)->ip_summed != CHECKSUM_PARTIAL) {
                tcph->check = 0;
-               tcph->check = tcp_v4_check(tcph, datalen,
+               tcph->check = tcp_v4_check(datalen,
                                           iph->saddr, iph->daddr,
                                           csum_partial((char *)tcph,
                                                        datalen, 0));
index f0319e5ee437c5cdb8ed13cc3bbad8ec0f596a00..c9cad23844d79cca6b453551f4a891ac7aed0ac7 100644 (file)
@@ -116,7 +116,7 @@ static void send_reset(struct sk_buff *oldskb, int hook)
 
        /* Adjust TCP checksum */
        tcph->check = 0;
-       tcph->check = tcp_v4_check(tcph, sizeof(struct tcphdr),
+       tcph->check = tcp_v4_check(sizeof(struct tcphdr),
                                   nskb->nh.iph->saddr,
                                   nskb->nh.iph->daddr,
                                   csum_partial((char *)tcph,
index 98fbfc84d1830ecc77249dae123b2de86c7ca536..dc6738bdfab786fc5e49208062135c984a249d2d 100644 (file)
@@ -176,7 +176,7 @@ nf_nat_mangle_tcp_packet(struct sk_buff **pskb,
        datalen = (*pskb)->len - iph->ihl*4;
        if ((*pskb)->ip_summed != CHECKSUM_PARTIAL) {
                tcph->check = 0;
-               tcph->check = tcp_v4_check(tcph, datalen,
+               tcph->check = tcp_v4_check(datalen,
                                           iph->saddr, iph->daddr,
                                           csum_partial((char *)tcph,
                                                        datalen, 0));
index 12de90a5047cf214cd4bd1851331ac14851c0783..f061ec50d8bcc81d8de1b0baa0e3b7d1df24d2fd 100644 (file)
@@ -502,11 +502,11 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
        struct tcphdr *th = skb->h.th;
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               th->check = ~tcp_v4_check(th, len,
-                                         inet->saddr, inet->daddr, 0);
+               th->check = ~tcp_v4_check(len, inet->saddr,
+                                         inet->daddr, 0);
                skb->csum_offset = offsetof(struct tcphdr, check);
        } else {
-               th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr,
+               th->check = tcp_v4_check(len, inet->saddr, inet->daddr,
                                         csum_partial((char *)th,
                                                      th->doff << 2,
                                                      skb->csum));
@@ -525,7 +525,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb)
        th = skb->h.th;
 
        th->check = 0;
-       th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0);
+       th->check = ~tcp_v4_check(skb->len, iph->saddr, iph->daddr, 0);
        skb->csum_offset = offsetof(struct tcphdr, check);
        skb->ip_summed = CHECKSUM_PARTIAL;
        return 0;
@@ -747,7 +747,7 @@ static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req,
        if (skb) {
                struct tcphdr *th = skb->h.th;
 
-               th->check = tcp_v4_check(th, skb->len,
+               th->check = tcp_v4_check(skb->len,
                                         ireq->loc_addr,
                                         ireq->rmt_addr,
                                         csum_partial((char *)th, skb->len,
@@ -1514,7 +1514,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
 static __sum16 tcp_v4_checksum_init(struct sk_buff *skb)
 {
        if (skb->ip_summed == CHECKSUM_COMPLETE) {
-               if (!tcp_v4_check(skb->h.th, skb->len, skb->nh.iph->saddr,
+               if (!tcp_v4_check(skb->len, skb->nh.iph->saddr,
                                  skb->nh.iph->daddr, skb->csum)) {
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                        return 0;