Skip to contentSkip to conversation

net: ipv4,nodefrag: check socket type before touching nodefrag flag

PATCH In review Jiri Olsa 2 participants 2 messages Sep 20, 2010 – Sep 22, 2010

Subsystems (4)
lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 net: ipv4,nodefrag: check socket type before touching nodefrag flag

hi,
we need to check proper socket type within ipv4_conntrack_defrag function before referencing the nodefrag flag.

For example the tun driver receive path produces skbs with AF_UNSPEC socket type, and so current code is causing unwanted fragmented packets going out.

wbr,
jirka

---
 net/ipv4/netfilter/nf_defrag_ipv4.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
net/ipv4/netfilter/nf_defrag_ipv4.c +3 -1
index eab8de3..f3a9b42 100644
@@ -66,9 +66,11 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
 					  const struct net_device *out,
 					  int (*okfn)(struct sk_buff *))
 {
+	struct sock *sk = skb->sk;
 	struct inet_sock *inet = inet_sk(skb->sk);
 
-	if (inet && inet->nodefrag)
+	if (sk && (sk->sk_family == PF_INET) &&
+	    inet->nodefrag)
 		return NF_ACCEPT;
 
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

Am 20.09.2010 11:27, schrieb Jiri Olsa:

Quoted 6 lines

we need to check proper socket type within ipv4_conntrack_defrag function before referencing the nodefrag flag.

For example the tun driver receive path produces skbs with AF_UNSPEC socket type, and so current code is causing unwanted fragmented packets going out.

Looks good. Applied, thanks.