aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/options.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 7ad2f4266ff9..34b230a00875 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -72,6 +72,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
72 struct dccp_options_received *opt_recv = &dp->dccps_options_received; 72 struct dccp_options_received *opt_recv = &dp->dccps_options_received;
73 unsigned char opt, len; 73 unsigned char opt, len;
74 unsigned char *value; 74 unsigned char *value;
75 u32 elapsed_time;
75 76
76 memset(opt_recv, 0, sizeof(*opt_recv)); 77 memset(opt_recv, 0, sizeof(*opt_recv));
77 78
@@ -159,18 +160,18 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
159 (unsigned long long) 160 (unsigned long long)
160 DCCP_SKB_CB(skb)->dccpd_ack_seq); 161 DCCP_SKB_CB(skb)->dccpd_ack_seq);
161 162
162 if (len > 4) {
163 if (len == 6)
164 opt_recv->dccpor_elapsed_time =
165 ntohs(*(u16 *)(value + 4));
166 else
167 opt_recv->dccpor_elapsed_time =
168 ntohl(*(u32 *)(value + 4));
169 163
170 dccp_pr_debug("%sTIMESTAMP_ECHO ELAPSED_TIME=%d\n", 164 if (len == 4)
171 debug_prefix, 165 break;
172 opt_recv->dccpor_elapsed_time); 166
173 } 167 if (len == 6)
168 elapsed_time = ntohs(*(u16 *)(value + 4));
169 else
170 elapsed_time = ntohl(*(u32 *)(value + 4));
171
172 /* Give precedence to the biggest ELAPSED_TIME */
173 if (elapsed_time > opt_recv->dccpor_elapsed_time)
174 opt_recv->dccpor_elapsed_time = elapsed_time;
174 break; 175 break;
175 case DCCPO_ELAPSED_TIME: 176 case DCCPO_ELAPSED_TIME:
176 if (len != 2 && len != 4) 177 if (len != 2 && len != 4)
@@ -180,14 +181,15 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
180 continue; 181 continue;
181 182
182 if (len == 2) 183 if (len == 2)
183 opt_recv->dccpor_elapsed_time = 184 elapsed_time = ntohs(*(u16 *)value);
184 ntohs(*(u16 *)value);
185 else 185 else
186 opt_recv->dccpor_elapsed_time = 186 elapsed_time = ntohl(*(u32 *)value);
187 ntohl(*(u32 *)value); 187
188 if (elapsed_time > opt_recv->dccpor_elapsed_time)
189 opt_recv->dccpor_elapsed_time = elapsed_time;
188 190
189 dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix, 191 dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix,
190 opt_recv->dccpor_elapsed_time); 192 elapsed_time);
191 break; 193 break;
192 /* 194 /*
193 * From draft-ietf-dccp-spec-11.txt: 195 * From draft-ietf-dccp-spec-11.txt: