Messages in this thread Patch in this message | | | Date | Sat, 03 Aug 2002 03:17:40 -0700 (PDT) | Subject | Re: Fragment flooding in 2.4.x/2.5.x | From | "David S. Miller" <> |
| |
From: Trond Myklebust <trond.myklebust@fys.uio.no> Date: Mon, 1 Jul 2002 14:14:50 +0200
I've now got the application and a demonstration of what kind of fix is needed. I hope you and Dave can work out a better patch in for 2.4.20-pre ;-)...
Trond does this patch fix your problem? It is exactly how Alexey described the fix and it should work.
I think the memory failure issue is totally moot. In fact your "accumulate skb till we have them all, then send the whole bunch" version of the fix is very bad because it defers the transmit on the device until the whole set of fragments have been created.
--- net/ipv4/ip_output.c.~1~ Sat Aug 3 03:14:35 2002 +++ net/ipv4/ip_output.c Sat Aug 3 03:20:49 2002 @@ -520,8 +520,18 @@ /* * Get the memory we require with some space left for alignment. */ - - skb = sock_alloc_send_skb(sk, fraglen+hh_len+15, flags&MSG_DONTWAIT, &err); + if (!(flags & MSG_DONTWAIT) || nfrags == 0) { + skb = sock_alloc_send_skb(sk, fraglen + hh_len + 15, + (flags & MSG_DONTWAIT), &err); + } else { + /* On a non-blocking write, we check for send buffer + * usage on the first fragment only. + */ + skb = sock_wmalloc(sk, fraglen + hh_len + 15, 1, + sk->allocation); + if (!skb) + err = -ENOBUFS; + } if (skb == NULL) goto error; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |