[NET] Rename open_request to request_sock

Ok, this one just renames some stuff to have a better namespace and to
dissassociate it from TCP:

struct open_request  -> struct request_sock
tcp_openreq_alloc    -> reqsk_alloc
tcp_openreq_free     -> reqsk_free
tcp_openreq_fastfree -> __reqsk_free

With this most of the infrastructure closely resembles a struct
sock methods subset.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Arnaldo Carvalho de Melo 2005-06-18 22:47:21 -07:00 committed by David S. Miller
parent 2e6599cb89
commit 60236fdd08
15 changed files with 117 additions and 117 deletions

View file

@ -109,7 +109,7 @@ struct ip_options {
#define optlength(opt) (sizeof(struct ip_options) + opt->optlen) #define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
struct inet_request_sock { struct inet_request_sock {
struct open_request req; struct request_sock req;
u32 loc_addr; u32 loc_addr;
u32 rmt_addr; u32 rmt_addr;
u16 rmt_port; u16 rmt_port;
@ -123,7 +123,7 @@ struct inet_request_sock {
struct ip_options *opt; struct ip_options *opt;
}; };
static inline struct inet_request_sock *inet_rsk(const struct open_request *sk) static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
{ {
return (struct inet_request_sock *)sk; return (struct inet_request_sock *)sk;
} }

View file

@ -201,7 +201,7 @@ struct tcp6_request_sock {
int iif; int iif;
}; };
static inline struct tcp6_request_sock *tcp6_rsk(const struct open_request *sk) static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk)
{ {
return (struct tcp6_request_sock *)sk; return (struct tcp6_request_sock *)sk;
} }

View file

