Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbdd769a authored by Jiri Olsa's avatar Jiri Olsa Committed by David S. Miller
Browse files

netfilter: nf_conntrack_defrag: check socket type before touching nodefrag flag



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.

Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d6120b8a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)