diff options
| author | David S. Miller <davem@davemloft.net> | 2016-08-28 23:32:58 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-08-28 23:32:58 -0400 |
| commit | c6f04e93cb5993a5d3aaea28c50e297856b8d24c (patch) | |
| tree | 09a988530d4c5e17bf47f16f2c624bc93ac14018 /net/ipv4 | |
| parent | e19ac1578fd8eb3f7c93f2be2657deb2ccefffd7 (diff) | |
| parent | 96a59083478d1ea66684c59c073424a9d4e6ac6d (diff) | |
Merge branch 'strp-generalization'
Tom Herbert says:
====================
strp: Generalize stream parser to work with other socket types
Add a read_sock protocol operation function that allows something like
tcp_read_sock to be called for other protocol types.
Specific changes in this patch set:
- Add read_sock function to proto_ops. This has the same signature as
tcp_read_sock. sk_read_actor_t is also defined in net.h.
- Set peek_len and read_sock proto_op functions for TCPv4 and TCPv6
stream ops.
- Remove references to tcp in strparser.
- Call peek_len and read_sock operations from strparser instead of
calling TCP specific functions.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
| -rw-r--r-- | net/ipv4/af_inet.c | 2 | ||||
| -rw-r--r-- | net/ipv4/tcp.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 989a362814a9..e94b47be0019 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -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, diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f1a9a0a8a1f3..60a438864f32 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -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. * |
