Set mark in -j QUEUE?
Using iptables-1.2.11-3.1.RHEL4.
In the mangle table, in an otherwise successful -j QUEUE processor, I set:
ipq_packet_msg_t* msg; ... msg->mark = 2; ipq_set_verdict(ipqHand,msg->packet_id,NF_ACCEPT,0,NULL);
and in the filter table, I check:
-A IN -s 192.168.1.0/24 -m mark --mark 0 -j LOG-QUEUE-0-DROP -A IN -s 192.168.1.0/24 -m mark --mark 1 -j LOG-QUEUE-DROP -A IN -s 192.168.1.0/24 -m mark --mark 2 -j LOG-QUEUE-ACCEPT
The result is zero. On the other hand, if in the mangle table:
-A PRE -p tcp -s 192.168.1.0/24 -j MARK --set-mark 2
I get the correct result of 2 in the filter table.
Is there any way to make this work in the -j QUEUE processor?
Thanks in advance for your help.
Mike.
--
Michael D. Berger
[email protected]
Quoted 6 lines · Michael D. Berger
Using iptables-1.2.11-3.1.RHEL4.
In the mangle table, in an otherwise successful -j QUEUE I get the correct result of 2 in the filter table.
Is there any way to make this work in the -j QUEUE processor?
If I understand your problem, you wanna set the mark with the QUEUE target. To do so you have to apply a patch to ipq and kernel if you use kernel prior to 2.6.14 :
http://www.netfilter.org/projects/patch-o-matic/pom-extra.html#pom-extra-ip_queue_vwmark
After 2.6.14 the new NFQUEUE target and libnetfilter_queue are able to do marking without any patch.
By the way, if you need a code example of port to libnetfilter_queue, you can use nufw code (http://www.nufw.org) (directory src/nufw/)
BR,
Signature · 2 lines
Eric Leblond <[email protected]> NuFW, Now User Filtering Works : http://www.nufw.org
Quoted 1 line · Michael D. Berger
Is there any way to make this work in the -j QUEUE processor?
You need to use the ip_queue_vwmark patch:
http://www.netfilter.org/projects/patch-o-matic/pom-extra.html#pom-extra-ip_queue_vwmark
It provides a ipq_set_vwmark function, it's the same as ipq_set_verdict, except it takes a mark parameter.
I have nothing to do with the development of it, but I use it for my own project, and it works well.
Regards,
Chris