diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2007-12-13 09:37:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:57:51 -0500 |
commit | b4d4f7c70fd3361c6c889752e08ea9be304cf5f4 (patch) | |
tree | b84c712184dfcdde4b68980f4eff21bcaefbfcf3 /net/dccp/minisocks.c | |
parent | 8109616e2ef978d142ea45850efd4f102b9bdce4 (diff) |
[DCCP]: Handle timestamps on Request/Response exchange separately
In DCCP, timestamps can occur on packets anytime, CCID3 uses a timestamp(/echo) on the Request/Response
exchange. This patch addresses the following situation:
* timestamps are recorded on the listening socket;
* Responses are sent from dccp_request_sockets;
* suppose two connections reach the listening socket with very small time in between:
* the first timestamp value gets overwritten by the second connection request.
This is not really good, so this patch separates timestamps into
* those which are received by the server during the initial handshake (on dccp_request_sock);
* those which are received by the client or the client after connection establishment.
As before, a timestamp of 0 is regarded as indicating that no (meaningful) timestamp has been
received (in addition, a warning message is printed if hosts send 0-valued timestamps).
The timestamp-echoing now works as follows:
* when a timestamp is present on the initial Request, it is placed into dreq, due to the
call to dccp_parse_options in dccp_v{4,6}_conn_request;
* when a timestamp is present on the Ack leading from RESPOND => OPEN, it is copied over
from the request_sock into the child cocket in dccp_create_openreq_child;
* timestamps received on an (established) dccp_sock are treated as before.
Since Elapsed Time is measured in hundredths of milliseconds (13.2), the new dccp_timestamp()
function is used, as it is expected that the time between receiving the timestamp and
sending the timestamp echo will be very small against the wrap-around time. As a byproduct,
this allows smaller timestamping-time fields.
Furthermore, inserting the Timestamp Echo option has been taken out of the block starting with
'!dccp_packet_without_ack()', since Timestamp Echo can be carried on any packet (5.8 and 13.3).
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/minisocks.c')
-rw-r--r-- | net/dccp/minisocks.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index b1d5da61f6af..027d1814e1ab 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -117,11 +117,13 @@ struct sock *dccp_create_openreq_child(struct sock *sk, | |||
117 | struct dccp_sock *newdp = dccp_sk(newsk); | 117 | struct dccp_sock *newdp = dccp_sk(newsk); |
118 | struct dccp_minisock *newdmsk = dccp_msk(newsk); | 118 | struct dccp_minisock *newdmsk = dccp_msk(newsk); |
119 | 119 | ||
120 | newdp->dccps_role = DCCP_ROLE_SERVER; | 120 | newdp->dccps_role = DCCP_ROLE_SERVER; |
121 | newdp->dccps_hc_rx_ackvec = NULL; | 121 | newdp->dccps_hc_rx_ackvec = NULL; |
122 | newdp->dccps_service_list = NULL; | 122 | newdp->dccps_service_list = NULL; |
123 | newdp->dccps_service = dreq->dreq_service; | 123 | newdp->dccps_service = dreq->dreq_service; |
124 | newicsk->icsk_rto = DCCP_TIMEOUT_INIT; | 124 | newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo; |
125 | newdp->dccps_timestamp_time = dreq->dreq_timestamp_time; | ||
126 | newicsk->icsk_rto = DCCP_TIMEOUT_INIT; | ||
125 | 127 | ||
126 | if (dccp_feat_clone(sk, newsk)) | 128 | if (dccp_feat_clone(sk, newsk)) |
127 | goto out_free; | 129 | goto out_free; |
@@ -303,9 +305,12 @@ EXPORT_SYMBOL_GPL(dccp_reqsk_send_ack); | |||
303 | 305 | ||
304 | void dccp_reqsk_init(struct request_sock *req, struct sk_buff *skb) | 306 | void dccp_reqsk_init(struct request_sock *req, struct sk_buff *skb) |
305 | { | 307 | { |
306 | inet_rsk(req)->rmt_port = dccp_hdr(skb)->dccph_sport; | 308 | struct dccp_request_sock *dreq = dccp_rsk(req); |
307 | inet_rsk(req)->acked = 0; | 309 | |
308 | req->rcv_wnd = sysctl_dccp_feat_sequence_window; | 310 | inet_rsk(req)->rmt_port = dccp_hdr(skb)->dccph_sport; |
311 | inet_rsk(req)->acked = 0; | ||
312 | req->rcv_wnd = sysctl_dccp_feat_sequence_window; | ||
313 | dreq->dreq_timestamp_echo = 0; | ||
309 | } | 314 | } |
310 | 315 | ||
311 | EXPORT_SYMBOL_GPL(dccp_reqsk_init); | 316 | EXPORT_SYMBOL_GPL(dccp_reqsk_init); |