netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Eder <heder@google.com>
To: Patrick McHardy <kaber@trash.net>
Cc: lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
	"Fabien Duchêne" <mad_fab@skynet.be>,
	"Jan Engelhardt" <jengelh@medozas.de>,
	"Jean-Luc Fortemaison" <jl.fortemaison@uclouvain.be>,
	"Julian Anastasov" <ja@ssi.bg>,
	"Julius Volz" <julius.volz@gmail.com>,
	"Laurent Grawet" <laurent.grawet@uclouvain.be>,
	"Simon Horman" <horms@verge.net.au>,
	"Wensong Zhang" <wensong@linux-vs.org>
Subject: Re: [PATCH 2/3] IPVS: make friends with nf_conntrack
Date: Thu, 3 Sep 2009 12:22:53 +0200	[thread overview]
Message-ID: <b5ddba180909030322h42aa9337o4c20696b86029b71@mail.gmail.com> (raw)
In-Reply-To: <4A9E8788.1090901@trash.net>

On Wed, Sep 2, 2009 at 16:56, Patrick McHardy<kaber@trash.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.

  reply	other threads:[~2009-09-03 10:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02 14:38 [PATCH 0/3] IPVS full NAT support + netfilter 'ipvs' match support Hannes Eder
2009-09-02 14:39 ` [PATCH 1/3] netfilter: xt_ipvs (netfilter matcher for IPVS) Hannes Eder
2009-09-02 14:54   ` Patrick McHardy
2009-09-02 15:33     ` Hannes Eder
2009-09-02 15:36       ` Patrick McHardy
2009-09-02 15:49         ` Jan Engelhardt
2009-09-02 16:05           ` Hannes Eder
2009-09-02 17:51           ` Patrick McHardy
2009-09-02 14:39 ` [PATCH 2/3] IPVS: make friends with nf_conntrack Hannes Eder
2009-09-02 14:56   ` Patrick McHardy
2009-09-03 10:22     ` Hannes Eder [this message]
2009-09-03 11:04       ` Simon Horman
2009-09-03 19:50   ` Julian Anastasov
2009-09-02 14:41 ` [PATCH 3/3] libxt_ipvs: user-space lib for netfilter matcher xt_ipvs Hannes Eder

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=b5ddba180909030322h42aa9337o4c20696b86029b71@mail.gmail.com \
    --to=heder@google.com \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=jengelh@medozas.de \
    --cc=jl.fortemaison@uclouvain.be \
    --cc=julius.volz@gmail.com \
    --cc=kaber@trash.net \
    --cc=laurent.grawet@uclouvain.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvs-devel@vger.kernel.org \
    --cc=mad_fab@skynet.be \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=wensong@linux-vs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).