[TCP]: Remove dead code in init_sequence
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Fri, 10 Nov 2006 22:06:49 +0000 (14:06 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:10 +0000 (21:22 -0800)
This removes two redundancies:

1) The test (skb->protocol == htons(ETH_P_IPV6) in tcp_v6_init_sequence()
   is always true, due to
* tcp_v6_conn_request() is the only function calling this one
* tcp_v6_conn_request() redirects all skb's with ETH_P_IP protocol to
  tcp_v4_conn_request() [ cf. top of tcp_v6_conn_request()]

2) The first argument, `struct sock *sk' of tcp_v{4,6}_init_sequence() is
   never used.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c

index 5fbf96552cac9ced5d12b05805edd0e88541e591..2eb58844403c81689807881c518c32a9cd333714 100644 (file)
@@ -111,7 +111,7 @@ void tcp_unhash(struct sock *sk)
        inet_unhash(&tcp_hashinfo, sk);
 }
 
-static inline __u32 tcp_v4_init_sequence(struct sock *sk, struct sk_buff *skb)
+static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb)
 {
        return secure_tcp_sequence_number(skb->nh.iph->daddr,
                                          skb->nh.iph->saddr,
@@ -859,7 +859,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                        goto drop_and_free;
                }
 
-               isn = tcp_v4_init_sequence(sk, skb);
+               isn = tcp_v4_init_sequence(skb);
        }
        tcp_rsk(req)->snt_isn = isn;
 
index 06b536b47f97b2df4aa1326a1163f9ed96ade1dd..9a8e690fdf7caee38f1489f846b1a421a1acc3f9 100644 (file)
@@ -106,19 +106,12 @@ static __inline__ u16 tcp_v6_check(struct tcphdr *th, int len,
        return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
 }
 
-static __u32 tcp_v6_init_sequence(struct sock *sk, struct sk_buff *skb)
+static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
 {
-       if (skb->protocol == htons(ETH_P_IPV6)) {
-               return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
-                                                   skb->nh.ipv6h->saddr.s6_addr32,
-                                                   skb->h.th->dest,
-                                                   skb->h.th->source);
-       } else {
-               return secure_tcp_sequence_number(skb->nh.iph->daddr,
-                                                 skb->nh.iph->saddr,
-                                                 skb->h.th->dest,
-                                                 skb->h.th->source);
-       }
+       return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
+                                           skb->nh.ipv6h->saddr.s6_addr32,
+                                           skb->h.th->dest,
+                                           skb->h.th->source);
 }
 
 static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, 
@@ -822,7 +815,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
                treq->iif = inet6_iif(skb);
 
        if (isn == 0) 
-               isn = tcp_v6_init_sequence(sk,skb);
+               isn = tcp_v6_init_sequence(skb);
 
        tcp_rsk(req)->snt_isn = isn;