Skip to contentSkip to conversation

Mangling IP Options fields

DISCUSSION Quinton Hoole 3 participants 6 messages May 16, 2005 – Jun 4, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hi

I've posted this to the netfilter users list, but in retrospect it is probably a devel question:

This newbie needs to add and/or rewrite data in the IP Options fields. The MANGLE chain looks like the place to do this, but I don't see the appropriate target extensions to achieve it. It seems easy to mangle most other fields (DSCP, ECN, TOS, TTL etc) but no mention of the OPTIONS fields.

Is mangling of IP options fields supported by netfilter/iptables?

I've seen Fabrice's reply to a simimlar question some 3 years back:

https://lists.netfilter.org/pipermail/netfilter-devel/2002-March/006957.html

which indicates that I'll need to do some hacking, but hopefully this has changed since then, and someone's done it for me ;-)

If not, I'm going to have to make it happen some how. Any pointers
towards the recommended approach in this regard would be appreciated.
I'm assuming that I'll have to alter the netfilter/iptables code
appropriately, which is not a problem. I'll start ploughing through the patch-o-matic docs in the mean time ;-)

Thanks in advance...

Quinton

#1 lore raw

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

Quoting Quinton Hoole on 2005-05-16 12:38 UTC:

Quoted 5 lines

Is mangling of IP options fields supported by netfilter/iptables?

I've seen Fabrice's reply to a simimlar question some 3 years back:

https://lists.netfilter.org/pipermail/netfilter-devel/2002-March/006957.html

I think nothing has changed. The IPV4OPTSSTRIP mentioned in the mail (which removes all options) is still available.

You can download the latest pom-ng (through www.netfilter.org), which includes IPV4OPTSSTRIP. If you need more help regarding how to do stuff in the net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c file (which is the one you should modify), just ask :)

Good luck!

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCiOnVxyF48ZTvn+4RAj5zAJwKMG2mfElgS26RV2PRwwcIGuYBPwCfdJnv RtaGxlBLe/NpODfN5b7zob4=
=9Bp4
-----END PGP SIGNATURE-----

#2 lore raw

Hi Jonas

Thanks for your kind offer of help! I assume you meant it ;-) If so, here goes...

I've been struggling to get a working development platform, and finally have a Fedora Core 3 system, with kernel-2.6.11-1.14_FC3, which I've built from source and tested.

Now I try to use patch-o-matic to apply the IPV4OPTSSTRIP patch, but get the following error:
===================
Do you want to apply this patch [N/y/t/f/a/r/b/w/q/?] y
Testing patch base/IPV4OPTSSTRIP.patch...
Warning - no help text file could be found in either /usr/src/linux/net/ipv4/netfilter/Config.help
or /usr/src/linux/Documentation/Configure.help
fgrep: /usr/src/linux/net/ipv4/netfilter/Config.in: No such file or directory Could not find place to slot in Config.in line
TEST FAILED: patch NOT applied.
===================

I installed the kernel source RPM according to the instructions in the FC3 (http://fedora.redhat.com/docs/release-notes/fc3/x86/), which places the kernel source in

/usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11

For convenience I created a symbolic link from /usr/src/linux to the above.

Then by executing the following I got the error above:
[root@quinton-lap1 patch-o-matic]# KERNEL_DIR=/usr/src/linux ./runme base

What am I doing wrong? Should I be using a standard kernel from kernel.org, rather than my FC3 kernel?

Q

Quoted 37 lines · Jonas Berlin

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

Quoting Quinton Hoole on 2005-05-16 12:38 UTC:

Quoted 7 lines

Is mangling of IP options fields supported by netfilter/iptables?

I've seen Fabrice's reply to a simimlar question some 3 years back:

https://lists.netfilter.org/pipermail/netfilter-devel/2002-March/006957.html

I think nothing has changed. The IPV4OPTSSTRIP mentioned in the mail (which removes all options) is still available.

You can download the latest pom-ng (through www.netfilter.org), which includes IPV4OPTSSTRIP. If you need more help regarding how to do stuff in the net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c file (which is the one you should modify), just ask :)

Good luck!

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCiOnVxyF48ZTvn+4RAj5zAJwKMG2mfElgS26RV2PRwwcIGuYBPwCfdJnv RtaGxlBLe/NpODfN5b7zob4=
=9Bp4
-----END PGP SIGNATURE-----

