netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] netfilter: xt_TEE:  IPv4 Don't Fragmet options
@ 2012-06-14  6:17 Hans Schillstrom
  2012-06-14 17:52 ` Pablo Neira Ayuso
  2012-06-14 23:55 ` Jan Engelhardt
  0 siblings, 2 replies; 7+ messages in thread
From: Hans Schillstrom @ 2012-06-14  6:17 UTC (permalink / raw)
  To: Jan Engelhardt, Pablo Neira Ayuso; +Cc: netfilter-devel@vger.kernel.org

Hello,

I  think it is wrong to always force the DF bit in IPv4, it's better to have an option
If an application don't set the DF bit, usually it doesn't expect to get an icmp back either.
The result is that the packet will be dropped...

To retain backwards compatibility I suggest adding a new option like

--ipv4-df-copy  Do not force "Don't Fragment" on the copied packet just copy the bit.

In IPv6 we don't have that option, so nothing has to be done there.


diff --git a/include/linux/netfilter/xt_TEE.h b/include/linux/netfilter/xt_TEE.h
index 5c21d5c..e5fca8a 100644
--- a/include/linux/netfilter/xt_TEE.h
+++ b/include/linux/netfilter/xt_TEE.h
@@ -4,6 +4,7 @@
 struct xt_tee_tginfo {
        union nf_inet_addr gw;
        char oif[16];
+       int df_copy;

        /* used internally by the kernel */
        struct xt_tee_priv *priv __attribute__((aligned(8)));
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index ee2e5bc..e9a1ca7 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -117,7 +117,8 @@ tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)
         * decreased MTU on the clone route. IPv6 does this too.
         */
        iph = ip_hdr(skb);
-       iph->frag_off |= htons(IP_DF);
+       if (!info->df_copy)
+               iph->frag_off |= htons(IP_DF);
        if (par->hooknum == NF_INET_PRE_ROUTING ||
            par->hooknum == NF_INET_LOCAL_IN)
                --iph->ttl;


--
Regards 
Hans Schillstrom
+46 70 699 7150



^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re[3]: [RFC] netfilter: xt_TEE: IPv4 Don't Fragmet options
@ 2012-06-15 12:51 Hans Schillstrom
  2012-06-15 13:04 ` Jan Engelhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Schillstrom @ 2012-06-15 12:51 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Pablo Neira Ayuso, netfilter-devel@vger.kernel.org, fw

>On Friday 2012-06-15 08:37, Hans Schillstrom wrote:
>>>
>>>Applications often don't have the means to set DF, think SOCK_STREAM.
>>
>>Yeah I do, and TCP usually set the DF bit and if you inherit that it should
>>not be a problem. BTW, I don't see any real use case for TCP except for a
>>"remote" tcpdump
>
>Remote dumping is the point of TEE. At least that is what people
>have blogged about so far :)
>
>>Inherit - don't force, it's a better idea
>>if you don't set it you don't expect an ICMP either.
>
>So what does syslogd do in the IPv6-UDP case?

As I wrote in my first mail IPv6 is a different story, you don't have any options there
since you are not allowed to "re-frag" the packet

>>>As Pablo mentioned, you cannot touch this structure.
>>
>>I know this was just a RFC,  I  should have made a note about that :-)
>
>Then I'll await your new patch.

To make things clear :
I'll send a patch that keep the current behaviour, so it doesn't break things for people.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-16 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14  6:17 [RFC] netfilter: xt_TEE: IPv4 Don't Fragmet options Hans Schillstrom
2012-06-14 17:52 ` Pablo Neira Ayuso
2012-06-14 18:59   ` Pablo Neira Ayuso
2012-06-14 20:07   ` Florian Westphal
2012-06-14 23:55 ` Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2012-06-15 12:51 Re[3]: " Hans Schillstrom
2012-06-15 13:04 ` Jan Engelhardt
2012-06-16 13:18   ` Florian Westphal
2012-06-16 13:57     ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).