@ -236,7 +236,7 @@ struct tcp_request_sock {
__u32 snt_isn; __u32 snt_isn;
}; };
static inline struct tcp_request_sock *tcp_rsk(const struct open_request *req) static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
{ {
return (struct tcp_request_sock *)req; return (struct tcp_request_sock *)req;
} }
@ -393,8 +393,8 @@ struct tcp_sock {
struct tcp_listen_opt *listen_opt; struct tcp_listen_opt *listen_opt;
/* FIFO of established children */ /* FIFO of established children */
struct open_request *accept_queue; struct request_sock *accept_queue;
struct open_request *accept_queue_tail; struct request_sock *accept_queue_tail;
unsigned int keepalive_time; /* time before keep alive takes place */ unsigned int keepalive_time; /* time before keep alive takes place */
unsigned int keepalive_intvl; /* time interval between keep alive probes */ unsigned int keepalive_intvl; /* time interval between keep alive probes */

View file

@ -19,28 +19,28 @@
#include <linux/types.h> #include <linux/types.h>
#include <net/sock.h> #include <net/sock.h>
struct open_request; struct request_sock;
struct sk_buff; struct sk_buff;
struct dst_entry; struct dst_entry;
struct proto; struct proto;
struct or_calltable { struct request_sock_ops {
int family; int family;
kmem_cache_t *slab; kmem_cache_t *slab;
int obj_size; int obj_size;
int (*rtx_syn_ack)(struct sock *sk, int (*rtx_syn_ack)(struct sock *sk,
struct open_request *req, struct request_sock *req,
struct dst_entry *dst); struct dst_entry *dst);
void (*send_ack)(struct sk_buff *skb, void (*send_ack)(struct sk_buff *skb,
struct open_request *req); struct request_sock *req);
void (*send_reset)(struct sk_buff *skb); void (*send_reset)(struct sk_buff *skb);
void (*destructor)(struct open_request *req); void (*destructor)(struct request_sock *req);
}; };
/* struct open_request - mini sock to represent a connection request /* struct request_sock - mini sock to represent a connection request
*/ */
struct open_request { struct request_sock {
struct open_request *dl_next; /* Must be first member! */ struct request_sock *dl_next; /* Must be first member! */
u16 mss; u16 mss;
u8 retrans; u8 retrans;
u8 __pad; u8 __pad;
@ -49,29 +49,29 @@ struct open_request {
u32 rcv_wnd; /* rcv_wnd offered first time */ u32 rcv_wnd; /* rcv_wnd offered first time */
u32 ts_recent; u32 ts_recent;
unsigned long expires; unsigned long expires;
struct or_calltable *class; struct request_sock_ops *rsk_ops;
struct sock *sk; struct sock *sk;
}; };
static inline struct open_request *tcp_openreq_alloc(struct or_calltable *class) static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops)
{ {
struct open_request *req = kmem_cache_alloc(class->slab, SLAB_ATOMIC); struct request_sock *req = kmem_cache_alloc(ops->slab, SLAB_ATOMIC);
if (req != NULL) if (req != NULL)
req->class = class; req->rsk_ops = ops;
return req; return req;
} }
static inline void tcp_openreq_fastfree(struct open_request *req) static inline void __reqsk_free(struct request_sock *req)
{ {
kmem_cache_free(req->class->slab, req); kmem_cache_free(req->rsk_ops->slab, req);
} }
static inline void tcp_openreq_free(struct open_request *req) static inline void reqsk_free(struct request_sock *req)
{ {
req->class->destructor(req); req->rsk_ops->destructor(req);
tcp_openreq_fastfree(req); __reqsk_free(req);
} }
#endif /* _REQUEST_SOCK_H */ #endif /* _REQUEST_SOCK_H */

View file

@ -484,7 +484,7 @@ extern void sk_stream_kill_queues(struct sock *sk);
extern int sk_wait_data(struct sock *sk, long *timeo); extern int sk_wait_data(struct sock *sk, long *timeo);
struct or_calltable; struct request_sock_ops;
/* Networking protocol blocks we attach to sockets. /* Networking protocol blocks we attach to sockets.
* socket layer -> transport layer interface * socket layer -> transport layer interface
@ -549,7 +549,7 @@ struct proto {
kmem_cache_t *slab; kmem_cache_t *slab;
unsigned int obj_size; unsigned int obj_size;
struct or_calltable *rsk_prot; struct request_sock_ops *rsk_prot;
struct module *owner; struct module *owner;

View file

@ -641,7 +641,7 @@ struct tcp_func {
struct sock * (*syn_recv_sock) (struct sock *sk, struct sock * (*syn_recv_sock) (struct sock *sk,
struct sk_buff *skb, struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct dst_entry *dst); struct dst_entry *dst);
int (*remember_stamp) (struct sock *sk); int (*remember_stamp) (struct sock *sk);
@ -785,8 +785,8 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw,
unsigned len); unsigned len);
extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct open_request **prev); struct request_sock **prev);
extern int tcp_child_process(struct sock *parent, extern int tcp_child_process(struct sock *parent,
struct sock *child, struct sock *child,
struct sk_buff *skb); struct sk_buff *skb);
@ -836,12 +836,12 @@ extern int tcp_v4_conn_request(struct sock *sk,
struct sk_buff *skb); struct sk_buff *skb);
extern struct sock * tcp_create_openreq_child(struct sock *sk, extern struct sock * tcp_create_openreq_child(struct sock *sk,
struct open_request *req, struct request_sock *req,
struct sk_buff *skb); struct sk_buff *skb);
extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk,
struct sk_buff *skb, struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct dst_entry *dst); struct dst_entry *dst);
extern int tcp_v4_do_rcv(struct sock *sk, extern int tcp_v4_do_rcv(struct sock *sk,
@ -855,7 +855,7 @@ extern int tcp_connect(struct sock *sk);
extern struct sk_buff * tcp_make_synack(struct sock *sk, extern struct sk_buff * tcp_make_synack(struct sock *sk,
struct dst_entry *dst, struct dst_entry *dst,
struct open_request *req); struct request_sock *req);
extern int tcp_disconnect(struct sock *sk, int flags); extern int tcp_disconnect(struct sock *sk, int flags);
@ -1683,7 +1683,7 @@ static inline int tcp_full_space(const struct sock *sk)
return tcp_win_from_space(sk->sk_rcvbuf); return tcp_win_from_space(sk->sk_rcvbuf);
} }
static inline void tcp_acceptq_queue(struct sock *sk, struct open_request *req, static inline void tcp_acceptq_queue(struct sock *sk, struct request_sock *req,
struct sock *child) struct sock *child)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
@ -1707,11 +1707,11 @@ struct tcp_listen_opt
int qlen_young; int qlen_young;
int clock_hand; int clock_hand;
u32 hash_rnd; u32 hash_rnd;
struct open_request *syn_table[TCP_SYNQ_HSIZE]; struct request_sock *syn_table[TCP_SYNQ_HSIZE];
}; };
static inline void static inline void
tcp_synq_removed(struct sock *sk, struct open_request *req) tcp_synq_removed(struct sock *sk, struct request_sock *req)
{ {
struct tcp_listen_opt *lopt = tcp_sk(sk)->listen_opt; struct tcp_listen_opt *lopt = tcp_sk(sk)->listen_opt;
@ -1745,23 +1745,23 @@ static inline int tcp_synq_is_full(struct sock *sk)
return tcp_synq_len(sk) >> tcp_sk(sk)->listen_opt->max_qlen_log; return tcp_synq_len(sk) >> tcp_sk(sk)->listen_opt->max_qlen_log;
} }
static inline void tcp_synq_unlink(struct tcp_sock *tp, struct open_request *req, static inline void tcp_synq_unlink(struct tcp_sock *tp, struct request_sock *req,
struct open_request **prev) struct request_sock **prev)
{ {
write_lock(&tp->syn_wait_lock); write_lock(&tp->syn_wait_lock);
*prev = req->dl_next; *prev = req->dl_next;
write_unlock(&tp->syn_wait_lock); write_unlock(&tp->syn_wait_lock);
} }
static inline void tcp_synq_drop(struct sock *sk, struct open_request *req, static inline void tcp_synq_drop(struct sock *sk, struct request_sock *req,
struct open_request **prev) struct request_sock **prev)
{ {
tcp_synq_unlink(tcp_sk(sk), req, prev); tcp_synq_unlink(tcp_sk(sk), req, prev);
tcp_synq_removed(sk, req); tcp_synq_removed(sk, req);
tcp_openreq_free(req); reqsk_free(req);
} }
static __inline__ void tcp_openreq_init(struct open_request *req, static __inline__ void tcp_openreq_init(struct request_sock *req,
struct tcp_options_received *rx_opt, struct tcp_options_received *rx_opt,
struct sk_buff *skb) struct sk_buff *skb)
{ {

View file

@ -39,7 +39,7 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp,
} }
static __inline__ void static __inline__ void
TCP_ECN_make_synack(struct open_request *req, struct tcphdr *th) TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th)
{ {
if (inet_rsk(req)->ecn_ok) if (inet_rsk(req)->ecn_ok)
th->ece = 1; th->ece = 1;
@ -112,13 +112,13 @@ static inline int TCP_ECN_rcv_ecn_echo(struct tcp_sock *tp, struct tcphdr *th)
} }
static inline void TCP_ECN_openreq_child(struct tcp_sock *tp, static inline void TCP_ECN_openreq_child(struct tcp_sock *tp,
struct open_request *req) struct request_sock *req)
{ {
tp->ecn_flags = inet_rsk(req)->ecn_ok ? TCP_ECN_OK : 0; tp->ecn_flags = inet_rsk(req)->ecn_ok ? TCP_ECN_OK : 0;
} }
static __inline__ void static __inline__ void
TCP_ECN_create_request(struct open_request *req, struct tcphdr *th) TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th)
{ {
if (sysctl_tcp_ecn && th->ece && th->cwr) if (sysctl_tcp_ecn && th->ece && th->cwr)
inet_rsk(req)->ecn_ok = 1; inet_rsk(req)->ecn_ok = 1;

View file

@ -169,10 +169,10 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
return mssind < NUM_MSS ? msstab[mssind] + 1 : 0; return mssind < NUM_MSS ? msstab[mssind] + 1 : 0;
} }
extern struct or_calltable or_ipv4; extern struct request_sock_ops tcp_request_sock_ops;
static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct dst_entry *dst) struct dst_entry *dst)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
@ -182,7 +182,7 @@ static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
if (child) if (child)
tcp_acceptq_queue(sk, req, child); tcp_acceptq_queue(sk, req, child);
else else
tcp_openreq_free(req); reqsk_free(req);
return child; return child;
} }
@ -195,7 +195,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
__u32 cookie = ntohl(skb->h.th->ack_seq) - 1; __u32 cookie = ntohl(skb->h.th->ack_seq) - 1;
struct sock *ret = sk; struct sock *ret = sk;
struct open_request *req; struct request_sock *req;
int mss; int mss;
struct rtable *rt; struct rtable *rt;
__u8 rcv_wscale; __u8 rcv_wscale;
@ -212,7 +212,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
NET_INC_STATS_BH(LINUX_MIB_SYNCOOKIESRECV); NET_INC_STATS_BH(LINUX_MIB_SYNCOOKIESRECV);
ret = NULL; ret = NULL;
req = tcp_openreq_alloc(&or_ipv4); /* for safety */ req = reqsk_alloc(&tcp_request_sock_ops); /* for safety */
if (!req) if (!req)
goto out; goto out;
@ -262,7 +262,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
{ .sport = skb->h.th->dest, { .sport = skb->h.th->dest,
.dport = skb->h.th->source } } }; .dport = skb->h.th->source } } };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&rt, &fl)) {
tcp_openreq_free(req); reqsk_free(req);
goto out; goto out;
} }
} }

