diff options
author | samanthakumar <samanthakumar@google.com> | 2016-04-05 18:41:16 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-05 22:29:37 +0200 |
commit | 627d2d6b550094d88f9e518e15967e7bf906ebbf (patch) | |
tree | 4a4d64af861781920b2b4ef6d0e7b4423b787292 /net/ipv4/af_inet.c | |
parent | udp: remove headers from UDP packets before queueing (diff) | |
download | linux-627d2d6b550094d88f9e518e15967e7bf906ebbf.tar.xz linux-627d2d6b550094d88f9e518e15967e7bf906ebbf.zip |
udp: enable MSG_PEEK at non-zero offset
Enable peeking at UDP datagrams at the offset specified with socket
option SOL_SOCKET/SO_PEEK_OFF. Peek at any datagram in the queue, up
to the end of the given datagram.
Implement the SO_PEEK_OFF semantics introduced in commit ef64a54f6e55
("sock: Introduce the SO_PEEK_OFF sock option"). Increase the offset
on peek, decrease it on regular reads.
When peeking, always checksum the packet immediately, to avoid
recomputation on subsequent peeks and final read.
The socket lock is not held for the duration of udp_recvmsg, so
peek and read operations can run concurrently. Only the last store
to sk_peek_off is preserved.
Signed-off-by: Sam Kumar <samanthakumar@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 9e481992dbae..a38b9910af60 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -948,6 +948,7 @@ const struct proto_ops inet_dgram_ops = { .recvmsg = inet_recvmsg, .mmap = sock_no_mmap, .sendpage = inet_sendpage, + .set_peek_off = sk_set_peek_off, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_sock_common_setsockopt, .compat_getsockopt = compat_sock_common_getsockopt, |