From: "Steve Iribarne (GMail)" <netstv@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: marking notification in the kernel
Date: Thu, 2 Apr 2009 10:15:50 -0700 [thread overview]
Message-ID: <b4b98b690904021015o2b5c6738qd8e3a39d0bca0e19@mail.gmail.com> (raw)
Hello.
I am currently writing a driver that uses the mark field in the
sk_buff data structure.
Particulars:
1.4.0 iptables (I want to use 1.4.3 but I'm getting some other strange
thing in my embedded linux world...)
Kernel 2.6.21.7 (mips 64 bit based)
Cavium Processor
So essentially I have dev->hard_start_xmit(..) function pointing to my
tx routine. I'm noticing that if I setup a mark:
ie.
iptables -t mangle -A OUTPUT -j MARK --set-mark 3
iptables -t mangle -A OUTPUT -j LOG --log-prefix "mangle-out: "
--log-level debug
iptables -t filter -A OUTPUT -j LOG --log-prefix "filter-out: "
--log-level debug
iptables -t mangle -A POSTROUTING -j LOG --log-prefix
"mangle-postroute: " --log-level debug
iptables -t nat -A POSTROUTING -j LOG --log-prefix "nat-postroute: "
--log-level debug
Interfaces: pow0/pow1 (which is like eth0 and eth1)
pow0: 10.100.100.109/24
pow1: 10.101.100.1/24
If I try to ping 10.100.100.1 (going out pow0) the mark seems to be
removed by the time the mark gets down to my start_xmit routine. I'm
trying to figure out where it's being removed or is there somewhere
else I should be looking to get the mark?
In the ipt_LOG.c I added a field to print out the MARK (and I snipped
the rest of the message)
mangle-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
filter-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
mangle-postroute: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1
LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
nat-postroute: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
mangle-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
filter-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
mangle-postroute: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1
LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
mangle-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
filter-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
mangle-postroute: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1
LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3
mangle-out: IN= OUT=lo SRC=10.100.100.109 DST=10.100.100.109 LEN=112
TOS=0x00 PREC=0xC0 TTL=64 ID=49935 MARK=3
filter-out: IN= OUT=lo SRC=10.100.100.109 DST=10.100.100.109 LEN=112
TOS=0x00 PREC=0xC0 TTL=64 ID=49935 MARK=3
mangle-postroute: IN= OUT=lo SRC=10.100.100.109 DST=10.100.100.109
LEN=112 TOS=0x00 PREC=0xC0 TTL=64 ID=49935 MARK=3
mangle-out: IN= OUT=lo SRC=10.100.100.109 DST=10.100.100.109 LEN=112
TOS=0x00 PREC=0xC0 TTL=64 ID=49936 MARK=3
filter-out: IN= OUT=lo SRC=10.100.100.109 DST=10.100.100.109 LEN=112
TOS=0x00 PREC=0xC0 TTL=64 ID=49936 MARK=3
mangle-postroute: IN= OUT=lo SRC=10.100.100.109 DST=10.100.100.109
LEN=112 TOS=0x00 PREC=0xC0 TTL=64 ID=49936 MARK=3
My debug in the hard_xmit which shows that mark field is 0.
mangle-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3 DF PROTO=ICMP TYPE=8 CODE=0
ID=840 SEQ=1
filter-out: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1 LEN=84
TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3 DF PROTO=ICMP TYPE=8 CODE=0
ID=840 SEQ=1
mangle-postroute: IN= OUT=pow0 SRC=10.100.100.109 DST=10.100.100.1
LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=0 MARK=3 DF PROTO=ICMP TYPE=8
CODE=0 ID=840
cvm_oct_xmit_pow:[397]-> pow0: Sending to group 14 and mark is 0
The value of mark that I print out is sk_buff->mark. How can this be??
Thanks in advance for any help you can give me....
back to walking backwards up the stack... :)
--
/*
* Steve Iribarne
* Software Engineer
* (aka Grunt)
*/
reply other threads:[~2009-04-02 17:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=b4b98b690904021015o2b5c6738qd8e3a39d0bca0e19@mail.gmail.com \
--to=netstv@gmail.com \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).