Skip to contentSkip to conversation

Support for longest prefix IP address match in iptables?

DISCUSSION [email protected] 3 participants 3 messages Apr 28, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

Hello:

We are using iptables v1.2.9 on Linux 2.4.20 kernel on a powerpc based system.

We are using iptables to match the destination ip-addresses using the command

iptables -t mangle -A POSTROUTING -d 10.12.13.14 -j MARK --set-mark=5 iptables -t mangle -A POSTROUTING -d 10.12.13.0/24 -j MARK --set-mark=7

We observe that the destination ip-address match based on the option "-d" does not follow the longest prefix match. For example we are seeing a command "ping 10.12.13.14" gets a mark value of 7 instead of 5.

Is this fixed in the subsequent release of "iptables" or netfilter modules in Linux 2.4.

A link to the patch or the correct iptables version that can support the above would be helpful.

Thanks
-Shyam

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · [email protected] wrote:

iptables -t mangle -A POSTROUTING -d 10.12.13.14 -j MARK --set-mark=5 iptables -t mangle -A POSTROUTING -d 10.12.13.0/24 -j MARK --set-mark=7

Put these rules the other way around. AFAIK, MARK does not exit the chain after a match.

David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEUoRETIgPQWnLowkRAp1IAJ41tAgE9Bi5uRuvJU6dpTLzbd1nngCfc0pW bKj0maY/Im8E8PIEonQrXtk=
=FQvS
-----END PGP SIGNATURE-----

#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Fri, 28 Apr 2006 [email protected] wrote:

We are using iptables to match the destination ip-addresses using the command

iptables -t mangle -A POSTROUTING -d 10.12.13.14 -j MARK --set-mark=5 iptables -t mangle -A POSTROUTING -d 10.12.13.0/24 -j MARK --set-mark=7

MARK is a non-terminating target, so _both_ rules get applied. The later one overrides the earlier one. You need to insert a rule with a terminating target (i.e. ACCEPT) between these.

Alexey