Skip to content

Commit

Permalink
SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP
Browse files Browse the repository at this point in the history
ENOTSUPP is documented as "should never be seen by user programs",
and thus not exposed in <errno.h>, and thus applications cannot safely
check against it (they get "Unknown error 524" as strerror). We should
rather return the well-known -EOPNOTSUPP.

This is similar to 2230a7e ("drop_monitor: Use correct error
code") and 4a5cdc6 ("net/tls: Fix return values to avoid
ENOTSUPP"), which did not seem to cause problems.

Signed-off-by: Samuel Thibault <[email protected]>
Acked-by: Willem de Bruijn <[email protected]>
Link: https://lore.kernel.org/r/20220307223126.djzvg44v2o2jkjsx@begin
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
sthibaul authored and kuba-moo committed Mar 9, 2022
1 parent 964efda commit 869420a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,9 +1377,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
if (!(sk_is_tcp(sk) ||
(sk->sk_type == SOCK_DGRAM &&
sk->sk_protocol == IPPROTO_UDP)))
ret = -ENOTSUPP;
ret = -EOPNOTSUPP;
} else if (sk->sk_family != PF_RDS) {
ret = -ENOTSUPP;
ret = -EOPNOTSUPP;
}
if (!ret) {
if (val < 0 || val > 1)
Expand Down

0 comments on commit 869420a

Please sign in to comment.