#3 lore raw

Apologies if these comments (below) seem obvious:

Quoted 4 lines · Quinton Hoole

Warning - no help text file could be found in either /usr/src/linux/net/ipv4/netfilter/Config.help
or /usr/src/linux/Documentation/Configure.help
fgrep: /usr/src/linux/net/ipv4/netfilter/Config.in: No such file or directory

...

Quoted 5 lines

I installed the kernel source RPM according to the instructions in the FC3 (http://fedora.redhat.com/docs/release-notes/fc3/x86/), which places the kernel source in

/usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11

For convenience I created a symbolic link from /usr/src/linux to the above.

So, do:
ls -l /usr/src/linux/net/ipv4/netfilter
and see what you get, if it doesn't work then you may need to adjust your symbolic link to point to /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11/somewhereelse

I presume there is a net folder somewhere under /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11?

It is the folder that includes this net folder that needs to be symlinked to /usr/src/linux.

Sam

#4 lore raw

Sorry - turns out I was using an old patch-o-matic. Once got the right one, everything worked fine.

Q

Quoted 29 lines · Amin Azez

Apologies if these comments (below) seem obvious:

Quoted 4 lines · Quinton Hoole

Warning - no help text file could be found in either /usr/src/linux/net/ipv4/netfilter/Config.help
or /usr/src/linux/Documentation/Configure.help
fgrep: /usr/src/linux/net/ipv4/netfilter/Config.in: No such file or directory

...

Quoted 5 lines

I installed the kernel source RPM according to the instructions in the FC3 (http://fedora.redhat.com/docs/release-notes/fc3/x86/), which places the kernel source in

/usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11

For convenience I created a symbolic link from /usr/src/linux to the above.

So, do:
ls -l /usr/src/linux/net/ipv4/netfilter
and see what you get, if it doesn't work then you may need to adjust your symbolic link to point to /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11/somewhereelse

I presume there is a net folder somewhere under /usr/src/redhat/BUILD/kernel-2.6.11/linux-2.6.11?

It is the folder that includes this net folder that needs to be symlinked to /usr/src/linux.

Sam

#5 lore raw
In reply to Quinton Hoole

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

Quoting Quinton Hoole on 2005-05-19 12:58 UTC:

Quoted 1 line

Hi Jonas

Hello!

Quoted 2 lines

Thanks for your kind offer of help! I assume you meant it ;-) If so, here goes...

Sorry for late reply..

Quoted 1 line

Now I try to use patch-o-matic to apply the IPV4OPTSSTRIP patch, but get

Do you possibly mean patch-o-matic-ng (ng = next generation :) ?

If not, you should fetch the latest snapshot from:

http://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/

Quoted 4 lines

the following error:
===================
Do you want to apply this patch [N/y/t/f/a/r/b/w/q/?] y Testing patch base/IPV4OPTSSTRIP.patch...

Quoted 8 lines

Warning - no help text file could be found in either /usr/src/linux/net/ipv4/netfilter/Config.help
or /usr/src/linux/Documentation/Configure.help
fgrep: /usr/src/linux/net/ipv4/netfilter/Config.in: No such file or directory
Could not find place to slot in Config.in line
TEST FAILED: patch NOT applied.
===================

At least it worked for me with vanilla 2.6.11.

Quoted 3 lines

I installed the kernel source RPM according to the instructions in the FC3 (http://fedora.redhat.com/docs/release-notes/fc3/x86/), which places the kernel source in

The error message makes me think you have the old patch-o-matic or an outdated patch-o-matic-ng..

Quoted 2 lines

Then by executing the following I got the error above:
[root@quinton-lap1 patch-o-matic]# KERNEL_DIR=/usr/src/linux ./runme base

FYI: You can also use

./runme IPV4OPTSSTRIP

if you want just some specific patch.

Quoted 2 lines

What am I doing wrong? Should I be using a standard kernel from kernel.org, rather than my FC3 kernel?

I think it should work fine on both.

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCoXMoxyF48ZTvn+4RAnxqAJ9SHLZMzz6tB8NLiS0i10Fk28BLAACfdyHW 3Vl5s1bLsWtkOAIAO89u0+w=
=1cBw
-----END PGP SIGNATURE-----