Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Bob Miller <bob@computerisms.ca>
To: netfilter@vger.kernel.org
Subject: packet marking
Date: Wed, 04 Mar 2015 14:04:23 -0800	[thread overview]
Message-ID: <54F78167.6070104@computerisms.ca> (raw)

I have been reading man pages and googling and I am not finding 
understanding.  maybe somebody can explain:

under my mangle table (using iptables-restore to load):

-A PREROUTING -p udp -m udp --dport 4500 -j MARK --set-mark 30
-A PREROUTING -s 192.168.171.0/24 -m mark ! --mark 30 -j MARK --set-mark 40
-A PREROUTING -m mark --mark 30 -j LOG --log-prefix vpnX30
-A PREROUTING -m mark --mark 40 -j LOG --log-prefix vpnX40

This logs packets with both marks.

If I change the LOG target to POSTROUTING, like so:

-A POSTROUTING -m mark --mark 30 -j LOG --log-prefix vpnX30
-A POSTROUTING -m mark --mark 40 -j LOG --log-prefix vpnX40

only packets with the mark 40 are logged.  I think it should log both.

If I consult the nfpacket flow chart, nat/PREROUTING comes after 
mangle/PREROUTING, and I cannot log packets with a mark of 30 there either.

Traffic keeps flowing, so the packets themselves are not being dropped, 
but the mark apparently is not passed from the initial chain. Everything 
I have read indicates it should be.  what could I have done (or not 
done) to make this happen?  Or better yet, what should I be reading that 
would explain this?  I get the feeling I am overlooking something really 
obvious...
-- 
Computerisms
Bob Miller
867-334-7117 / 867-633-3760
http://computerisms.ca

             reply	other threads:[~2015-03-04 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 22:04 Bob Miller [this message]
2015-03-05  7:01 ` packet marking Michal Kubecek
2015-03-05 19:44 ` Sebastian Pöhn

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=54F78167.6070104@computerisms.ca \
    --to=bob@computerisms.ca \
    --cc=netfilter@vger.kernel.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