aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2006-11-13 10:31:50 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:22:21 -0500
commit865e9022d88ceedd89fa1079a6e1f9266ccd3711 (patch)
treebc276752f832226f9a506f1fe65bff000bea557e
parent4ed800d02cfb639b4f8375a0f0f04f0efea64e7f (diff)
[DCCP]: Remove redundant statements in init_sequence (ISS)
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>
-rw-r--r--net/dccp/ipv4.c5
-rw-r--r--net/dccp/ipv6.c20
2 files changed, 8 insertions, 17 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 84c05405984e..b56a2fa2694a 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -366,8 +366,7 @@ void dccp_v4_send_check(struct sock *sk, int unused, struct sk_buff *skb)
366 366
367EXPORT_SYMBOL_GPL(dccp_v4_send_check); 367EXPORT_SYMBOL_GPL(dccp_v4_send_check);
368 368
369static inline u64 dccp_v4_init_sequence(const struct sock *sk, 369static inline u64 dccp_v4_init_sequence(const struct sk_buff *skb)
370 const struct sk_buff *skb)
371{ 370{
372 return secure_dccp_sequence_number(skb->nh.iph->daddr, 371 return secure_dccp_sequence_number(skb->nh.iph->daddr,
373 skb->nh.iph->saddr, 372 skb->nh.iph->saddr,
@@ -663,7 +662,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
663 */ 662 */
664 dreq = dccp_rsk(req); 663 dreq = dccp_rsk(req);
665 dreq->dreq_isr = dcb->dccpd_seq; 664 dreq->dreq_isr = dcb->dccpd_seq;
666 dreq->dreq_iss = dccp_v4_init_sequence(sk, skb); 665 dreq->dreq_iss = dccp_v4_init_sequence(skb);
667 dreq->dreq_service = service; 666 dreq->dreq_service = service;
668 667
669 if (dccp_v4_send_response(sk, req, NULL)) 668 if (dccp_v4_send_response(sk, req, NULL))
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 193b946fd039..a08af75ddc9e 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -76,20 +76,12 @@ static inline void dccp_v6_send_check(struct sock *sk, int unused_value,
76 dh->dccph_checksum = dccp_v6_csum_finish(skb, &np->saddr, &np->daddr); 76 dh->dccph_checksum = dccp_v6_csum_finish(skb, &np->saddr, &np->daddr);
77} 77}
78 78
79static __u32 dccp_v6_init_sequence(struct sock *sk, struct sk_buff *skb) 79static inline __u32 dccp_v6_init_sequence(const struct sk_buff *skb)
80{ 80{
81 const struct dccp_hdr *dh = dccp_hdr(skb); 81 return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
82 82 skb->nh.ipv6h->saddr.s6_addr32,
83 if (skb->protocol == htons(ETH_P_IPV6)) 83 dccp_hdr(skb)->dccph_dport,
84 return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32, 84 dccp_hdr(skb)->dccph_sport );
85 skb->nh.ipv6h->saddr.s6_addr32,
86 dh->dccph_dport,
87 dh->dccph_sport);
88
89 return secure_dccp_sequence_number(skb->nh.iph->daddr,
90 skb->nh.iph->saddr,
91 dh->dccph_dport,
92 dh->dccph_sport);
93} 85}
94 86
95static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 87static 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)
491 */ 483 */
492 dreq = dccp_rsk(req); 484 dreq = dccp_rsk(req);
493 dreq->dreq_isr = dcb->dccpd_seq; 485 dreq->dreq_isr = dcb->dccpd_seq;
494 dreq->dreq_iss = dccp_v6_init_sequence(sk, skb); 486 dreq->dreq_iss = dccp_v6_init_sequence(skb);
495 dreq->dreq_service = service; 487 dreq->dreq_service = service;
496 488
497 if (dccp_v6_send_response(sk, req, NULL)) 489 if (dccp_v6_send_response(sk, req, NULL))