Hi All,
Sendfile() over UDP socket are currently limited to ~ 64KBytes file (max cork.length).
Indeed, if you run sendfile() with a file size > 64KBytes over UDP socket, system call will stop and return ~64KBytes without sending anything on the network.
This patch is pushing ongoing frames when frames buffer is full, to prevent overflow.
Signed-off-by: Johann Baudy <johann.baudy@gmail.com>
net/ipv4/udp.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 8e42fbb..64e0857 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -743,7 +743,22 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset,
size_t size, int flags)
{
struct udp_sock *up = udp_sk(sk);
+ struct inet_sock *inet = inet_sk(sk);
int ret;
+ int fragheaderlen;
+ struct ip_options *opt = NULL;
+
+ lock_sock(sk);
+ if (inet->cork.flags & IPCORK_OPT)
+ opt = inet->cork.opt;
+ fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0);
+
+ if (inet->cork.length + size >= 0xFFFF - fragheaderlen) {
+ ret = udp_push_pending_frames(sk);
+ if (ret)
+ goto out;
+ }
+ release_sock(sk);
if (!up->pending) {
struct msghdr msg = { .msg_flags = flags|MSG_MORE };
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html| Rafael J. Wysocki | 2.6.25-git1: Solid hang on HP nx6325 (64-bit) |
| Balbir Singh | Re: 2.6.24-rc8-mm1 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Herbert Xu | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Evgeniy Polyakov | Re: [BUG] New Kernel Bugs |
