diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2005-06-19 01:47:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-19 01:47:21 -0400 |
commit | 60236fdd08b2169045a3bbfc5ffe1576e6c3c17b (patch) | |
tree | 4541c682cc72daf560ec516e2b5868089a88b6ea /net/ipv4/tcp_ipv4.c | |
parent | 2e6599cb899ba4b133f42cbf9d2b1883d2dc583a (diff) |
[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>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index e156be90df14..95528a75a63d 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -36,7 +36,7 @@ | |||
36 | * ACK bit. | 36 | * ACK bit. |
37 | * Andi Kleen : Implemented fast path mtu discovery. | 37 | * Andi Kleen : Implemented fast path mtu discovery. |
38 | * Fixed many serious bugs in the | 38 | * Fixed many serious bugs in the |
39 | * open_request handling and moved | 39 | * request_sock handling and moved |
40 | * most of it into the af independent code. | 40 | * most of it into the af independent code. |
41 | * Added tail drop and some other bugfixes. | 41 | * Added tail drop and some other bugfixes. |
42 | * Added new listen sematics. | 42 | * Added new listen sematics. |
@@ -869,13 +869,13 @@ static __inline__ u32 tcp_v4_synq_hash(u32 raddr, u16 rport, u32 rnd) | |||
869 | return (jhash_2words(raddr, (u32) rport, rnd) & (TCP_SYNQ_HSIZE - 1)); | 869 | return (jhash_2words(raddr, (u32) rport, rnd) & (TCP_SYNQ_HSIZE - 1)); |
870 | } | 870 | } |
871 | 871 | ||
872 | static struct open_request *tcp_v4_search_req(struct tcp_sock *tp, | 872 | static struct request_sock *tcp_v4_search_req(struct tcp_sock *tp, |
873 | struct open_request ***prevp, | 873 | struct request_sock ***prevp, |
874 | __u16 rport, | 874 | __u16 rport, |
875 | __u32 raddr, __u32 laddr) | 875 | __u32 raddr, __u32 laddr) |
876 | { | 876 | { |
877 | struct tcp_listen_opt *lopt = tp->listen_opt; | 877 | struct tcp_listen_opt *lopt = tp->listen_opt; |
878 | struct open_request *req, **prev; | 878 | struct request_sock *req, **prev; |
879 | 879 | ||
880 | for (prev = &lopt->syn_table[tcp_v4_synq_hash(raddr, rport, lopt->hash_rnd)]; | 880 | for (prev = &lopt->syn_table[tcp_v4_synq_hash(raddr, rport, lopt->hash_rnd)]; |
881 | (req = *prev) != NULL; | 881 | (req = *prev) != NULL; |
@@ -885,7 +885,7 @@ static struct open_request *tcp_v4_search_req(struct tcp_sock *tp, | |||
885 | if (ireq->rmt_port == rport && | 885 | if (ireq->rmt_port == rport && |
886 | ireq->rmt_addr == raddr && | 886 | ireq->rmt_addr == raddr && |
887 | ireq->loc_addr == laddr && | 887 | ireq->loc_addr == laddr && |
888 | TCP_INET_FAMILY(req->class->family)) { | 888 | TCP_INET_FAMILY(req->rsk_ops->family)) { |
889 | BUG_TRAP(!req->sk); | 889 | BUG_TRAP(!req->sk); |
890 | *prevp = prev; | 890 | *prevp = prev; |
891 | break; | 891 | break; |
@@ -895,7 +895,7 @@ static struct open_request *tcp_v4_search_req(struct tcp_sock *tp, | |||
895 | return req; | 895 | return req; |
896 | } | 896 | } |
897 | 897 | ||
898 | static void tcp_v4_synq_add(struct sock *sk, struct open_request *req) | 898 | static void tcp_v4_synq_add(struct sock *sk, struct request_sock *req) |
899 | { | 899 | { |
900 | struct tcp_sock *tp = tcp_sk(sk); | 900 | struct tcp_sock *tp = tcp_sk(sk); |
901 | struct tcp_listen_opt *lopt = tp->listen_opt; | 901 | struct tcp_listen_opt *lopt = tp->listen_opt; |
@@ -1052,7 +1052,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info) | |||
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | switch (sk->sk_state) { | 1054 | switch (sk->sk_state) { |
1055 | struct open_request *req, **prev; | 1055 | struct request_sock *req, **prev; |
1056 | case TCP_LISTEN: | 1056 | case TCP_LISTEN: |
1057 | if (sock_owned_by_user(sk)) | 1057 | if (sock_owned_by_user(sk)) |
1058 | goto out; | 1058 | goto out; |
@@ -1256,14 +1256,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
1256 | tcp_tw_put(tw); | 1256 | tcp_tw_put(tw); |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | static void tcp_v4_or_send_ack(struct sk_buff *skb, struct open_request *req) | 1259 | static void tcp_v4_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) |
1260 | { | 1260 | { |
1261 | tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, | 1261 | tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, |
1262 | req->ts_recent); | 1262 | req->ts_recent); |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | static struct dst_entry* tcp_v4_route_req(struct sock *sk, | 1265 | static struct dst_entry* tcp_v4_route_req(struct sock *sk, |
1266 | struct open_request *req) | 1266 | struct request_sock *req) |
1267 | { | 1267 | { |
1268 | struct rtable *rt; | 1268 | struct rtable *rt; |
1269 | const struct inet_request_sock *ireq = inet_rsk(req); | 1269 | const struct inet_request_sock *ireq = inet_rsk(req); |
@@ -1294,10 +1294,10 @@ static struct dst_entry* tcp_v4_route_req(struct sock *sk, | |||
1294 | 1294 | ||
1295 | /* | 1295 | /* |
1296 | * Send a SYN-ACK after having received an ACK. | 1296 | * Send a SYN-ACK after having received an ACK. |
1297 | * This still operates on a open_request only, not on a big | 1297 | * This still operates on a request_sock only, not on a big |
1298 | * socket. | 1298 | * socket. |
1299 | */ | 1299 | */ |
1300 | static int tcp_v4_send_synack(struct sock *sk, struct open_request *req, | 1300 | static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req, |
1301 | struct dst_entry *dst) | 1301 | struct dst_entry *dst) |
1302 | { | 1302 | { |
1303 | const struct inet_request_sock *ireq = inet_rsk(req); | 1303 | const struct inet_request_sock *ireq = inet_rsk(req); |
@@ -1332,9 +1332,9 @@ out: | |||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | /* | 1334 | /* |
1335 | * IPv4 open_request destructor. | 1335 | * IPv4 request_sock destructor. |
1336 | */ | 1336 | */ |
1337 | static void tcp_v4_or_free(struct open_request *req) | 1337 | static void tcp_v4_reqsk_destructor(struct request_sock *req) |
1338 | { | 1338 | { |
1339 | if (inet_rsk(req)->opt) | 1339 | if (inet_rsk(req)->opt) |
1340 | kfree(inet_rsk(req)->opt); | 1340 | kfree(inet_rsk(req)->opt); |
@@ -1353,7 +1353,7 @@ static inline void syn_flood_warning(struct sk_buff *skb) | |||
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | /* | 1355 | /* |
1356 | * Save and compile IPv4 options into the open_request if needed. | 1356 | * Save and compile IPv4 options into the request_sock if needed. |
1357 | */ | 1357 | */ |
1358 | static inline struct ip_options *tcp_v4_save_options(struct sock *sk, | 1358 | static inline struct ip_options *tcp_v4_save_options(struct sock *sk, |
1359 | struct sk_buff *skb) | 1359 | struct sk_buff *skb) |
@@ -1389,12 +1389,12 @@ static inline struct ip_options *tcp_v4_save_options(struct sock *sk, | |||
1389 | */ | 1389 | */ |
1390 | int sysctl_max_syn_backlog = 256; | 1390 | int sysctl_max_syn_backlog = 256; |
1391 | 1391 | ||
1392 | struct or_calltable or_ipv4 = { | 1392 | struct request_sock_ops tcp_request_sock_ops = { |
1393 | .family = PF_INET, | 1393 | .family = PF_INET, |
1394 | .obj_size = sizeof(struct tcp_request_sock), | 1394 | .obj_size = sizeof(struct tcp_request_sock), |
1395 | .rtx_syn_ack = tcp_v4_send_synack, | 1395 | .rtx_syn_ack = tcp_v4_send_synack, |
1396 | .send_ack = tcp_v4_or_send_ack, | 1396 | .send_ack = tcp_v4_reqsk_send_ack, |
1397 | .destructor = tcp_v4_or_free, | 1397 | .destructor = tcp_v4_reqsk_destructor, |
1398 | .send_reset = tcp_v4_send_reset, | 1398 | .send_reset = tcp_v4_send_reset, |
1399 | }; | 1399 | }; |
1400 | 1400 | ||
@@ -1402,7 +1402,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1402 | { | 1402 | { |
1403 | struct inet_request_sock *ireq; | 1403 | struct inet_request_sock *ireq; |
1404 | struct tcp_options_received tmp_opt; | 1404 | struct tcp_options_received tmp_opt; |
1405 | struct open_request *req; | 1405 | struct request_sock *req; |
1406 | __u32 saddr = skb->nh.iph->saddr; | 1406 | __u32 saddr = skb->nh.iph->saddr; |
1407 | __u32 daddr = skb->nh.iph->daddr; | 1407 | __u32 daddr = skb->nh.iph->daddr; |
1408 | __u32 isn = TCP_SKB_CB(skb)->when; | 1408 | __u32 isn = TCP_SKB_CB(skb)->when; |
@@ -1439,7 +1439,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1439 | if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) | 1439 | if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) |
1440 | goto drop; | 1440 | goto drop; |
1441 | 1441 | ||
1442 | req = tcp_openreq_alloc(&or_ipv4); | 1442 | req = reqsk_alloc(&tcp_request_sock_ops); |
1443 | if (!req) | 1443 | if (!req) |
1444 | goto drop; | 1444 | goto drop; |
1445 | 1445 | ||
@@ -1535,14 +1535,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1535 | goto drop_and_free; | 1535 | goto drop_and_free; |
1536 | 1536 | ||
1537 | if (want_cookie) { | 1537 | if (want_cookie) { |
1538 | tcp_openreq_free(req); | 1538 | reqsk_free(req); |
1539 | } else { | 1539 | } else { |
1540 | tcp_v4_synq_add(sk, req); | 1540 | tcp_v4_synq_add(sk, req); |
1541 | } | 1541 | } |
1542 | return 0; | 1542 | return 0; |
1543 | 1543 | ||
1544 | drop_and_free: | 1544 | drop_and_free: |
1545 | tcp_openreq_free(req); | 1545 | reqsk_free(req); |
1546 | drop: | 1546 | drop: |
1547 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | 1547 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); |
1548 | return 0; | 1548 | return 0; |
@@ -1554,7 +1554,7 @@ drop: | |||
1554 | * now create the new socket. | 1554 | * now create the new socket. |
1555 | */ | 1555 | */ |
1556 | struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | 1556 | struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, |
1557 | struct open_request *req, | 1557 | struct request_sock *req, |
1558 | struct dst_entry *dst) | 1558 | struct dst_entry *dst) |
1559 | { | 1559 | { |
1560 | struct inet_request_sock *ireq; | 1560 | struct inet_request_sock *ireq; |
@@ -1613,9 +1613,9 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
1613 | struct iphdr *iph = skb->nh.iph; | 1613 | struct iphdr *iph = skb->nh.iph; |
1614 | struct tcp_sock *tp = tcp_sk(sk); | 1614 | struct tcp_sock *tp = tcp_sk(sk); |
1615 | struct sock *nsk; | 1615 | struct sock *nsk; |
1616 | struct open_request **prev; | 1616 | struct request_sock **prev; |
1617 | /* Find possible connection requests. */ | 1617 | /* Find possible connection requests. */ |
1618 | struct open_request *req = tcp_v4_search_req(tp, &prev, th->source, | 1618 | struct request_sock *req = tcp_v4_search_req(tp, &prev, th->source, |
1619 | iph->saddr, iph->daddr); | 1619 | iph->saddr, iph->daddr); |
1620 | if (req) | 1620 | if (req) |
1621 | return tcp_check_req(sk, skb, req, prev); | 1621 | return tcp_check_req(sk, skb, req, prev); |
@@ -2152,13 +2152,13 @@ static void *listening_get_next(struct seq_file *seq, void *cur) | |||
2152 | ++st->num; | 2152 | ++st->num; |
2153 | 2153 | ||
2154 | if (st->state == TCP_SEQ_STATE_OPENREQ) { | 2154 | if (st->state == TCP_SEQ_STATE_OPENREQ) { |
2155 | struct open_request *req = cur; | 2155 | struct request_sock *req = cur; |
2156 | 2156 | ||
2157 | tp = tcp_sk(st->syn_wait_sk); | 2157 | tp = tcp_sk(st->syn_wait_sk); |
2158 | req = req->dl_next; | 2158 | req = req->dl_next; |
2159 | while (1) { | 2159 | while (1) { |
2160 | while (req) { | 2160 | while (req) { |
2161 | if (req->class->family == st->family) { | 2161 | if (req->rsk_ops->family == st->family) { |
2162 | cur = req; | 2162 | cur = req; |
2163 | goto out; | 2163 | goto out; |
2164 | } | 2164 | } |
@@ -2459,7 +2459,7 @@ void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo) | |||
2459 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); | 2459 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | static void get_openreq4(struct sock *sk, struct open_request *req, | 2462 | static void get_openreq4(struct sock *sk, struct request_sock *req, |
2463 | char *tmpbuf, int i, int uid) | 2463 | char *tmpbuf, int i, int uid) |
2464 | { | 2464 | { |
2465 | const struct inet_request_sock *ireq = inet_rsk(req); | 2465 | const struct inet_request_sock *ireq = inet_rsk(req); |
@@ -2627,7 +2627,7 @@ struct proto tcp_prot = { | |||
2627 | .sysctl_rmem = sysctl_tcp_rmem, | 2627 | .sysctl_rmem = sysctl_tcp_rmem, |
2628 | .max_header = MAX_TCP_HEADER, | 2628 | .max_header = MAX_TCP_HEADER, |
2629 | .obj_size = sizeof(struct tcp_sock), | 2629 | .obj_size = sizeof(struct tcp_sock), |
2630 | .rsk_prot = &or_ipv4, | 2630 | .rsk_prot = &tcp_request_sock_ops, |
2631 | }; | 2631 | }; |
2632 | 2632 | ||
2633 | 2633 | ||