Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: netfilter@lists.netfilter.org
Subject: Masquerade based on skb->mark ?
Date: Tue, 24 Apr 2007 20:06:52 -0700	[thread overview]
Message-ID: <462EC5CC.4080300@candelatech.com> (raw)

I'm now trying to masquerade packets that have been marked
a certain way.  I'm using these commands:

# I'm not sure this is doing the right thing, but it is not giving errors.
iptables -A POSTROUTING -t nat -j MASQUERADE -m mark --mark 10001

# This appears to work as planned.
iptables -t mangle -A PREROUTING -i eth1  -j MARK --set-mark 10001
iptables -t mangle -A PREROUTING -i eth2  -j MARK --set-mark 10001

I added a u32 'mark' field to the conn-track tuple, and I now get
different conn-tracking objects for the same source/dest but with
different 'mark'.  However, the ct->status bit does not have the
IPS_SRC_NAT flag set.

I think I need to figure out what code creates the initial conn-track
and make sure it is setting the status bits correctly based on the
skb->mark, but I am not sure where this code exists.

Any ideas on where to start looking?  I've been trying to follow
the code path in the netfilter/nat logic, but it's proving
slow going!

Thanks,
Ben

PS.  If anyone does this sort of work for hire, please contact me off-list.

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



             reply	other threads:[~2007-04-25  3:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25  3:06 Ben Greear [this message]
2007-04-26 18:51 ` Masquerade based on skb->mark ? Jan Engelhardt
2007-04-26 19:20   ` Ben Greear
2007-04-26 19:24     ` Jan Engelhardt
2007-04-26 20:27       ` Ben Greear
2007-04-27  6:24         ` Jan Engelhardt
2007-04-27 18:23         ` Pascal Hambourg

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=462EC5CC.4080300@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=netfilter@lists.netfilter.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