2005-08-10 03:14:34 +00:00
|
|
|
/*
|
|
|
|
* net/dccp/minisocks.c
|
|
|
|
*
|
|
|
|
* An implementation of the DCCP protocol
|
|
|
|
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/dccp.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/gfp.h>
|
2006-11-10 14:32:01 +00:00
|
|
|
#include <linux/kernel.h>
|
2005-08-10 03:14:34 +00:00
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
|
|
|
|
#include <net/sock.h>
|
|
|
|
#include <net/xfrm.h>
|
|
|
|
#include <net/inet_timewait_sock.h>
|
|
|
|
|
2005-09-18 07:17:51 +00:00
|
|
|
#include "ackvec.h"
|
2005-08-10 03:14:34 +00:00
|
|
|
#include "ccid.h"
|
|
|
|
#include "dccp.h"
|
[DCCP]: Initial feature negotiation implementation
Still needs more work, but boots and doesn't crashes, even
does some negotiation!
18:38:52.174934 127.0.0.1.43458 > 127.0.0.1.5001: request <change_l ack_ratio 2, change_r ccid 2, change_l ccid 2>
18:38:52.218526 127.0.0.1.5001 > 127.0.0.1.43458: response <nop, nop, change_l ack_ratio 2, confirm_r ccid 2 2, confirm_l ccid 2 2, confirm_r ack_ratio 2>
18:38:52.185398 127.0.0.1.43458 > 127.0.0.1.5001: <nop, confirm_r ack_ratio 2, ack_vector0 0x00, elapsed_time 212>
:-)
Signed-off-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-03-21 01:43:56 +00:00
|
|
|
#include "feat.h"
|
2005-08-10 03:14:34 +00:00
|
|
|
|
2005-08-10 03:45:21 +00:00
|
|
|
struct inet_timewait_death_row dccp_death_row = {
|
|
|
|
.sysctl_max_tw_buckets = NR_FILE * 2,
|
|
|
|
.period = DCCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
|
2007-04-26 08:37:44 +00:00
|
|
|
.death_lock = __SPIN_LOCK_UNLOCKED(dccp_death_row.death_lock),
|
2005-08-10 03:45:21 +00:00
|
|
|
.hashinfo = &dccp_hashinfo,
|
|
|
|
.tw_timer = TIMER_INITIALIZER(inet_twdr_hangman, 0,
|
|
|
|
(unsigned long)&dccp_death_row),
|
|
|
|
.twkill_work = __WORK_INITIALIZER(dccp_death_row.twkill_work,
|
2006-11-22 14:57:56 +00:00
|
|
|
inet_twdr_twkill_work),
|
2005-08-10 03:45:21 +00:00
|
|
|
/* Short-time timewait calendar */
|
|
|
|
|
|
|
|
.twcal_hand = -1,
|
|
|
|
.twcal_timer = TIMER_INITIALIZER(inet_twdr_twcal_tick, 0,
|
|
|
|
(unsigned long)&dccp_death_row),
|
|
|
|
};
|
|
|
|
|
2005-12-14 07:24:16 +00:00
|
|
|
EXPORT_SYMBOL_GPL(dccp_death_row);
|
|
|
|
|
2005-08-10 03:14:34 +00:00
|
|
|
void dccp_time_wait(struct sock *sk, int state, int timeo)
|
|
|
|
{
|
2005-08-10 03:45:21 +00:00
|
|
|
struct inet_timewait_sock *tw = NULL;
|
2005-08-10 03:14:34 +00:00
|
|
|
|
2005-08-10 03:45:21 +00:00
|
|
|
if (dccp_death_row.tw_count < dccp_death_row.sysctl_max_tw_buckets)
|
|
|
|
tw = inet_twsk_alloc(sk, state);
|
|
|
|
|
|
|
|
if (tw != NULL) {
|
|
|
|
const struct inet_connection_sock *icsk = inet_csk(sk);
|
|
|
|
const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1);
|
2011-12-10 09:48:31 +00:00
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
2005-12-14 07:24:53 +00:00
|
|
|
if (tw->tw_family == PF_INET6) {
|
|
|
|
const struct ipv6_pinfo *np = inet6_sk(sk);
|
2005-08-10 03:45:21 +00:00
|
|
|
|
ipv6: make lookups simpler and faster
TCP listener refactoring, part 4 :
To speed up inet lookups, we moved IPv4 addresses from inet to struct
sock_common
Now is time to do the same for IPv6, because it permits us to have fast
lookups for all kind of sockets, including upcoming SYN_RECV.
Getting IPv6 addresses in TCP lookups currently requires two extra cache
lines, plus a dereference (and memory stall).
inet6_sk(sk) does the dereference of inet_sk(__sk)->pinet6
This patch is way bigger than its IPv4 counter part, because for IPv4,
we could add aliases (inet_daddr, inet_rcv_saddr), while on IPv6,
it's not doable easily.
inet6_sk(sk)->daddr becomes sk->sk_v6_daddr
inet6_sk(sk)->rcv_saddr becomes sk->sk_v6_rcv_saddr
And timewait socket also have tw->tw_v6_daddr & tw->tw_v6_rcv_saddr
at the same offset.
We get rid of INET6_TW_MATCH() as INET6_MATCH() is now the generic
macro.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-03 22:42:29 +00:00
|
|
|
tw->tw_v6_daddr = sk->sk_v6_daddr;
|
|
|
|
tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
|
2005-12-14 07:24:53 +00:00
|
|
|
tw->tw_ipv6only = np->ipv6only;
|
|
|
|
}
|
|
|
|
#endif
|
2005-08-10 03:45:21 +00:00
|
|
|
/* Linkage updates. */
|
|
|
|
__inet_twsk_hashdance(tw, sk, &dccp_hashinfo);
|
|
|
|
|
|
|
|
/* Get the TIME_WAIT timeout firing. */
|
|
|
|
if (timeo < rto)
|
|
|
|
timeo = rto;
|
|
|
|
|
|
|
|
tw->tw_timeout = DCCP_TIMEWAIT_LEN;
|
|
|
|
if (state == DCCP_TIME_WAIT)
|
|
|
|
timeo = DCCP_TIMEWAIT_LEN;
|
|
|
|
|
|
|
|
inet_twsk_schedule(tw, &dccp_death_row, timeo,
|
|
|
|
DCCP_TIMEWAIT_LEN);
|
|
|
|
inet_twsk_put(tw);
|
|
|
|
} else {
|
|
|
|
/* Sorry, if we're out of memory, just CLOSE this
|
|
|
|
* socket up. We've got bigger problems than
|
|
|
|
* non-graceful socket closings.
|
|
|
|
*/
|
2006-11-20 20:39:23 +00:00
|
|
|
DCCP_WARN("time wait bucket table overflow\n");
|
2005-08-10 03:45:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dccp_done(sk);
|
2005-08-10 03:14:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct sock *dccp_create_openreq_child(struct sock *sk,
|
|
|
|
const struct request_sock *req,
|
|
|
|
const struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Step 3: Process LISTEN state
|
|
|
|
*
|
2006-11-10 18:29:14 +00:00
|
|
|
* (* Generate a new socket and switch to that socket *)
|
|
|
|
* Set S := new socket for this port pair
|
2005-08-10 03:14:34 +00:00
|
|
|
*/
|
2011-11-08 22:07:07 +00:00
|
|
|
struct sock *newsk = inet_csk_clone_lock(sk, req, GFP_ATOMIC);
|
2005-08-10 03:14:34 +00:00
|
|
|
|
|
|
|
if (newsk != NULL) {
|
2008-12-08 09:15:55 +00:00
|
|
|
struct dccp_request_sock *dreq = dccp_rsk(req);
|
2007-03-06 22:24:44 +00:00
|
|
|
struct inet_connection_sock *newicsk = inet_csk(newsk);
|
2005-08-10 03:14:34 +00:00
|
|
|
struct dccp_sock *newdp = dccp_sk(newsk);
|
|
|
|
|
[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>
2007-12-13 14:37:19 +00:00
|
|
|
newdp->dccps_role = DCCP_ROLE_SERVER;
|
|
|
|
newdp->dccps_hc_rx_ackvec = NULL;
|
|
|
|
newdp->dccps_service_list = NULL;
|
|
|
|
newdp->dccps_service = dreq->dreq_service;
|
|
|
|
newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo;
|
|
|
|
newdp->dccps_timestamp_time = dreq->dreq_timestamp_time;
|
|
|
|
newicsk->icsk_rto = DCCP_TIMEOUT_INIT;
|
2005-08-10 03:14:34 +00:00
|
|
|
|
2008-11-05 07:55:49 +00:00
|
|
|
INIT_LIST_HEAD(&newdp->dccps_featneg);
|
2005-08-10 03:14:34 +00:00
|
|
|
/*
|
|
|
|
* Step 3: Process LISTEN state
|
|
|
|
*
|
2006-11-10 18:29:14 +00:00
|
|
|
* Choose S.ISS (initial seqno) or set from Init Cookies
|
|
|
|
* Initialize S.GAR := S.ISS
|
2010-10-11 18:35:40 +00:00
|
|
|
* Set S.ISR, S.GSR from packet (or Init Cookies)
|
|
|
|
*
|
|
|
|
* Setting AWL/AWH and SWL/SWH happens as part of the feature
|
|
|
|
* activation below, as these windows all depend on the local
|
|
|
|
* and remote Sequence Window feature values (7.5.2).
|
2005-08-21 08:36:45 +00:00
|
|
|
*/
|
2012-02-27 01:22:02 +00:00
|
|
|
newdp->dccps_iss = dreq->dreq_iss;
|
|
|
|
newdp->dccps_gss = dreq->dreq_gss;
|
2010-10-11 18:35:40 +00:00
|
|
|
newdp->dccps_gar = newdp->dccps_iss;
|
2012-02-27 01:22:02 +00:00
|
|
|
newdp->dccps_isr = dreq->dreq_isr;
|
|
|
|
newdp->dccps_gsr = dreq->dreq_gsr;
|
2005-08-21 08:36:45 +00:00
|
|
|
|
2008-12-08 09:15:55 +00:00
|
|
|
/*
|
2010-10-11 18:35:40 +00:00
|
|
|
* Activate features: initialise CCIDs, sequence windows etc.
|
2008-12-08 09:15:55 +00:00
|
|
|
*/
|
|
|
|
if (dccp_feat_activate_values(newsk, &dreq->dreq_featneg)) {
|
|
|
|
/* It is still raw copy of parent, so invalidate
|
|
|
|
* destructor and make plain sk_free() */
|
|
|
|
newsk->sk_destruct = NULL;
|
|
|
|
sk_free(newsk);
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-08-10 03:14:34 +00:00
|
|
|
dccp_init_xmit_timers(newsk);
|
|
|
|
|
|
|
|
DCCP_INC_STATS_BH(DCCP_MIB_PASSIVEOPENS);
|
|
|
|
}
|
|
|
|
return newsk;
|
|
|
|
}
|
|
|
|
|
2005-12-14 07:24:16 +00:00
|
|
|
EXPORT_SYMBOL_GPL(dccp_create_openreq_child);
|
|
|
|
|
2006-12-10 18:01:18 +00:00
|
|
|
/*
|
2005-08-10 03:14:34 +00:00
|
|
|
* Process an incoming packet for RESPOND sockets represented
|
|
|
|
* as an request_sock.
|
|
|
|
*/
|
|
|
|
struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
|
|
|
|
struct request_sock *req,
|
|
|
|
struct request_sock **prev)
|
|
|
|
{
|
|
|
|
struct sock *child = NULL;
|
2007-12-13 14:31:26 +00:00
|
|
|
struct dccp_request_sock *dreq = dccp_rsk(req);
|
2005-08-10 03:14:34 +00:00
|
|
|
|
|
|
|
/* Check for retransmitted REQUEST */
|
|
|
|
if (dccp_hdr(skb)->dccph_type == DCCP_PKT_REQUEST) {
|
|
|
|
|
2012-02-27 01:22:02 +00:00
|
|
|
if (after48(DCCP_SKB_CB(skb)->dccpd_seq, dreq->dreq_gsr)) {
|
2005-08-10 03:14:34 +00:00
|
|
|
dccp_pr_debug("Retransmitted REQUEST\n");
|
2012-02-27 01:22:02 +00:00
|
|
|
dreq->dreq_gsr = DCCP_SKB_CB(skb)->dccpd_seq;
|
2006-11-13 15:12:07 +00:00
|
|
|
/*
|
|
|
|
* Send another RESPONSE packet
|
|
|
|
* To protect against Request floods, increment retrans
|
|
|
|
* counter (backoff, monitored by dccp_response_timer).
|
|
|
|
*/
|
2012-10-27 23:16:46 +00:00
|
|
|
inet_rtx_syn_ack(sk, req);
|
2005-08-10 03:14:34 +00:00
|
|
|
}
|
|
|
|
/* Network Duplicate, discard packet */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
|
|
|
|
|
|
|
|
if (dccp_hdr(skb)->dccph_type != DCCP_PKT_ACK &&
|
|
|
|
dccp_hdr(skb)->dccph_type != DCCP_PKT_DATAACK)
|
|
|
|
goto drop;
|
|
|
|
|
|
|
|
/* Invalid ACK */
|
2012-02-27 01:22:02 +00:00
|
|
|
if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
|
|
|
dreq->dreq_iss, dreq->dreq_gss)) {
|
2005-08-13 23:34:54 +00:00
|
|
|
dccp_pr_debug("Invalid ACK number: ack_seq=%llu, "
|
2012-02-27 01:22:02 +00:00
|
|
|
"dreq_iss=%llu, dreq_gss=%llu\n",
|
2005-08-10 03:27:14 +00:00
|
|
|
(unsigned long long)
|
|
|
|
DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
2012-02-27 01:22:02 +00:00
|
|
|
(unsigned long long) dreq->dreq_iss,
|
|
|
|
(unsigned long long) dreq->dreq_gss);
|
2005-08-10 03:14:34 +00:00
|
|
|
goto drop;
|
|
|
|
}
|
|
|
|
|
2007-12-13 14:31:26 +00:00
|
|
|
if (dccp_parse_options(sk, dreq, skb))
|
|
|
|
goto drop;
|
|
|
|
|
2005-12-14 07:16:16 +00:00
|
|
|
child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL);
|
2005-08-10 03:14:34 +00:00
|
|
|
if (child == NULL)
|
|
|
|
goto listen_overflow;
|
|
|
|
|
|
|
|
inet_csk_reqsk_queue_unlink(sk, req, prev);
|
|
|
|
inet_csk_reqsk_queue_removed(sk, req);
|
|
|
|
inet_csk_reqsk_queue_add(sk, req, child);
|
|
|
|
out:
|
|
|
|
return child;
|
|
|
|
listen_overflow:
|
|
|
|
dccp_pr_debug("listen_overflow!\n");
|
|
|
|
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_TOO_BUSY;
|
|
|
|
drop:
|
|
|
|
if (dccp_hdr(skb)->dccph_type != DCCP_PKT_RESET)
|
2006-11-15 03:07:45 +00:00
|
|
|
req->rsk_ops->send_reset(sk, skb);
|
2005-08-10 03:14:34 +00:00
|
|
|
|
|
|
|
inet_csk_reqsk_queue_drop(sk, req, prev);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2005-12-14 07:24:16 +00:00
|
|
|
EXPORT_SYMBOL_GPL(dccp_check_req);
|
|
|
|
|
2005-08-10 03:14:34 +00:00
|
|
|
/*
|
|
|
|
* Queue segment on the new socket if the new socket is active,
|
|
|
|
* otherwise we just shortcircuit this and continue with
|
|
|
|
* the new socket.
|
|
|
|
*/
|
|
|
|
int dccp_child_process(struct sock *parent, struct sock *child,
|
|
|
|
struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
const int state = child->sk_state;
|
|
|
|
|
|
|
|
if (!sock_owned_by_user(child)) {
|
2005-08-13 23:34:54 +00:00
|
|
|
ret = dccp_rcv_state_process(child, skb, dccp_hdr(skb),
|
|
|
|
skb->len);
|
2005-08-10 03:14:34 +00:00
|
|
|
|
|
|
|
/* Wakeup parent, send SIGIO */
|
|
|
|
if (state == DCCP_RESPOND && child->sk_state != state)
|
|
|
|
parent->sk_data_ready(parent, 0);
|
|
|
|
} else {
|
|
|
|
/* Alas, it is possible again, because we do lookup
|
|
|
|
* in main socket hash table and lock on listening
|
|
|
|
* socket does not protect us more.
|
|
|
|
*/
|
2010-03-04 18:01:47 +00:00
|
|
|
__sk_add_backlog(child, skb);
|
2005-08-10 03:14:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bh_unlock_sock(child);
|
|
|
|
sock_put(child);
|
|
|
|
return ret;
|
|
|
|
}
|
2005-12-14 07:24:16 +00:00
|
|
|
|
|
|
|
EXPORT_SYMBOL_GPL(dccp_child_process);
|
2006-11-10 14:32:01 +00:00
|
|
|
|
2008-08-07 06:50:04 +00:00
|
|
|
void dccp_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
|
|
|
|
struct request_sock *rsk)
|
2006-11-10 14:32:01 +00:00
|
|
|
{
|
2006-11-20 20:39:23 +00:00
|
|
|
DCCP_BUG("DCCP-ACK packets are never sent in LISTEN/RESPOND state");
|
2006-11-10 14:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EXPORT_SYMBOL_GPL(dccp_reqsk_send_ack);
|
2006-11-10 18:08:37 +00:00
|
|
|
|
2008-11-05 07:55:49 +00:00
|
|
|
int dccp_reqsk_init(struct request_sock *req,
|
|
|
|
struct dccp_sock const *dp, struct sk_buff const *skb)
|
2006-11-10 18:08:37 +00:00
|
|
|
{
|
[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>
2007-12-13 14:37:19 +00:00
|
|
|
struct dccp_request_sock *dreq = dccp_rsk(req);
|
|
|
|
|
2013-10-10 07:04:37 +00:00
|
|
|
inet_rsk(req)->ir_rmt_port = dccp_hdr(skb)->dccph_sport;
|
|
|
|
inet_rsk(req)->ir_num = ntohs(dccp_hdr(skb)->dccph_dport);
|
|
|
|
inet_rsk(req)->acked = 0;
|
|
|
|
dreq->dreq_timestamp_echo = 0;
|
2008-11-05 07:55:49 +00:00
|
|
|
|
|
|
|
/* inherit feature negotiation options from listening socket */
|
|
|
|
return dccp_feat_clone_list(&dp->dccps_featneg, &dreq->dreq_featneg);
|
2006-11-10 18:08:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EXPORT_SYMBOL_GPL(dccp_reqsk_init);
|