View file

@ -516,8 +516,8 @@ static void tcp_listen_stop (struct sock *sk)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct tcp_listen_opt *lopt = tp->listen_opt; struct tcp_listen_opt *lopt = tp->listen_opt;
struct open_request *acc_req = tp->accept_queue; struct request_sock *acc_req = tp->accept_queue;
struct open_request *req; struct request_sock *req;
int i; int i;
tcp_delete_keepalive_timer(sk); tcp_delete_keepalive_timer(sk);
@ -533,7 +533,7 @@ static void tcp_listen_stop (struct sock *sk)
while ((req = lopt->syn_table[i]) != NULL) { while ((req = lopt->syn_table[i]) != NULL) {
lopt->syn_table[i] = req->dl_next; lopt->syn_table[i] = req->dl_next;
lopt->qlen--; lopt->qlen--;
tcp_openreq_free(req); reqsk_free(req);
/* Following specs, it would be better either to send FIN /* Following specs, it would be better either to send FIN
* (and enter FIN-WAIT-1, it is normal close) * (and enter FIN-WAIT-1, it is normal close)
@ -573,7 +573,7 @@ static void tcp_listen_stop (struct sock *sk)
sock_put(child); sock_put(child);
sk_acceptq_removed(sk); sk_acceptq_removed(sk);
tcp_openreq_fastfree(req); __reqsk_free(req);
} }
BUG_TRAP(!sk->sk_ack_backlog); BUG_TRAP(!sk->sk_ack_backlog);
} }
@ -1894,7 +1894,7 @@ static int wait_for_connect(struct sock *sk, long timeo)
struct sock *tcp_accept(struct sock *sk, int flags, int *err) struct sock *tcp_accept(struct sock *sk, int flags, int *err)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct open_request *req; struct request_sock *req;
struct sock *newsk; struct sock *newsk;
int error; int error;
@ -1927,7 +1927,7 @@ struct sock *tcp_accept(struct sock *sk, int flags, int *err)
newsk = req->sk; newsk = req->sk;
sk_acceptq_removed(sk); sk_acceptq_removed(sk);
tcp_openreq_fastfree(req); __reqsk_free(req);
BUG_TRAP(newsk->sk_state != TCP_SYN_RECV); BUG_TRAP(newsk->sk_state != TCP_SYN_RECV);
release_sock(sk); release_sock(sk);
return newsk; return newsk;

View file

@ -455,7 +455,7 @@ static int tcpdiag_dump_sock(struct sk_buff *skb, struct sock *sk,
} }
static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk, static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk,
struct open_request *req, struct request_sock *req,
u32 pid, u32 seq) u32 pid, u32 seq)
{ {
const struct inet_request_sock *ireq = inet_rsk(req); const struct inet_request_sock *ireq = inet_rsk(req);
@ -542,7 +542,7 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,
} }
for (j = s_j; j < TCP_SYNQ_HSIZE; j++) { for (j = s_j; j < TCP_SYNQ_HSIZE; j++) {
struct open_request *req, *head = lopt->syn_table[j]; struct request_sock *req, *head = lopt->syn_table[j];
reqnum = 0; reqnum = 0;
for (req = head; req; reqnum++, req = req->dl_next) { for (req = head; req; reqnum++, req = req->dl_next) {

View file

@ -36,7 +36,7 @@
* ACK bit. * ACK bit.
* Andi Kleen : Implemented fast path mtu discovery. * Andi Kleen : Implemented fast path mtu discovery.
* Fixed many serious bugs in the * Fixed many serious bugs in the
* open_request handling and moved * request_sock handling and moved
* most of it into the af independent code. * most of it into the af independent code.
* Added tail drop and some other bugfixes. * Added tail drop and some other bugfixes.
* Added new listen sematics. * Added new listen sematics.
@ -869,13 +869,13 @@ static __inline__ u32 tcp_v4_synq_hash(u32 raddr, u16 rport, u32 rnd)
return (jhash_2words(raddr, (u32) rport, rnd) & (TCP_SYNQ_HSIZE - 1)); return (jhash_2words(raddr, (u32) rport, rnd) & (TCP_SYNQ_HSIZE - 1));
} }
static struct open_request *tcp_v4_search_req(struct tcp_sock *tp, static struct request_sock *tcp_v4_search_req(struct tcp_sock *tp,
struct open_request ***prevp, struct request_sock ***prevp,
__u16 rport, __u16 rport,
__u32 raddr, __u32 laddr) __u32 raddr, __u32 laddr)
{ {
struct tcp_listen_opt *lopt = tp->listen_opt; struct tcp_listen_opt *lopt = tp->listen_opt;
struct open_request *req, **prev; struct request_sock *req, **prev;
for (prev = &lopt->syn_table[tcp_v4_synq_hash(raddr, rport, lopt->hash_rnd)]; for (prev = &lopt->syn_table[tcp_v4_synq_hash(raddr, rport, lopt->hash_rnd)];
(req = *prev) != NULL; (req = *prev) != NULL;
@ -885,7 +885,7 @@ static struct open_request *tcp_v4_search_req(struct tcp_sock *tp,
if (ireq->rmt_port == rport && if (ireq->rmt_port == rport &&
ireq->rmt_addr == raddr && ireq->rmt_addr == raddr &&
ireq->loc_addr == laddr && ireq->loc_addr == laddr &&
TCP_INET_FAMILY(req->class->family)) { TCP_INET_FAMILY(req->rsk_ops->family)) {
BUG_TRAP(!req->sk); BUG_TRAP(!req->sk);
*prevp = prev; *prevp = prev;
break; break;
@ -895,7 +895,7 @@ static struct open_request *tcp_v4_search_req(struct tcp_sock *tp,
return req; return req;
} }
static void tcp_v4_synq_add(struct sock *sk, struct open_request *req) static void tcp_v4_synq_add(struct sock *sk, struct request_sock *req)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct tcp_listen_opt *lopt = tp->listen_opt; struct tcp_listen_opt *lopt = tp->listen_opt;
@ -1052,7 +1052,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
} }
switch (sk->sk_state) { switch (sk->sk_state) {
struct open_request *req, **prev; struct request_sock *req, **prev;
case TCP_LISTEN: case TCP_LISTEN:
if (sock_owned_by_user(sk)) if (sock_owned_by_user(sk))
goto out; goto out;
@ -1256,14 +1256,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
tcp_tw_put(tw); tcp_tw_put(tw);
} }
static void tcp_v4_or_send_ack(struct sk_buff *skb, struct open_request *req) static void tcp_v4_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req)
{ {
tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd,
req->ts_recent); req->ts_recent);
} }
static struct dst_entry* tcp_v4_route_req(struct sock *sk, static struct dst_entry* tcp_v4_route_req(struct sock *sk,
struct open_request *req) struct request_sock *req)
{ {
struct rtable *rt; struct rtable *rt;
const struct inet_request_sock *ireq = inet_rsk(req); const struct inet_request_sock *ireq = inet_rsk(req);
@ -1294,10 +1294,10 @@ static struct dst_entry* tcp_v4_route_req(struct sock *sk,
/* /*
* Send a SYN-ACK after having received an ACK. * Send a SYN-ACK after having received an ACK.
* This still operates on a open_request only, not on a big * This still operates on a request_sock only, not on a big
* socket. * socket.
*/ */
static int tcp_v4_send_synack(struct sock *sk, struct open_request *req, static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req,
struct dst_entry *dst) struct dst_entry *dst)
{ {
const struct inet_request_sock *ireq = inet_rsk(req); const struct inet_request_sock *ireq = inet_rsk(req);
@ -1332,9 +1332,9 @@ static int tcp_v4_send_synack(struct sock *sk, struct open_request *req,
} }
/* /*
* IPv4 open_request destructor. * IPv4 request_sock destructor.
*/ */
static void tcp_v4_or_free(struct open_request *req) static void tcp_v4_reqsk_destructor(struct request_sock *req)
{ {
if (inet_rsk(req)->opt) if (inet_rsk(req)->opt)
kfree(inet_rsk(req)->opt); kfree(inet_rsk(req)->opt);
@ -1353,7 +1353,7 @@ static inline void syn_flood_warning(struct sk_buff *skb)
} }
/* /*
* Save and compile IPv4 options into the open_request if needed. * Save and compile IPv4 options into the request_sock if needed.
*/ */
static inline struct ip_options *tcp_v4_save_options(struct sock *sk, static inline struct ip_options *tcp_v4_save_options(struct sock *sk,
struct sk_buff *skb) struct sk_buff *skb)
@ -1389,12 +1389,12 @@ static inline struct ip_options *tcp_v4_save_options(struct sock *sk,
*/ */
int sysctl_max_syn_backlog = 256; int sysctl_max_syn_backlog = 256;
struct or_calltable or_ipv4 = { struct request_sock_ops tcp_request_sock_ops = {
.family = PF_INET, .family = PF_INET,
.obj_size = sizeof(struct tcp_request_sock), .obj_size = sizeof(struct tcp_request_sock),
.rtx_syn_ack = tcp_v4_send_synack, .rtx_syn_ack = tcp_v4_send_synack,
.send_ack = tcp_v4_or_send_ack, .send_ack = tcp_v4_reqsk_send_ack,
.destructor = tcp_v4_or_free, .destructor = tcp_v4_reqsk_destructor,
.send_reset = tcp_v4_send_reset, .send_reset = tcp_v4_send_reset,
}; };
@ -1402,7 +1402,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
{ {
struct inet_request_sock *ireq; struct inet_request_sock *ireq;
struct tcp_options_received tmp_opt; struct tcp_options_received tmp_opt;
struct open_request *req; struct request_sock *req;
__u32 saddr = skb->nh.iph->saddr; __u32 saddr = skb->nh.iph->saddr;
__u32 daddr = skb->nh.iph->daddr; __u32 daddr = skb->nh.iph->daddr;
__u32 isn = TCP_SKB_CB(skb)->when; __u32 isn = TCP_SKB_CB(skb)->when;
@ -1439,7 +1439,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1)
goto drop; goto drop;
req = tcp_openreq_alloc(&or_ipv4); req = reqsk_alloc(&tcp_request_sock_ops);
if (!req) if (!req)
goto drop; goto drop;
@ -1535,14 +1535,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
goto drop_and_free; goto drop_and_free;
if (want_cookie) { if (want_cookie) {
tcp_openreq_free(req); reqsk_free(req);
} else { } else {
tcp_v4_synq_add(sk, req); tcp_v4_synq_add(sk, req);
} }
return 0; return 0;
drop_and_free: drop_and_free:
tcp_openreq_free(req); reqsk_free(req);
drop: drop:
TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
return 0; return 0;
@ -1554,7 +1554,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
* now create the new socket. * now create the new socket.
*/ */
struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct dst_entry *dst) struct dst_entry *dst)
{ {
struct inet_request_sock *ireq; struct inet_request_sock *ireq;
@ -1613,9 +1613,9 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
struct iphdr *iph = skb->nh.iph; struct iphdr *iph = skb->nh.iph;
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct sock *nsk; struct sock *nsk;
struct open_request **prev; struct request_sock **prev;
/* Find possible connection requests. */ /* Find possible connection requests. */
struct open_request *req = tcp_v4_search_req(tp, &prev, th->source, struct request_sock *req = tcp_v4_search_req(tp, &prev, th->source,
iph->saddr, iph->daddr); iph->saddr, iph->daddr);
if (req) if (req)
return tcp_check_req(sk, skb, req, prev); return tcp_check_req(sk, skb, req, prev);
@ -2152,13 +2152,13 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
++st->num; ++st->num;
if (st->state == TCP_SEQ_STATE_OPENREQ) { if (st->state == TCP_SEQ_STATE_OPENREQ) {
struct open_request *req = cur; struct request_sock *req = cur;
tp = tcp_sk(st->syn_wait_sk); tp = tcp_sk(st->syn_wait_sk);
req = req->dl_next; req = req->dl_next;
while (1) { while (1) {
while (req) { while (req) {
if (req->class->family == st->family) { if (req->rsk_ops->family == st->family) {
cur = req; cur = req;
goto out; goto out;
} }
@ -2459,7 +2459,7 @@ void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo)
memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
} }
static void get_openreq4(struct sock *sk, struct open_request *req, static void get_openreq4(struct sock *sk, struct request_sock *req,
char *tmpbuf, int i, int uid) char *tmpbuf, int i, int uid)
{ {
const struct inet_request_sock *ireq = inet_rsk(req); const struct inet_request_sock *ireq = inet_rsk(req);
@ -2627,7 +2627,7 @@ struct proto tcp_prot = {
.sysctl_rmem = sysctl_tcp_rmem, .sysctl_rmem = sysctl_tcp_rmem,
.max_header = MAX_TCP_HEADER, .max_header = MAX_TCP_HEADER,
.obj_size = sizeof(struct tcp_sock), .obj_size = sizeof(struct tcp_sock),
.rsk_prot = &or_ipv4, .rsk_prot = &tcp_request_sock_ops,
}; };

View file

@ -684,7 +684,7 @@ void tcp_twcal_tick(unsigned long dummy)
* Actually, we could lots of memory writes here. tp of listening * Actually, we could lots of memory writes here. tp of listening
* socket contains all necessary default parameters. * socket contains all necessary default parameters.
*/ */
struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req, struct sk_buff *skb) struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, struct sk_buff *skb)
{ {
/* allocate the newsk from the same slab of the master sock, /* allocate the newsk from the same slab of the master sock,
* if not, at sk_free time we'll try to free it from the wrong * if not, at sk_free time we'll try to free it from the wrong
@ -853,12 +853,12 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
/* /*
* Process an incoming packet for SYN_RECV sockets represented * Process an incoming packet for SYN_RECV sockets represented
* as an open_request. * as a request_sock.
*/ */
struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct open_request **prev) struct request_sock **prev)
{ {
struct tcphdr *th = skb->h.th; struct tcphdr *th = skb->h.th;
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
@ -903,7 +903,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
* Enforce "SYN-ACK" according to figure 8, figure 6 * Enforce "SYN-ACK" according to figure 8, figure 6
* of RFC793, fixed by RFC1122. * of RFC793, fixed by RFC1122.
*/ */
req->class->rtx_syn_ack(sk, req, NULL); req->rsk_ops->rtx_syn_ack(sk, req, NULL);
return NULL; return NULL;
} }
@ -975,7 +975,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
tcp_rsk(req)->rcv_isn + 1, tcp_rsk(req)->rcv_isn + 1 + req->rcv_wnd)) { tcp_rsk(req)->rcv_isn + 1, tcp_rsk(req)->rcv_isn + 1 + req->rcv_wnd)) {
/* Out of window: send ACK and drop. */ /* Out of window: send ACK and drop. */
if (!(flg & TCP_FLAG_RST)) if (!(flg & TCP_FLAG_RST))
req->class->send_ack(skb, req); req->rsk_ops->send_ack(skb, req);
if (paws_reject) if (paws_reject)
NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED); NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
return NULL; return NULL;
@ -1035,7 +1035,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
embryonic_reset: embryonic_reset:
NET_INC_STATS_BH(LINUX_MIB_EMBRYONICRSTS); NET_INC_STATS_BH(LINUX_MIB_EMBRYONICRSTS);
if (!(flg & TCP_FLAG_RST)) if (!(flg & TCP_FLAG_RST))
req->class->send_reset(skb); req->rsk_ops->send_reset(skb);
tcp_synq_drop(sk, req, prev); tcp_synq_drop(sk, req, prev);
return NULL; return NULL;

View file

@ -1356,7 +1356,7 @@ int tcp_send_synack(struct sock *sk)
* Prepare a SYN-ACK. * Prepare a SYN-ACK.
*/ */
struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
struct open_request *req) struct request_sock *req)
{ {
struct inet_request_sock *ireq = inet_rsk(req); struct inet_request_sock *ireq = inet_rsk(req);
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);

View file

@ -468,7 +468,7 @@ static void tcp_synack_timer(struct sock *sk)
int max_retries = tp->syn_retries ? : sysctl_tcp_synack_retries; int max_retries = tp->syn_retries ? : sysctl_tcp_synack_retries;
int thresh = max_retries; int thresh = max_retries;
unsigned long now = jiffies; unsigned long now = jiffies;
struct open_request **reqp, *req; struct request_sock **reqp, *req;
int i, budget; int i, budget;
if (lopt == NULL || lopt->qlen == 0) if (lopt == NULL || lopt->qlen == 0)
@ -514,7 +514,7 @@ static void tcp_synack_timer(struct sock *sk)
if (time_after_eq(now, req->expires)) { if (time_after_eq(now, req->expires)) {
if ((req->retrans < thresh || if ((req->retrans < thresh ||
(inet_rsk(req)->acked && req->retrans < max_retries)) (inet_rsk(req)->acked && req->retrans < max_retries))
&& !req->class->rtx_syn_ack(sk, req, NULL)) { && !req->rsk_ops->rtx_syn_ack(sk, req, NULL)) {
unsigned long timeo; unsigned long timeo;
if (req->retrans++ == 0) if (req->retrans++ == 0)
@ -533,7 +533,7 @@ static void tcp_synack_timer(struct sock *sk)
lopt->qlen--; lopt->qlen--;
if (req->retrans == 0) if (req->retrans == 0)
lopt->qlen_young--; lopt->qlen_young--;
tcp_openreq_free(req); reqsk_free(req);
continue; continue;
} }
reqp = &req->dl_next; reqp = &req->dl_next;

View file

@ -65,7 +65,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
static void tcp_v6_send_reset(struct sk_buff *skb); static void tcp_v6_send_reset(struct sk_buff *skb);
static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req); static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len,
struct sk_buff *skb); struct sk_buff *skb);
@ -394,15 +394,15 @@ static u32 tcp_v6_synq_hash(struct in6_addr *raddr, u16 rport, u32 rnd)
return c & (TCP_SYNQ_HSIZE - 1); return c & (TCP_SYNQ_HSIZE - 1);
} }
static struct open_request *tcp_v6_search_req(struct tcp_sock *tp, static struct request_sock *tcp_v6_search_req(struct tcp_sock *tp,
struct open_request ***prevp, struct request_sock ***prevp,
__u16 rport, __u16 rport,
struct in6_addr *raddr, struct in6_addr *raddr,
struct in6_addr *laddr, struct in6_addr *laddr,
int iif) int iif)
{ {
struct tcp_listen_opt *lopt = tp->listen_opt; struct tcp_listen_opt *lopt = tp->listen_opt;
struct open_request *req, **prev; struct request_sock *req, **prev;
for (prev = &lopt->syn_table[tcp_v6_synq_hash(raddr, rport, lopt->hash_rnd)]; for (prev = &lopt->syn_table[tcp_v6_synq_hash(raddr, rport, lopt->hash_rnd)];
(req = *prev) != NULL; (req = *prev) != NULL;
@ -410,7 +410,7 @@ static struct open_request *tcp_v6_search_req(struct tcp_sock *tp,
const struct tcp6_request_sock *treq = tcp6_rsk(req); const struct tcp6_request_sock *treq = tcp6_rsk(req);
if (inet_rsk(req)->rmt_port == rport && if (inet_rsk(req)->rmt_port == rport &&
req->class->family == AF_INET6 && req->rsk_ops->family == AF_INET6 &&
ipv6_addr_equal(&treq->rmt_addr, raddr) && ipv6_addr_equal(&treq->rmt_addr, raddr) &&
ipv6_addr_equal(&treq->loc_addr, laddr) && ipv6_addr_equal(&treq->loc_addr, laddr) &&
(!treq->iif || treq->iif == iif)) { (!treq->iif || treq->iif == iif)) {
@ -908,9 +908,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
icmpv6_err_convert(type, code, &err); icmpv6_err_convert(type, code, &err);
/* Might be for an open_request */ /* Might be for an request_sock */
switch (sk->sk_state) { switch (sk->sk_state) {
struct open_request *req, **prev; struct request_sock *req, **prev;
case TCP_LISTEN: case TCP_LISTEN:
if (sock_owned_by_user(sk)) if (sock_owned_by_user(sk))
goto out; goto out;
@ -959,7 +959,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
} }
static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
struct dst_entry *dst) struct dst_entry *dst)
{ {
struct tcp6_request_sock *treq = tcp6_rsk(req); struct tcp6_request_sock *treq = tcp6_rsk(req);
@ -1027,18 +1027,18 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req,
return err; return err;
} }
static void tcp_v6_or_free(struct open_request *req) static void tcp_v6_reqsk_destructor(struct request_sock *req)
{ {
if (tcp6_rsk(req)->pktopts) if (tcp6_rsk(req)->pktopts)
kfree_skb(tcp6_rsk(req)->pktopts); kfree_skb(tcp6_rsk(req)->pktopts);
} }
static struct or_calltable or_ipv6 = { static struct request_sock_ops tcp6_request_sock_ops = {
.family = AF_INET6, .family = AF_INET6,
.obj_size = sizeof(struct tcp6_request_sock), .obj_size = sizeof(struct tcp6_request_sock),
.rtx_syn_ack = tcp_v6_send_synack, .rtx_syn_ack = tcp_v6_send_synack,
.send_ack = tcp_v6_or_send_ack, .send_ack = tcp_v6_reqsk_send_ack,
.destructor = tcp_v6_or_free, .destructor = tcp_v6_reqsk_destructor,
.send_reset = tcp_v6_send_reset .send_reset = tcp_v6_send_reset
}; };
@ -1223,7 +1223,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb)
tcp_tw_put(tw); tcp_tw_put(tw);
} }
static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req) static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req)
{ {
tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent); tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent);
} }
@ -1231,7 +1231,7 @@ static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req)
static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
{ {
struct open_request *req, **prev; struct request_sock *req, **prev;
struct tcphdr *th = skb->h.th; struct tcphdr *th = skb->h.th;
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct sock *nsk; struct sock *nsk;
@ -1264,7 +1264,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
return sk; return sk;
} }
static void tcp_v6_synq_add(struct sock *sk, struct open_request *req) static void tcp_v6_synq_add(struct sock *sk, struct request_sock *req)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct tcp_listen_opt *lopt = tp->listen_opt; struct tcp_listen_opt *lopt = tp->listen_opt;
@ -1292,7 +1292,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
struct tcp_options_received tmp_opt; struct tcp_options_received tmp_opt;
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct open_request *req = NULL; struct request_sock *req = NULL;
__u32 isn = TCP_SKB_CB(skb)->when; __u32 isn = TCP_SKB_CB(skb)->when;
if (skb->protocol == htons(ETH_P_IP)) if (skb->protocol == htons(ETH_P_IP))
@ -1313,7 +1313,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1)
goto drop; goto drop;
req = tcp_openreq_alloc(&or_ipv6); req = reqsk_alloc(&tcp6_request_sock_ops);
if (req == NULL) if (req == NULL)
goto drop; goto drop;
@ -1358,14 +1358,14 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
drop: drop:
if (req) if (req)
tcp_openreq_free(req); reqsk_free(req);
TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
return 0; /* don't send reset */ return 0; /* don't send reset */
} }
static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
struct open_request *req, struct request_sock *req,
struct dst_entry *dst) struct dst_entry *dst)
{ {
struct tcp6_request_sock *treq = tcp6_rsk(req); struct tcp6_request_sock *treq = tcp6_rsk(req);
@ -2055,7 +2055,7 @@ static int tcp_v6_destroy_sock(struct sock *sk)
/* Proc filesystem TCPv6 sock list dumping. */ /* Proc filesystem TCPv6 sock list dumping. */
static void get_openreq6(struct seq_file *seq, static void get_openreq6(struct seq_file *seq,
struct sock *sk, struct open_request *req, int i, int uid) struct sock *sk, struct request_sock *req, int i, int uid)
{ {
struct in6_addr *dest, *src; struct in6_addr *dest, *src;
int ttd = req->expires - jiffies; int ttd = req->expires - jiffies;
@ -2244,7 +2244,7 @@ struct proto tcpv6_prot = {
.sysctl_rmem = sysctl_tcp_rmem, .sysctl_rmem = sysctl_tcp_rmem,
.max_header = MAX_TCP_HEADER, .max_header = MAX_TCP_HEADER,
.obj_size = sizeof(struct tcp6_sock), .obj_size = sizeof(struct tcp6_sock),
.rsk_prot = &or_ipv6, .rsk_prot = &tcp6_request_sock_ops,
}; };
static struct inet6_protocol tcpv6_protocol = { static struct inet6_protocol tcpv6_protocol = {