netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipv4,nodefrag: check socket type before touching nodefrag flag
@ 2010-09-20  9:27 Jiri Olsa
  2010-09-22  6:59 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2010-09-20  9:27 UTC (permalink / raw)
  To: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	jengelh-nopoi9nDyk+ELgA04lAiVw, kaber-dcUjhNyLwpNeoWH0uzbU5w,
	davem-H+wXaHxf7aLQT0dZR+AlfA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	linux-man-u79uwXL29TY76Z2rM5mHXA, Jiri Olsa

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



Signed-off-by: Jiri Olsa <jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 net/ipv4/netfilter/nf_defrag_ipv4.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c
index eab8de3..f3a9b42 100644
--- a/net/ipv4/netfilter/nf_defrag_ipv4.c
+++ b/net/ipv4/netfilter/nf_defrag_ipv4.c
@@ -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)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] net: ipv4,nodefrag: check socket type before touching nodefrag flag
  2010-09-20  9:27 [PATCH] net: ipv4,nodefrag: check socket type before touching nodefrag flag Jiri Olsa
@ 2010-09-22  6:59 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2010-09-22  6:59 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: eric.dumazet, jengelh, davem, netdev, netfilter-devel, linux-man

Am 20.09.2010 11:27, schrieb Jiri Olsa:
> 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.


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

end of thread, other threads:[~2010-09-22  7:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-20  9:27 [PATCH] net: ipv4,nodefrag: check socket type before touching nodefrag flag Jiri Olsa
2010-09-22  6:59 ` Patrick McHardy

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).