aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-17 21:32:26 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-17 22:01:55 -0400
commit407640de2152e33341ce1131dac269672c3d50f7 (patch)
treedec463be332bf8e0360d495d355e90cd9b80bd26 /net/dccp
parent9f2dbdd9b11d40f5fe0749eb91cd1cfc86fde575 (diff)
inet: add sk_listener argument to inet_reqsk_alloc()
listener socket can be used to set net pointer, and will be later used to hold a reference on listener. Add a const qualifier to first argument (struct request_sock_ops *), and factorize all write_pnet(&ireq->ireq_net, sock_net(sk)); Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ipv4.c3
-rw-r--r--net/dccp/ipv6.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 7f6456afbaec..bf897829f4f0 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -624,7 +624,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
624 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) 624 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
625 goto drop; 625 goto drop;
626 626
627 req = inet_reqsk_alloc(&dccp_request_sock_ops); 627 req = inet_reqsk_alloc(&dccp_request_sock_ops, sk);
628 if (req == NULL) 628 if (req == NULL)
629 goto drop; 629 goto drop;
630 630
@@ -641,7 +641,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
641 ireq = inet_rsk(req); 641 ireq = inet_rsk(req);
642 ireq->ir_loc_addr = ip_hdr(skb)->daddr; 642 ireq->ir_loc_addr = ip_hdr(skb)->daddr;
643 ireq->ir_rmt_addr = ip_hdr(skb)->saddr; 643 ireq->ir_rmt_addr = ip_hdr(skb)->saddr;
644 write_pnet(&ireq->ireq_net, sock_net(sk));
645 ireq->ireq_family = AF_INET; 644 ireq->ireq_family = AF_INET;
646 ireq->ir_iif = sk->sk_bound_dev_if; 645 ireq->ir_iif = sk->sk_bound_dev_if;
647 646
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 5166b0043f95..d7e7c7b0a3f1 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -386,7 +386,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
386 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) 386 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
387 goto drop; 387 goto drop;
388 388
389 req = inet_reqsk_alloc(&dccp6_request_sock_ops); 389 req = inet_reqsk_alloc(&dccp6_request_sock_ops, sk);
390 if (req == NULL) 390 if (req == NULL)
391 goto drop; 391 goto drop;
392 392
@@ -403,7 +403,6 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
403 ireq = inet_rsk(req); 403 ireq = inet_rsk(req);
404 ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; 404 ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
405 ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; 405 ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
406 write_pnet(&ireq->ireq_net, sock_net(sk));
407 ireq->ireq_family = AF_INET6; 406 ireq->ireq_family = AF_INET6;
408 407
409 if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) || 408 if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) ||