[DCCP] Give precedence to the biggest ELAPSED_TIME

We can get this value in an TIMESTAMP_ECHO and/or in an ELAPSED_TIME option, if
receiving both give precendence to the biggest one.

In my tests they are very close if not equal at all times, so we may well think
about removing the code in CCID3 that inserts this option and leaving this to
the core, and perhaps even use just TIMESTAMP_ECHO including the elapsed time.
Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
上级 27ae543e
...@@ -72,6 +72,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) ...@@ -72,6 +72,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
struct dccp_options_received *opt_recv = &dp->dccps_options_received; struct dccp_options_received *opt_recv = &dp->dccps_options_received;
unsigned char opt, len; unsigned char opt, len;
unsigned char *value; unsigned char *value;
u32 elapsed_time;
memset(opt_recv, 0, sizeof(*opt_recv)); memset(opt_recv, 0, sizeof(*opt_recv));
...@@ -159,18 +160,18 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) ...@@ -159,18 +160,18 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
(unsigned long long) (unsigned long long)
DCCP_SKB_CB(skb)->dccpd_ack_seq); DCCP_SKB_CB(skb)->dccpd_ack_seq);
if (len > 4) {
if (len == 4)
break;
if (len == 6) if (len == 6)
opt_recv->dccpor_elapsed_time = elapsed_time = ntohs(*(u16 *)(value + 4));
ntohs(*(u16 *)(value + 4));
else else
opt_recv->dccpor_elapsed_time = elapsed_time = ntohl(*(u32 *)(value + 4));
ntohl(*(u32 *)(value + 4));
dccp_pr_debug("%sTIMESTAMP_ECHO ELAPSED_TIME=%d\n", /* Give precedence to the biggest ELAPSED_TIME */
debug_prefix, if (elapsed_time > opt_recv->dccpor_elapsed_time)
opt_recv->dccpor_elapsed_time); opt_recv->dccpor_elapsed_time = elapsed_time;
}
break; break;
case DCCPO_ELAPSED_TIME: case DCCPO_ELAPSED_TIME:
if (len != 2 && len != 4) if (len != 2 && len != 4)
...@@ -180,14 +181,15 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) ...@@ -180,14 +181,15 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
continue; continue;
if (len == 2) if (len == 2)
opt_recv->dccpor_elapsed_time = elapsed_time = ntohs(*(u16 *)value);
ntohs(*(u16 *)value);
else else
opt_recv->dccpor_elapsed_time = elapsed_time = ntohl(*(u32 *)value);
ntohl(*(u32 *)value);
if (elapsed_time > opt_recv->dccpor_elapsed_time)
opt_recv->dccpor_elapsed_time = elapsed_time;
dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix, dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix,
opt_recv->dccpor_elapsed_time); elapsed_time);
break; break;
/* /*
* From draft-ietf-dccp-spec-11.txt: * From draft-ietf-dccp-spec-11.txt:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册