]> err.no Git - linux-2.6/commitdiff
[DCCP]: Remove redundant statements in init_sequence (ISS)
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Mon, 13 Nov 2006 15:31:50 +0000 (13:31 -0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:21 +0000 (21:22 -0800)
This patch removes the following redundancies:

 1) The test skb->protocol == htons(ETH_P_IPV6) in dccp_v6_init_sequence
    is always true since
     * dccp_v6_conn_request() is the only calling function
     * dccp_v6_conn_request() redirects all skb's with ETH_P_IP to
       dccp_v4_conn_request()

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

(This is similar for tcp_v{4,6}_init_sequence, an analogous patch has been
 submitted to netdev and merged.)

By the way - are the `sport' / `dport' arguments in the right order?
I have made them consistent among calls but they seem to be in the
reverse order.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/dccp/ipv4.c
net/dccp/ipv6.c

index 84c05405984ec4b647e34c36fe1caf23cf6f4754..b56a2fa2694a9cfd965665e84616d3015feb8fd7 100644 (file)
@@ -366,8 +366,7 @@ void dccp_v4_send_check(struct sock *sk, int unused, struct sk_buff *skb)
 
 EXPORT_SYMBOL_GPL(dccp_v4_send_check);
 
-static inline u64 dccp_v4_init_sequence(const struct sock *sk,
-                                       const struct sk_buff *skb)
+static inline u64 dccp_v4_init_sequence(const struct sk_buff *skb)
 {
        return secure_dccp_sequence_number(skb->nh.iph->daddr,
                                           skb->nh.iph->saddr,
@@ -663,7 +662,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
         */
        dreq = dccp_rsk(req);
        dreq->dreq_isr     = dcb->dccpd_seq;
-       dreq->dreq_iss     = dccp_v4_init_sequence(sk, skb);
+       dreq->dreq_iss     = dccp_v4_init_sequence(skb);
        dreq->dreq_service = service;
 
        if (dccp_v4_send_response(sk, req, NULL))
index 193b946fd039587d936da2c4bb45feb43d0f6f38..a08af75ddc9ee0c4a8e07632e20b52b0dee62b7b 100644 (file)
@@ -76,20 +76,12 @@ static inline void dccp_v6_send_check(struct sock *sk, int unused_value,
        dh->dccph_checksum = dccp_v6_csum_finish(skb, &np->saddr, &np->daddr);
 }
 
-static __u32 dccp_v6_init_sequence(struct sock *sk, struct sk_buff *skb)
+static inline __u32 dccp_v6_init_sequence(const struct sk_buff *skb)
 {
-       const struct dccp_hdr *dh = dccp_hdr(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,
-                                                   dh->dccph_dport,
-                                                   dh->dccph_sport);
-
-       return secure_dccp_sequence_number(skb->nh.iph->daddr,
-                                          skb->nh.iph->saddr,
-                                          dh->dccph_dport,
-                                          dh->dccph_sport);
+       return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
+                                           skb->nh.ipv6h->saddr.s6_addr32,
+                                           dccp_hdr(skb)->dccph_dport,
+                                           dccp_hdr(skb)->dccph_sport     );
 }
 
 static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
@@ -491,7 +483,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
         */
        dreq = dccp_rsk(req);
        dreq->dreq_isr     = dcb->dccpd_seq;
-       dreq->dreq_iss     = dccp_v6_init_sequence(sk, skb);
+       dreq->dreq_iss     = dccp_v6_init_sequence(skb);
        dreq->dreq_service = service;
 
        if (dccp_v6_send_response(sk, req, NULL))