From: Hans Schillstrom <hans.schillstrom@ericsson•com>
To: Simon Horman <horms@verge•net.au>
Cc: "lvs-devel@vger•kernel.org" <lvs-devel@vger•kernel.org>,
"netdev@vger•kernel.org" <netdev@vger•kernel.org>,
"netfilter-devel@vger•kernel.org"
<netfilter-devel@vger•kernel.org>, "ja@ssi•bg" <ja@ssi•bg>,
"wensong@linux-vs•org" <wensong@linux-vs•org>,
"daniel.lezcano@free•fr" <daniel.lezcano@free•fr>
Subject: Re: [RFC PATCH 5/9] ipvs network name space aware
Date: Thu, 21 Oct 2010 13:42:41 +0200 [thread overview]
Message-ID: <201010211342.42833.hans.schillstrom@ericsson.com> (raw)
In-Reply-To: <20101021111644.GA25555@verge.net.au>
On Thursday 21 October 2010 13:16:47 Simon Horman wrote:
> On Fri, Oct 08, 2010 at 01:17:02PM +0200, Hans Schillstrom wrote:
> > This patch just contains ip_vs_ctl
> >
> > Signed-off-by:Hans Schillstrom <hans.schillstrom@ericsson•com>
> >
> > diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> > index ca8ec8c..7e99cbc 100644
> > --- a/net/netfilter/ipvs/ip_vs_ctl.c
> > +++ b/net/netfilter/ipvs/ip_vs_ctl.c
>
> [ snip ]
>
> > @@ -2680,10 +2664,15 @@ static int ip_vs_genl_dump_services(struct sk_buff *skb,
> > int idx = 0, i;
> > int start = cb->args[0];
> > struct ip_vs_service *svc;
> > -
> > + struct net *net = skb->sk->sk_net;
>
> skb->sk->sk_net needs CONFIG_NS_NET.
> Is your plan for IPVS to unconditionally depend on CONFIG_NS_NET?
No.
> It would be nice to avoid that, but I fear it will be too messy.
Crap, I missed that.
I think a couple of inlines in ip_vs.h can do the job like;
static inline struct net * ipvs_sknet(struct sock *sk)
{
#ifdef CONFIG_NS_NET
return sk->sk_net;
#else
return init_net;
#endif
}
static inline struct net * ipvs_devnet(struct skb *skb)
{
#ifdef CONFIG_NS_NET
return dev_net(skb->dev);
#else
return init_net;
#endif
}
and use it like this
struct net *net = ipvs_sknet(skb->sk);
> > + struct netns_ipvs *ipvs;
> > + if (!net)
> > + net = dev_net(dev_net(skb->dev););
net = ipvs_devnet(skb->dev);
> > + BUG_ON(!net);
> > + ipvs = net->ipvs;
> > mutex_lock(&__ip_vs_mutex);
> > for (i = 0; i < IP_VS_SVC_TAB_SIZE; i++) {
> > - list_for_each_entry(svc, &ip_vs_svc_table[i], s_list) {
> > + list_for_each_entry(svc, &ipvs->ctl_svc_table[i], s_list) {
> > if (++idx <= start)
> > continue;
> > if (ip_vs_genl_dump_service(skb, svc, cb) < 0) {
>
> [ snip ]
> --
--
Regards
Hans Schillstrom <hans.schillstrom@ericsson•com>
next prev parent reply other threads:[~2010-10-21 11:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 11:17 [RFC PATCH 5/9] ipvs network name space aware Hans Schillstrom
2010-10-20 15:21 ` Simon Horman
2010-10-21 7:35 ` Hans Schillstrom
2010-10-21 8:27 ` Horms
2010-10-21 11:16 ` Simon Horman
2010-10-21 11:26 ` Eric Dumazet
2010-10-21 11:49 ` Hans Schillstrom
2010-10-21 14:34 ` Simon Horman
2010-10-21 11:42 ` Hans Schillstrom [this message]
2010-10-21 22:56 ` Julian Anastasov
2010-10-22 19:05 ` Simon Horman
2010-10-26 13:07 ` Hans Schillstrom
2010-10-26 21:03 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201010211342.42833.hans.schillstrom@ericsson.com \
--to=hans.schillstrom@ericsson$(echo .)com \
--cc=daniel.lezcano@free$(echo .)fr \
--cc=horms@verge$(echo .)net.au \
--cc=ja@ssi$(echo .)bg \
--cc=lvs-devel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=wensong@linux-vs$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox