tcp: Set read_sock and peek_len proto_ops
authorTom Herbert <tom@herbertland.com>
Sun, 28 Aug 2016 21:43:18 +0000 (14:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Aug 2016 03:32:41 +0000 (23:32 -0400)
In inet_stream_ops we set read_sock to tcp_read_sock and peek_len to
tcp_peek_len (which is just a stub function that calls tcp_inq).

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/af_inet.c
net/ipv4/tcp.c
net/ipv6/af_inet6.c

index d56666ad92496066a8b7412f1334b7ee001a34a9..a5af6be3a572bf3c49b4922a92da557429360503 100644 (file)
@@ -1848,6 +1848,8 @@ static inline int tcp_inq(struct sock *sk)
        return answ;
 }
 
+int tcp_peek_len(struct socket *sock);
+
 static inline void tcp_segs_in(struct tcp_sock *tp, const struct sk_buff *skb)
 {
        u16 segs_in;
index 989a362814a9ccfb994b454da3929d3e3c1c11eb..e94b47be0019d1b7e7b41bacbb3c52aaf254a55f 100644 (file)
@@ -916,6 +916,8 @@ const struct proto_ops inet_stream_ops = {
        .mmap              = sock_no_mmap,
        .sendpage          = inet_sendpage,
        .splice_read       = tcp_splice_read,
+       .read_sock         = tcp_read_sock,
+       .peek_len          = tcp_peek_len,
 #ifdef CONFIG_COMPAT
        .compat_setsockopt = compat_sock_common_setsockopt,
        .compat_getsockopt = compat_sock_common_getsockopt,
index f1a9a0a8a1f3e7d4891f78a5be7dbad63ae3136f..60a438864f328e038dc01456480896b72b22de1a 100644 (file)
@@ -1570,6 +1570,12 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 }
 EXPORT_SYMBOL(tcp_read_sock);
 
+int tcp_peek_len(struct socket *sock)
+{
+       return tcp_inq(sock->sk);
+}
+EXPORT_SYMBOL(tcp_peek_len);
+
 /*
  *     This routine copies from a sock struct into the user buffer.
  *
index b454055ba625a20ed6f470191ad9a6c6366edfe6..46ad699937fdcc6eaaf4b6490e6f3822ad444df8 100644 (file)
@@ -545,6 +545,8 @@ const struct proto_ops inet6_stream_ops = {
        .mmap              = sock_no_mmap,
        .sendpage          = inet_sendpage,
        .splice_read       = tcp_splice_read,
+       .read_sock         = tcp_read_sock,
+       .peek_len          = tcp_peek_len,
 #ifdef CONFIG_COMPAT
        .compat_setsockopt = compat_sock_common_setsockopt,
        .compat_getsockopt = compat_sock_common_getsockopt,