[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090903110349.GA5393@verge.net.au>
Date: Thu, 3 Sep 2009 21:04:13 +1000
From: Simon Horman <horms@...ge.net.au>
To: Hannes Eder <heder@...gle.com>
Cc: Patrick McHardy <kaber@...sh.net>, lvs-devel@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org,
Fabien Duchêne <mad_fab@...net.be>,
Jan Engelhardt <jengelh@...ozas.de>,
Jean-Luc Fortemaison <jl.fortemaison@...ouvain.be>,
Julian Anastasov <ja@....bg>,
Julius Volz <julius.volz@...il.com>,
Laurent Grawet <laurent.grawet@...ouvain.be>,
Wensong Zhang <wensong@...ux-vs.org>
Subject: Re: [PATCH 2/3] IPVS: make friends with nf_conntrack
On Thu, Sep 03, 2009 at 12:22:53PM +0200, Hannes Eder wrote:
> On Wed, Sep 2, 2009 at 16:56, Patrick McHardy<kaber@...sh.net> wrote:
> > Hannes Eder wrote:
> >> Update the nf_conntrack tuple in reply direction, as we will see
> >> traffic from the real server (RIP) to the client (CIP). Once this is
> >> done we can use netfilters SNAT in POSTROUTING, especially with
> >> xt_ipvs, to do source NAT, e.g.:
> >>
> >> % iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 --vport 8080 \
> >>> -j SNAT --to-source 192.168.10.10
> >>
> >
> >> +static void
> >> +ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp)
> >> +{
> >> + struct nf_conn *ct = (struct nf_conn *)skb->nfct;
> >> +
> >> + if (ct == NULL || ct == &nf_conntrack_untracked ||
> >> + nf_ct_is_confirmed(ct))
> >> + return;
> >> +
> >> + /*
> >> + * The connection is not yet in the hashtable, so we update it.
> >> + * CIP->VIP will remain the same, so leave the tuple in
> >> + * IP_CT_DIR_ORIGINAL untouched. When the reply comes back from the
> >> + * real-server we will see RIP->DIP.
> >> + */
> >> + ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3 = cp->daddr;
> >> + /*
> >> + * This will also take care of UDP and other protocols.
> >> + */
> >> + ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u.tcp.port = cp->dport;
> >> +}
> >
> > How does IPVS interact with conntrack helpers? If it does actually
> > intend to use them (which will happen automatically), it might make
> > sense to use nf_conntrack_alter_reply(), which will perform a new
> > helper lookup based on the changed tuple.
>
> Good point, I'll use nf_conntrack_alter_reply(). IHMO IPVS only deals
> with ftp in a special way, I think something need to be done there as
> well, I'll investigate that.
Yes, I think that is correct. FTP is the only protocol helper in IPVS.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists