Working on a match extension (ipt_gateway)
Hello,
I'm working on an extension used to match packets by next-hop ip. It is only valid with FORWARD & POST_ROUTING hooks.
It gets the routing decision via (struct rtable*)skb->dst and it works quite well.
I just finished on Linux 2.6 and I'm about to do it on 2.4.
I've done it after reading that unanswered post :
http://lists.netfilter.org/pipermail/netfilter/2004-July/054199.html
Please, could someone answer my questions :
1) Is that match useless? (Can this be done without such a match)
2) In case it isn't, how do I send the match?
A tarball with libipt_gateway.c, ipt_gateway.c and ipt_gateway.h ? (Any directory structure ?)
I'm sorry for both questions. As you can see, it's my first real work on netfilter.
There's a start to anything.
Thanks a lot,
Signature · 3 lines
Samuel Jean SysAdmin & NetAdmin at cookinglinux.org
Quoted 5 lines · Samuel Jean
I'm working on an extension used to match packets by next-hop ip. It is only valid with FORWARD &
POST_ROUTINGhooks.
It gets the routing decision via (struct rtable*)skb->dst and it works quite well.
Quoted 8 lines
I just finished on Linux 2.6 and I'm about to do it on 2.4.
I've done it after reading that unanswered post :
http://lists.netfilter.org/pipermail/netfilter/2004-July/054199.htmlPlease, could someone answer my questions :
1) Is that match useless? (Can this be done without such a match)
Could you give an example in which context can it be useful?
Quoted 7 lines
2) In case it isn't, how do I send the match?
A tarball with
libipt_gateway.c,ipt_gateway.candipt_gateway.h? (Any directory structure ?)I'm sorry for both questions. As you can see, it's my first real work on netfilter.
Check out patch-o-matic-ng from cvs and read README.newpatches. Then send the pom-ng compatible patch to this list.
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
Quoted 9 lines · Jozsef
Quoted 7 lines · Samuel Jean
I'm working on an extension used to match packets by next-hop ip. It is only valid with FORWARD &
POST_ROUTINGhooks.
It gets the routing decision via (struct rtable*)skb->dst and it works quite well.I just finished on Linux 2.6 and I'm about to do it on 2.4.
Quoted 9 lines
Quoted 6 lines
I've done it after reading that unanswered post :
http://lists.netfilter.org/pipermail/netfilter/2004-July/054199.htmlPlease, could someone answer my questions :
1) Is that match useless? (Can this be done without such a match)
Could you give an example in which context can it be useful?
Sure, let me take the example given in that unanswered post.
+-------------+ 200.0.0.0/24 +---------------+ 192.168.2.0/24
| Router A | 200.0.1.0/24 | Router B | 192.168.3.0/24
+------+------+ 200.0.2.0/24 +--------+------+ 192.168.4.0/24
| |
192.168.0.2 192.168.0.3
| |
| |
+--------------------+---------------+
|
192.168.0.1
| [ETH1]
+-------------+
| Netfilter |
+------+------+
|
192.168.5.0/24Ok, I know this setup is a little strange, but it could be real.
If packets coming from 192.168.5.0/24 are going to Internet (Router A) we'd like to MASQUERADE it. But we can't use something like :
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE because everything going to 192.168.{2,3,4}.0/24 will be NATed too.
Using something like :
iptables -t nat -A POSTROUTING -m gateway --gateway 192.168.0.2 -j MASQUERADE
could be a solution.
MASQUERADE is just a silly example cause I don't know what that person really wants to do with matched packets. He just mentioned he want to match packets by next-hop.
Please read (this isn't an order) :
http://lists.netfilter.org/pipermail/netfilter/2004-July/054199.html
And let me know if this setup shall require (or not) the ipt_gateway match.
Quoted 3 lines
Best regards,
Jozsef
Thanks a lot for you time, Jozsef,
Signature · 3 lines
Samuel Jean SysAdmin & NetAdmin at cookinglinux.org