netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* no reassembly for outgoing packets on RAW socket
@ 2010-06-04 11:27 Jiri Olsa
  2010-06-04 12:03 ` Patrick McHardy
  0 siblings, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2010-06-04 11:27 UTC (permalink / raw)
  To: netdev

hi,

I'd like to be able to sendout a single IP packet with MF flag set.

When using RAW sockets the packet will get stuck in the
netfilter (NF_INET_LOCAL_OUT nf_defrag_ipv4 reassembly unit)
and wont ever make it out..

I made a change which bypass the outgoing reassembly for
RAW sockets, but I'm not sure wether it's too invasive..

Is there any standard for RAW sockets behaviour?
Or another way around? :)

thanks,
jirka


---
diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c
index cb763ae..5ef8ab2 100644
--- a/net/ipv4/netfilter/nf_defrag_ipv4.c
+++ b/net/ipv4/netfilter/nf_defrag_ipv4.c
@@ -74,6 +74,10 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
 		return NF_ACCEPT;
 #endif
 #endif
+	/* Do not reassemble for raw sockets. */
+	if (skb->sk && skb->sk->sk_type == SOCK_RAW)
+		return NF_ACCEPT;
+
 	/* Gather fragments. */
 	if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
 		enum ip_defrag_users user = nf_ct_defrag_user(hooknum, skb);
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c
index beb2581..a9aa19c 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -86,8 +86,14 @@ nf_nat_fn(unsigned int hooknum,
 	enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum);
 
 	/* We never see fragments: conntrack defrags on pre-routing
-	   and local-out, and nf_nat_out protects post-routing. */
-	NF_CT_ASSERT(!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)));
+	   and local-out, and nf_nat_out protects post-routing.
+	   With the exception of RAW sockets. */
+#ifdef CONFIG_NETFILTER_DEBUG
+	int raw  = (skb->sk && skb->sk->sk_type == SOCK_RAW);
+	int frag = (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET));
+
+	NF_CT_ASSERT(!frag || (frag && raw));
+#endif
 
 	ct = nf_ct_get(skb, &ctinfo);
 	/* Can't track?  It's not due to stress, or conntrack would

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

end of thread, other threads:[~2010-06-15  9:49 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-04 11:27 no reassembly for outgoing packets on RAW socket Jiri Olsa
2010-06-04 12:03 ` Patrick McHardy
2010-06-07 14:55   ` Jiri Olsa
2010-06-09 14:16     ` Patrick McHardy
2010-06-09 15:15       ` Jan Engelhardt
2010-06-09 15:16         ` Patrick McHardy
2010-06-09 15:20           ` Jan Engelhardt
2010-06-10  6:57             ` Jiri Olsa
2010-06-10  6:56       ` Jiri Olsa
2010-06-10  9:14         ` Patrick McHardy
2010-06-10  9:53           ` Jiri Olsa
2010-06-10 10:04             ` Patrick McHardy
2010-06-11  8:16               ` Jiri Olsa
2010-06-11  9:53                 ` Jan Engelhardt
2010-06-11 13:10                   ` Jiri Olsa
2010-06-15  6:53                     ` [PATCH] net: IP_NODEFRAG option for IPv4 socket Jiri Olsa
2010-06-15  7:13                       ` Eric Dumazet
2010-06-15  9:18                         ` Jiri Olsa
2010-06-15  9:49                           ` Eric Dumazet

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