Skip to contentSkip to conversation

3 target treatment

DISCUSSION Philip Ho 4 participants 8 messages Mar 5, 2003 – Mar 7, 2003 netfilter

lore
Share & tools
lore

Philip Ho

author
#0 lore raw

Dear all

Can I possibly force some matched packet passing through three targets in a row, namely

1. update fragmentation field in IP header
2. update DSCP field
3. mark it (must be in mangle table)

Regards,
philip

#1 lore raw
Quoted 6 lines · Philip Ho

Dear all
Can I possibly force some matched packet passing through three targets in a row, namely
1. update fragmentation field in IP header
2. update DSCP field
3. mark it (must be in mangle table)

Hello Philip,

Short answer: for the moment you cannot.

Longuer answer: but you can create a custom chain, where you do all of these. The in the main table, you can jump in this chain if needed to perform the three operations one shot. I would also prefer to be able
to do like you say, but it would be too much trouble modifying the existing netfilter infrastructure in the kernel to suport that, when you know that there are plan to replace the infrastructure soon, to support linked list among other things.

You can have a look at the archive, we did mentions pros and cons of implementing a system that would be able to do what you say.

Have a nice day,

Fabrice.
--
Fabrice MARIE

"Silly hacker, root is for administrators"
-Unknown

#2 lore raw
Quoted 11 lines · Fabrice MARIE
Quoted 6 lines · Philip Ho

Dear all
Can I possibly force some matched packet passing through three targets in a row, namely
1. update fragmentation field in IP header
2. update DSCP field
3. mark it (must be in mangle table)

Hello Philip,

Short answer: for the moment you cannot.

well. I'm not sure. Apart from the missing IPid target, I think the solution with a custom chain and DSCP/MARK target [both return IPT_CONTINUE] is fine for him.

writing an IPid target is extremely easy, the only problem is how to create 'secure' IPid's...

Quoted 3 lines

Fabrice.
--
Fabrice MARIE

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
author
#3 lore raw

Dear Harald and Fabrice

Thanks. I am new to netfilter hacking. Can you give me direction in learning to write custom chain and know IPT_CONTINUE?

Advice in updating fragmentation field is also very appreciated.

Regards,
philip

Quoted 33 lines · Harald Welte
Quoted 11 lines · Fabrice MARIE
Quoted 6 lines · Philip Ho

Dear all
Can I possibly force some matched packet passing through three targets in a row, namely
1. update fragmentation field in IP header
2. update DSCP field
3. mark it (must be in mangle table)

Hello Philip,

Short answer: for the moment you cannot.

well. I'm not sure. Apart from the missing IPid target, I think the solution with a custom chain and DSCP/MARK target [both return IPT_CONTINUE] is fine for him.

writing an IPid target is extremely easy, the only problem is how to create 'secure' IPid's...

Quoted 3 lines

Fabrice.
--
Fabrice MARIE

--
- Harald Welte <[email protected]> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie

------------------------------------------------------------------------
Part 1.2Type: application/pgp-signature

author
#4 lore raw
In reply to Harald Welte

Hi Fabrice and Harald

After I tried DSCP target, I have a bit of idea. I guess to update the frag. field, I have to add source code like libipt_DSCP.c and libipt_dscp_helper.c

But I cannot find in the sources explicit reference of the position of DSCP field relative to IP header. Can you tell me the reason, please?

Regards,
philip

Quoted 33 lines · Harald Welte
Quoted 11 lines · Fabrice MARIE
Quoted 6 lines · Philip Ho

Dear all
Can I possibly force some matched packet passing through three targets in a row, namely
1. update fragmentation field in IP header
2. update DSCP field
3. mark it (must be in mangle table)

Hello Philip,

Short answer: for the moment you cannot.

well. I'm not sure. Apart from the missing IPid target, I think the solution with a custom chain and DSCP/MARK target [both return IPT_CONTINUE] is fine for him.

writing an IPid target is extremely easy, the only problem is how to create 'secure' IPid's...

Quoted 3 lines

Fabrice.
--
Fabrice MARIE

--
- Harald Welte <[email protected]> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie

------------------------------------------------------------------------
Part 1.2Type: application/pgp-signature

#5 lore raw
Quoted 7 lines · Philip Ho

Hi Fabrice and Harald

After I tried DSCP target, I have a bit of idea. I guess to update the frag. field, I have to add source code like libipt_DSCP.c and libipt_dscp_helper.c

But I cannot find in the sources explicit reference of the position of DSCP field relative to IP header. Can you tell me the reason, please?

pleaes read the netfilter hacking HOWTO and my netfilter programming tutorial (www.gnumonks.org/presentations/netfilter-programming-*)

and to answer the question: less /usr/src/linux/net/ipv4/netfilter/ipt_DSCP.c

Quoted 2 lines

Regards,
philip

Signature · 3 lines
- Harald Welte <[email protected]>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime
author
#6 lore raw

Thank you Harald. I think I should read these materials first.

Regards,
philip

Quoted 24 lines · Harald Welte
Quoted 7 lines · Philip Ho

Hi Fabrice and Harald

After I tried DSCP target, I have a bit of idea. I guess to update the frag. field, I have to add source code like libipt_DSCP.c and libipt_dscp_helper.c

But I cannot find in the sources explicit reference of the position of DSCP field relative to IP header. Can you tell me the reason, please?

pleaes read the netfilter hacking HOWTO and my netfilter programming tutorial (www.gnumonks.org/presentations/netfilter-programming-*)

and to answer the question: less /usr/src/linux/net/ipv4/netfilter/ipt_DSCP.c

Quoted 2 lines

Regards,
philip

--
- Harald Welte <[email protected]> http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

------------------------------------------------------------------------
Part 1.2Type: application/pgp-signature

author
#7 lore raw
In reply to Harald Welte

Dear all

Regarding my own question, I am trying to answer it. I can mangle on three targets using the following script. But I am not sure about the performance impact, are there anyone who has performed some kind of benchmarking test on multiple targets?

iptables -t mangle -F
iptables -t mangle -A PREROUTING -j TTL --ttl-set 4
iptables -t mangle -A PREROUTING -j DSCP --set-dscp 46 iptables -t mangle -A PREROUTING -m dscp --dscp 46 -j MARK --set-mark 1

Regards,
philip

Quoted 33 lines · Harald Welte
Quoted 11 lines · Fabrice MARIE
Quoted 6 lines · Philip Ho

Dear all
Can I possibly force some matched packet passing through three targets in a row, namely
1. update fragmentation field in IP header
2. update DSCP field
3. mark it (must be in mangle table)

Hello Philip,

Short answer: for the moment you cannot.

well. I'm not sure. Apart from the missing IPid target, I think the solution with a custom chain and DSCP/MARK target [both return IPT_CONTINUE] is fine for him.

writing an IPid target is extremely easy, the only problem is how to create 'secure' IPid's...

Quoted 3 lines

Fabrice.
--
Fabrice MARIE

--
- Harald Welte <[email protected]> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie

------------------------------------------------------------------------
Part 1.2Type: application/pgp-signature