aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-15 11:02:33 -0800
committerDavid S. Miller <davem@davemloft.net>2021-11-16 13:10:34 +0000
commit42f67eea3ba36cef2dce2e853de6ddcb2e89eb39 (patch)
tree384aa7cd5164824de1c9178629fe82f2bd9fe516 /net/core/sock.c
parenttcp: small optimization in tcp_v6_send_check() (diff)
downloadlinux-dev-42f67eea3ba36cef2dce2e853de6ddcb2e89eb39.tar.xz
linux-dev-42f67eea3ba36cef2dce2e853de6ddcb2e89eb39.zip
net: use sk_is_tcp() in more places
Move sk_is_tcp() to include/net/sock.h and use it where we can. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 8f2b2f2c0e7b..0be8e43f44b9 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -872,8 +872,7 @@ int sock_set_timestamping(struct sock *sk, int optname,
if (val & SOF_TIMESTAMPING_OPT_ID &&
!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) {
- if (sk->sk_protocol == IPPROTO_TCP &&
- sk->sk_type == SOCK_STREAM) {
+ if (sk_is_tcp(sk)) {
if ((1 << sk->sk_state) &
(TCPF_CLOSE | TCPF_LISTEN))
return -EINVAL;
@@ -1370,8 +1369,7 @@ set_sndbuf:
case SO_ZEROCOPY:
if (sk->sk_family == PF_INET || sk->sk_family == PF_INET6) {
- if (!((sk->sk_type == SOCK_STREAM &&
- sk->sk_protocol == IPPROTO_TCP) ||
+ if (!(sk_is_tcp(sk) ||
(sk->sk_type == SOCK_DGRAM &&
sk->sk_protocol == IPPROTO_UDP)))
ret = -ENOTSUPP;