inet: drop prev pointer handling in request sock
When request sock are put in ehash table, the whole notion of having a previous request to update dl_next is pointless. Also, following patch will get rid of big purge timer, so we want to delete a request sock without holding listener lock. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
a998f712f7
commit
52452c5425
@@ -280,8 +280,7 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst);
|
||||
struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||
struct request_sock *req,
|
||||
struct request_sock **prev);
|
||||
struct request_sock *req);
|
||||
|
||||
int dccp_child_process(struct sock *parent, struct sock *child,
|
||||
struct sk_buff *skb);
|
||||
|
@@ -288,11 +288,11 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
|
||||
}
|
||||
|
||||
switch (sk->sk_state) {
|
||||
struct request_sock *req , **prev;
|
||||
struct request_sock *req;
|
||||
case DCCP_LISTEN:
|
||||
if (sock_owned_by_user(sk))
|
||||
goto out;
|
||||
req = inet_csk_search_req(sk, &prev, dh->dccph_dport,
|
||||
req = inet_csk_search_req(sk, dh->dccph_dport,
|
||||
iph->daddr, iph->saddr);
|
||||
if (!req)
|
||||
goto out;
|
||||
@@ -314,7 +314,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
|
||||
* created socket, and POSIX does not want network
|
||||
* errors returned from accept().
|
||||
*/
|
||||
inet_csk_reqsk_queue_drop(sk, req, prev);
|
||||
inet_csk_reqsk_queue_drop(sk, req);
|
||||
goto out;
|
||||
|
||||
case DCCP_REQUESTING:
|
||||
@@ -448,13 +448,11 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
|
||||
const struct dccp_hdr *dh = dccp_hdr(skb);
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
struct sock *nsk;
|
||||
struct request_sock **prev;
|
||||
/* Find possible connection requests. */
|
||||
struct request_sock *req = inet_csk_search_req(sk, &prev,
|
||||
dh->dccph_sport,
|
||||
struct request_sock *req = inet_csk_search_req(sk, dh->dccph_sport,
|
||||
iph->saddr, iph->daddr);
|
||||
if (req != NULL)
|
||||
return dccp_check_req(sk, skb, req, prev);
|
||||
if (req)
|
||||
return dccp_check_req(sk, skb, req);
|
||||
|
||||
nsk = inet_lookup_established(sock_net(sk), &dccp_hashinfo,
|
||||
iph->saddr, dh->dccph_sport,
|
||||
|
@@ -149,12 +149,12 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
|
||||
/* Might be for an request_sock */
|
||||
switch (sk->sk_state) {
|
||||
struct request_sock *req, **prev;
|
||||
struct request_sock *req;
|
||||
case DCCP_LISTEN:
|
||||
if (sock_owned_by_user(sk))
|
||||
goto out;
|
||||
|
||||
req = inet6_csk_search_req(sk, &prev, dh->dccph_dport,
|
||||
req = inet6_csk_search_req(sk, dh->dccph_dport,
|
||||
&hdr->daddr, &hdr->saddr,
|
||||
inet6_iif(skb));
|
||||
if (req == NULL)
|
||||
@@ -172,7 +172,7 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
goto out;
|
||||
}
|
||||
|
||||
inet_csk_reqsk_queue_drop(sk, req, prev);
|
||||
inet_csk_reqsk_queue_drop(sk, req);
|
||||
goto out;
|
||||
|
||||
case DCCP_REQUESTING:
|
||||
@@ -317,16 +317,13 @@ static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
|
||||
{
|
||||
const struct dccp_hdr *dh = dccp_hdr(skb);
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
struct request_sock *req;
|
||||
struct sock *nsk;
|
||||
struct request_sock **prev;
|
||||
/* Find possible connection requests. */
|
||||
struct request_sock *req = inet6_csk_search_req(sk, &prev,
|
||||
dh->dccph_sport,
|
||||
&iph->saddr,
|
||||
&iph->daddr,
|
||||
inet6_iif(skb));
|
||||
|
||||
req = inet6_csk_search_req(sk, dh->dccph_sport, &iph->saddr,
|
||||
&iph->daddr, inet6_iif(skb));
|
||||
if (req != NULL)
|
||||
return dccp_check_req(sk, skb, req, prev);
|
||||
return dccp_check_req(sk, skb, req);
|
||||
|
||||
nsk = __inet6_lookup_established(sock_net(sk), &dccp_hashinfo,
|
||||
&iph->saddr, dh->dccph_sport,
|
||||
|
@@ -152,8 +152,7 @@ EXPORT_SYMBOL_GPL(dccp_create_openreq_child);
|
||||
* 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 request_sock *req)
|
||||
{
|
||||
struct sock *child = NULL;
|
||||
struct dccp_request_sock *dreq = dccp_rsk(req);
|
||||
@@ -200,7 +199,7 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||
if (child == NULL)
|
||||
goto listen_overflow;
|
||||
|
||||
inet_csk_reqsk_queue_unlink(sk, req, prev);
|
||||
inet_csk_reqsk_queue_unlink(sk, req);
|
||||
inet_csk_reqsk_queue_removed(sk, req);
|
||||
inet_csk_reqsk_queue_add(sk, req, child);
|
||||
out:
|
||||
@@ -212,7 +211,7 @@ drop:
|
||||
if (dccp_hdr(skb)->dccph_type != DCCP_PKT_RESET)
|
||||
req->rsk_ops->send_reset(sk, skb);
|
||||
|
||||
inet_csk_reqsk_queue_drop(sk, req, prev);
|
||||
inet_csk_reqsk_queue_drop(sk, req);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user