aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/options.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2006-11-14 09:57:34 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:22:30 -0500
commit09dbc3895e3242346bd434dae743c456fd28fc6a (patch)
treea7bc1d0879b025152bff9e4a0ba44beaa5da654b /net/dccp/options.c
parentc02fdc0e81e9c735d8d895af1e201b235df326d8 (diff)
[DCCP]: Miscellaneous code tidy-ups
This patch does not change code; it performs some trivial clean/tidy-ups: * removal of a `debug_prefix' string in favour of the already existing dccp_role(sk) * add documentation of structures and constants * separated out the cases for invalid packets (step 1 of the packet validation) * removing duplicate statements * combining declaration & initialisation Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/options.c')
-rw-r--r--net/dccp/options.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 2d0ef27f4ab9..7e50678e2471 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -60,10 +60,6 @@ static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len)
60int dccp_parse_options(struct sock *sk, struct sk_buff *skb) 60int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
61{ 61{
62 struct dccp_sock *dp = dccp_sk(sk); 62 struct dccp_sock *dp = dccp_sk(sk);
63#ifdef CONFIG_IP_DCCP_DEBUG
64 const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ?
65 "CLIENT rx opt: " : "server rx opt: ";
66#endif
67 const struct dccp_hdr *dh = dccp_hdr(skb); 63 const struct dccp_hdr *dh = dccp_hdr(skb);
68 const u8 pkt_type = DCCP_SKB_CB(skb)->dccpd_type; 64 const u8 pkt_type = DCCP_SKB_CB(skb)->dccpd_type;
69 unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb); 65 unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb);
@@ -119,7 +115,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
119 goto out_invalid_option; 115 goto out_invalid_option;
120 116
121 opt_recv->dccpor_ndp = dccp_decode_value_var(value, len); 117 opt_recv->dccpor_ndp = dccp_decode_value_var(value, len);
122 dccp_pr_debug("%sNDP count=%d\n", debug_prefix, 118 dccp_pr_debug("%s rx opt: NDP count=%d\n", dccp_role(sk),
123 opt_recv->dccpor_ndp); 119 opt_recv->dccpor_ndp);
124 break; 120 break;
125 case DCCPO_CHANGE_L: 121 case DCCPO_CHANGE_L:
@@ -165,8 +161,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
165 dp->dccps_timestamp_echo = opt_recv->dccpor_timestamp; 161 dp->dccps_timestamp_echo = opt_recv->dccpor_timestamp;
166 dccp_timestamp(sk, &dp->dccps_timestamp_time); 162 dccp_timestamp(sk, &dp->dccps_timestamp_time);
167 163
168 dccp_pr_debug("%sTIMESTAMP=%u, ackno=%llu\n", 164 dccp_pr_debug("%s rx opt: TIMESTAMP=%u, ackno=%llu\n",
169 debug_prefix, opt_recv->dccpor_timestamp, 165 dccp_role(sk), opt_recv->dccpor_timestamp,
170 (unsigned long long) 166 (unsigned long long)
171 DCCP_SKB_CB(skb)->dccpd_ack_seq); 167 DCCP_SKB_CB(skb)->dccpd_ack_seq);
172 break; 168 break;
@@ -176,8 +172,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
176 172
177 opt_recv->dccpor_timestamp_echo = ntohl(*(__be32 *)value); 173 opt_recv->dccpor_timestamp_echo = ntohl(*(__be32 *)value);
178 174
179 dccp_pr_debug("%sTIMESTAMP_ECHO=%u, len=%d, ackno=%llu, ", 175 dccp_pr_debug("%s rx opt: TIMESTAMP_ECHO=%u, len=%d, "
180 debug_prefix, 176 "ackno=%llu, ", dccp_role(sk),
181 opt_recv->dccpor_timestamp_echo, 177 opt_recv->dccpor_timestamp_echo,
182 len + 2, 178 len + 2,
183 (unsigned long long) 179 (unsigned long long)
@@ -211,8 +207,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
211 if (elapsed_time > opt_recv->dccpor_elapsed_time) 207 if (elapsed_time > opt_recv->dccpor_elapsed_time)
212 opt_recv->dccpor_elapsed_time = elapsed_time; 208 opt_recv->dccpor_elapsed_time = elapsed_time;
213 209
214 dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix, 210 dccp_pr_debug("%s rx opt: ELAPSED_TIME=%d\n",
215 elapsed_time); 211 dccp_role(sk), elapsed_time);
216 break; 212 break;
217 /* 213 /*
218 * From RFC 4340, sec. 10.3: 214 * From RFC 4340, sec. 10.3: