summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-01-15 21:48:33 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-01-15 21:48:33 +0000
commit756b78b0899784d745da695da0c2a3c6e1864ab4 (patch)
tree9dc41b86dedef1cf8f89c028989cb1cae50c27a6 /sys
parentbe7d21b8c28262b78cbc615f51f57697cf2386be (diff)
Pass an EFBIG error to user land when the maximum splicing length
has been reached. This creates a read event on the spliced source socket that can be noticed with select(2). So the kernel passes control to the relay process immediately. This could be used to log the end of an http request within a persistent connection. deraadt@ reyk@ mikeb@ like the idea
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 87cbe744eaa..3b08324a37a 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.111 2013/01/15 11:12:57 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.112 2013/01/15 21:48:32 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1167,7 +1167,8 @@ somove(struct socket *so, int wait)
error = EPIPE;
goto release;
}
- if (sosp->so_error && sosp->so_error != ETIMEDOUT) {
+ if (sosp->so_error && sosp->so_error != ETIMEDOUT &&
+ sosp->so_error != EFBIG) {
error = sosp->so_error;
goto release;
}
@@ -1318,6 +1319,8 @@ somove(struct socket *so, int wait)
release:
sosp->so_state &= ~SS_ISSENDING;
+ if (!error && maxreached && so->so_splicemax == so->so_splicelen)
+ error = EFBIG;
if (error)
so->so_error = error;
if (((so->so_state & SS_CANTRCVMORE) && so->so_rcv.sb_cc == 0) ||