Skip to contentSkip to conversation

connmarks restore and helper match

DISCUSSION Marco Gaiarin 1 participant 2 messages Jun 24, 2013 – Jun 25, 2013

lore
Share & tools
lore
#0 lore raw

I'm playing with connmarks to match SIP and h323 traffic, and i've loaded the connmark modules.

Debian squeeze:

	tank:~# uname -a
	Linux tank 2.6.32-5-686 #1 SMP Fri May 10 08:33:48 UTC 2013 i686 GNU/Linux
	tank:~# iptables -V
	iptables v1.4.8

I've setup some rule like (on mangle table):

	-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff 
	-A FORWARD -m state --state NEW -m mark --mark 0x0 -j mrk-post-fwd 

and:

	-A mrk-post-fwd -m helper --helper "h323" -j MARK --set-xmark 0x1/0xffffffff 
	-A mrk-post-fwd -m helper --helper "h323" -j RETURN 
	-A mrk-post-fwd -m helper --helper "sip" -j MARK --set-xmark 0x1/0xffffffff 
	-A mrk-post-fwd -m helper --helper "sip" -j RETURN 

but the counter on that rule remain 0.

I suppose it is right, because the rtp traffic come after the session (SIP or h323) was established, and so correctly accounted: so the first rule restore the mark on RTP traffic also.

Or i'm missing something, eg the two rules on FORWARD chain work only on TCP and so all the UDP traffic got skipped (and generic-marked on a ''last resort'' rule at the end?).

How can i ''debug'' these things?

Thanks.

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                    http://www.sv.lnf.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
	   http://www.lanostrafamiglia.it/chi_siamo/5xmille.php
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
#1 lore raw
Quoted 4 lines

I suppose it is right, because the rtp traffic come after the session (SIP or h323) was established, and so correctly accounted: so the first rule restore the mark on RTP traffic also.

[...]

Quoted 1 line

How can i ''debug'' these things?

I've treiad a simple:

watch -n 1 grep <ip address> /proc/net/nf_conntrack

and i've called a SIP phone on that IP address; as expected just after someone answered, the rtp traffic get flow, and was as expected on mark=1.
Also, the iptables counter for the rule of 'helper' match remains at zero.

So, if i use connmark restore, the helper match are totally unuseful?

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                    http://www.sv.lnf.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
	   http://www.lanostrafamiglia.it/chi_siamo/5xmille.php
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)