: Prevent NAT from seeing fragments
PATCH 1/1 : Prevent NAT from seeing fragments
This patch fixes another fragment handling problem, on loopback NAT might get to see fragments because conntrack skips defragmentation for already seen traffic. It just meant as a temporary solution for 2.6.11, in 2.6.12 we would prefer to skip refragmentation for loopback if it doesn't cause problems.
Regards
Patrick
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/02/18 01:11:06+01:00 [email protected]
# [NETFILTER]: Prevent NAT from seeing fragments
#
# The path for loopback is: # LOCAL_OUT: conntrack defrags # POST_ROUTING: conntrack refrags # PRE_ROUTING: skip conntrack defrag because skb->nfct != NULL # PRE_ROUTING: NAT gets hit by fragments
#
# Always defrag on loopback if NAT is compiled in.
#
# Signed-off-by: Patrick McHardy <[email protected]>
# Acked-by: Rusty Russel <[email protected]>
#
# net/ipv4/netfilter/ip_conntrack_standalone.c # 2005/02/18 01:10:55+01:00 [email protected] +2 -0 # [NETFILTER]: Prevent NAT from seeing fragments # # The path for loopback is: # LOCAL_OUT: conntrack defrags # POST_ROUTING: conntrack refrags # PRE_ROUTING: skip conntrack defrag because skb->nfct != NULL # PRE_ROUTING: NAT gets hit by fragments # # Always defrag on loopback if NAT is compiled in. # # Signed-off-by: Patrick McHardy <[email protected]> # Acked-by: Rusty Russel <[email protected]> # diff -Nru a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c --- a/net/ipv4/netfilter/ip_conntrack_standalone.c 2005-02-18 01:15:36 +01:00 +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c 2005-02-18 01:15:36 +01:00 @@ -384,10 +384,12 @@ const struct net_device *out, int (*okfn)(struct sk_buff *)) { +#if !defined(CONFIG_IP_NF_NAT) && !defined(CONFIG_IP_NF_NAT_MODULE) /* Previously seen (loopback)? Ignore. Do this before fragment check. */ if ((*pskb)->nfct) return NF_ACCEPT; +#endif
/* Gather fragments. */
if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
Quoted 5 lines · On Fri, 18 Feb 2005 01:23:44 +0100 Patrick McHardy <[email protected]> wrote:
This patch fixes another fragment handling problem, on loopback NAT might get to see fragments because conntrack skips defragmentation for already seen traffic. It just meant as a temporary solution for 2.6.11, in 2.6.12 we would prefer to skip refragmentation for loopback if it doesn't cause problems.
Applied for 2.6.11, thanks Patrick.