DCCP protocol discussions
 help / color / mirror / Atom feed
* [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the
@ 2008-04-08 17:27 Pavel Emelyanov
  2008-04-08 18:18 ` [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on Arnaldo Carvalho de Melo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2008-04-08 17:27 UTC (permalink / raw)
  To: dccp

And replace all its usage with init_net's socket.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---
 include/net/netns/dccp.h |    1 +
 net/dccp/ipv6.c          |   16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h
index e4f16fa..98d2a7c 100644
--- a/include/net/netns/dccp.h
+++ b/include/net/netns/dccp.h
@@ -5,6 +5,7 @@ struct sock;
 
 struct netns_dccp {
 	struct sock *v4_ctl_sk;
+	struct sock *v6_ctl_sk;
 };
 
 #endif
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 2ca5291..109dab3 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -33,8 +33,7 @@
 #include "ipv6.h"
 #include "feat.h"
 
-/* Socket used for sending RSTs and ACKs */
-static struct sock *dccp_v6_ctl_sk;
+/* dccp_v6_ctl_sk is used for sending RSTs and ACKs */
 
 static struct inet_connection_sock_af_ops dccp_ipv6_mapped;
 static struct inet_connection_sock_af_ops dccp_ipv6_af_ops;
@@ -296,6 +295,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
 	struct ipv6hdr *rxip6h;
 	struct sk_buff *skb;
 	struct flowi fl;
+	struct sock *ctl_sk = init_net.dccp.v6_ctl_sk;
 
 	if (dccp_hdr(rxskb)->dccph_type = DCCP_PKT_RESET)
 		return;
@@ -303,7 +303,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
 	if (!ipv6_unicast_destination(rxskb))
 		return;
 
-	skb = dccp_ctl_make_reset(dccp_v6_ctl_sk, rxskb);
+	skb = dccp_ctl_make_reset(ctl_sk, rxskb);
 	if (skb = NULL)
 		return;
 
@@ -322,9 +322,9 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
 	security_skb_classify_flow(rxskb, &fl);
 
 	/* sk = NULL, but it is safe for now. RST socket required. */
-	if (!ip6_dst_lookup(dccp_v6_ctl_sk, &skb->dst, &fl)) {
+	if (!ip6_dst_lookup(ctl_sk, &skb->dst, &fl)) {
 		if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) {
-			ip6_xmit(dccp_v6_ctl_sk, skb, &fl, NULL, 0);
+			ip6_xmit(ctl_sk, skb, &fl, NULL, 0);
 			DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
 			DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
 			return;
@@ -1198,7 +1198,7 @@ static int __init dccp_v6_init(void)
 
 	inet6_register_protosw(&dccp_v6_protosw);
 
-	err = inet_ctl_sock_create(&dccp_v6_ctl_sk, PF_INET6,
+	err = inet_ctl_sock_create(&init_net.dccp.v6_ctl_sk, PF_INET6,
 				   SOCK_DCCP, IPPROTO_DCCP, &init_net);
 	if (err != 0)
 		goto out_unregister_protosw;
@@ -1210,7 +1210,7 @@ out:
 	return err;
 
 out_destroy_ctl_sock:
-	inet_ctl_sock_destroy(dccp_v6_ctl_sk);
+	inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
 out_unregister_protosw:
 	inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
 	inet6_unregister_protosw(&dccp_v6_protosw);
@@ -1222,7 +1222,7 @@ out_unregister_proto:
 static void __exit dccp_v6_exit(void)
 {
 	unregister_pernet_subsys(&dccp_v6_ops);
-	inet_ctl_sock_destroy(dccp_v6_ctl_sk);
+	inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
 	inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
 	inet6_unregister_protosw(&dccp_v6_protosw);
 	proto_unregister(&dccp_v6_prot);
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on
  2008-04-08 17:27 [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the Pavel Emelyanov
@ 2008-04-08 18:18 ` Arnaldo Carvalho de Melo
  2008-04-08 18:20 ` Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-04-08 18:18 UTC (permalink / raw)
  To: dccp

Em Tue, Apr 08, 2008 at 09:27:37PM +0400, Pavel Emelyanov escreveu:
> And replace all its usage with init_net's socket.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> ---
>  include/net/netns/dccp.h |    1 +
>  net/dccp/ipv6.c          |   16 ++++++++--------
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h
> index e4f16fa..98d2a7c 100644
> --- a/include/net/netns/dccp.h
> +++ b/include/net/netns/dccp.h
> @@ -5,6 +5,7 @@ struct sock;
>  
>  struct netns_dccp {
>  	struct sock *v4_ctl_sk;
> +	struct sock *v6_ctl_sk;
>  };
>  
>  #endif
> diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
> index 2ca5291..109dab3 100644
> --- a/net/dccp/ipv6.c
> +++ b/net/dccp/ipv6.c
> @@ -33,8 +33,7 @@
>  #include "ipv6.h"
>  #include "feat.h"
>  
> -/* Socket used for sending RSTs and ACKs */
> -static struct sock *dccp_v6_ctl_sk;
> +/* dccp_v6_ctl_sk is used for sending RSTs and ACKs */

Wrong comment?
  
>  static struct inet_connection_sock_af_ops dccp_ipv6_mapped;
>  static struct inet_connection_sock_af_ops dccp_ipv6_af_ops;
> @@ -296,6 +295,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
>  	struct ipv6hdr *rxip6h;
>  	struct sk_buff *skb;
>  	struct flowi fl;
> +	struct sock *ctl_sk = init_net.dccp.v6_ctl_sk;
>  
>  	if (dccp_hdr(rxskb)->dccph_type = DCCP_PKT_RESET)
>  		return;
> @@ -303,7 +303,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
>  	if (!ipv6_unicast_destination(rxskb))
>  		return;
>  
> -	skb = dccp_ctl_make_reset(dccp_v6_ctl_sk, rxskb);
> +	skb = dccp_ctl_make_reset(ctl_sk, rxskb);
>  	if (skb = NULL)
>  		return;
>  
> @@ -322,9 +322,9 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
>  	security_skb_classify_flow(rxskb, &fl);
>  
>  	/* sk = NULL, but it is safe for now. RST socket required. */
> -	if (!ip6_dst_lookup(dccp_v6_ctl_sk, &skb->dst, &fl)) {
> +	if (!ip6_dst_lookup(ctl_sk, &skb->dst, &fl)) {
>  		if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) {
> -			ip6_xmit(dccp_v6_ctl_sk, skb, &fl, NULL, 0);
> +			ip6_xmit(ctl_sk, skb, &fl, NULL, 0);
>  			DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
>  			DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
>  			return;
> @@ -1198,7 +1198,7 @@ static int __init dccp_v6_init(void)
>  
>  	inet6_register_protosw(&dccp_v6_protosw);
>  
> -	err = inet_ctl_sock_create(&dccp_v6_ctl_sk, PF_INET6,
> +	err = inet_ctl_sock_create(&init_net.dccp.v6_ctl_sk, PF_INET6,
>  				   SOCK_DCCP, IPPROTO_DCCP, &init_net);
>  	if (err != 0)
>  		goto out_unregister_protosw;
> @@ -1210,7 +1210,7 @@ out:
>  	return err;
>  
>  out_destroy_ctl_sock:
> -	inet_ctl_sock_destroy(dccp_v6_ctl_sk);
> +	inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
>  out_unregister_protosw:
>  	inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
>  	inet6_unregister_protosw(&dccp_v6_protosw);
> @@ -1222,7 +1222,7 @@ out_unregister_proto:
>  static void __exit dccp_v6_exit(void)
>  {
>  	unregister_pernet_subsys(&dccp_v6_ops);
> -	inet_ctl_sock_destroy(dccp_v6_ctl_sk);
> +	inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
>  	inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
>  	inet6_unregister_protosw(&dccp_v6_protosw);
>  	proto_unregister(&dccp_v6_prot);
> -- 
> 1.5.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dccp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on
  2008-04-08 17:27 [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the Pavel Emelyanov
  2008-04-08 18:18 ` [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on Arnaldo Carvalho de Melo
@ 2008-04-08 18:20 ` Arnaldo Carvalho de Melo
  2008-04-09  6:49 ` Pavel Emelyanov
  2008-04-14  5:38 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-04-08 18:20 UTC (permalink / raw)
  To: dccp

Em Tue, Apr 08, 2008 at 03:18:04PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Apr 08, 2008 at 09:27:37PM +0400, Pavel Emelyanov escreveu:
> > And replace all its usage with init_net's socket.
> > 
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> >  
> > -/* Socket used for sending RSTs and ACKs */
> > -static struct sock *dccp_v6_ctl_sk;
> > +/* dccp_v6_ctl_sk is used for sending RSTs and ACKs */
> 
> Wrong comment?
>   

Other than this:

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

for the whole series.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on
  2008-04-08 17:27 [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the Pavel Emelyanov
  2008-04-08 18:18 ` [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on Arnaldo Carvalho de Melo
  2008-04-08 18:20 ` Arnaldo Carvalho de Melo
@ 2008-04-09  6:49 ` Pavel Emelyanov
  2008-04-14  5:38 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2008-04-09  6:49 UTC (permalink / raw)
  To: dccp

>> -/* Socket used for sending RSTs and ACKs */
>> -static struct sock *dccp_v6_ctl_sk;
>> +/* dccp_v6_ctl_sk is used for sending RSTs and ACKs */
> 
> Wrong comment?

Well, I tried to keep the comment, but it seems like the new
version is not much better than the old one :( I'll try to 
improve that...

Thanks,
Pavel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on
  2008-04-08 17:27 [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the Pavel Emelyanov
                   ` (2 preceding siblings ...)
  2008-04-09  6:49 ` Pavel Emelyanov
@ 2008-04-14  5:38 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2008-04-14  5:38 UTC (permalink / raw)
  To: dccp

From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Tue, 8 Apr 2008 15:18:04 -0300

> Em Tue, Apr 08, 2008 at 09:27:37PM +0400, Pavel Emelyanov escreveu:
> > diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
> > index 2ca5291..109dab3 100644
> > --- a/net/dccp/ipv6.c
> > +++ b/net/dccp/ipv6.c
> > @@ -33,8 +33,7 @@
> >  #include "ipv6.h"
> >  #include "feat.h"
> >  
> > -/* Socket used for sending RSTs and ACKs */
> > -static struct sock *dccp_v6_ctl_sk;
> > +/* dccp_v6_ctl_sk is used for sending RSTs and ACKs */
> 
> Wrong comment?

Pavel, please send a patch to fix this up, relative to net-2.6.26

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-14  5:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-08 17:27 [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the Pavel Emelyanov
2008-04-08 18:18 ` [RFC][PATCH 10/12][NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on Arnaldo Carvalho de Melo
2008-04-08 18:20 ` Arnaldo Carvalho de Melo
2008-04-09  6:49 ` Pavel Emelyanov
2008-04-14  5:38 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox