diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2005-08-09 23:11:24 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:49:20 -0400 |
commit | 9f1d2604c71498579609b1532fedc5a89276bb00 (patch) | |
tree | b87d6b9a610f015889b0b1f91b8669adfb600763 /net/ipv4/inet_connection_sock.c | |
parent | 3f421baa4720b708022f8bcc52a61e5cd6f10bf8 (diff) |
[ICSK]: Introduce inet_csk_clone
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 2712400a8bb8..136ada050b63 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -399,3 +399,28 @@ void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, | |||
399 | } | 399 | } |
400 | 400 | ||
401 | EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); | 401 | EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); |
402 | |||
403 | struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, | ||
404 | const unsigned int __nocast priority) | ||
405 | { | ||
406 | struct sock *newsk = sk_clone(sk, priority); | ||
407 | |||
408 | if (newsk != NULL) { | ||
409 | struct inet_connection_sock *newicsk = inet_csk(newsk); | ||
410 | |||
411 | newsk->sk_state = TCP_SYN_RECV; | ||
412 | newicsk->icsk_bind_hash = NULL; | ||
413 | |||
414 | inet_sk(newsk)->dport = inet_rsk(req)->rmt_port; | ||
415 | newsk->sk_write_space = sk_stream_write_space; | ||
416 | |||
417 | newicsk->icsk_retransmits = 0; | ||
418 | newicsk->icsk_backoff = 0; | ||
419 | |||
420 | /* Deinitialize accept_queue to trap illegal accesses. */ | ||
421 | memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue)); | ||
422 | } | ||
423 | return newsk; | ||
424 | } | ||
425 | |||
426 | EXPORT_SYMBOL_GPL(inet_csk_clone); | ||