summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_socket.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_socket.c b/usr/src/uts/common/brand/lx/syscall/lx_socket.c
index 694549a4cb..628b3490db 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_socket.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_socket.c
@@ -22,7 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
* Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
*/
@@ -1402,6 +1402,18 @@ lx_socket_create(int domain, int type, int protocol, int options, file_t **fpp,
file_t *fp;
int err, fd;
+ /*
+ * EACCES is returned in Linux when the user isn't allowed to use a
+ * "ping socket". EACCES is also used by the iputils-ping userland
+ * application to determine if fallback to SOCK_RAW is necessary.
+ *
+ * This can be removed if we ever implement SOCK_DGRAM + IPPROTO_ICMP.
+ */
+ if ((domain == AF_INET && type == SOCK_DGRAM && protocol ==
+ IPPROTO_ICMP) || (domain == AF_INET6 && type == SOCK_DGRAM &&
+ protocol == IPPROTO_ICMPV6))
+ return (EACCES);
+
/* logic cloned from so_socket */
so = socket_create(domain, type, protocol, NULL, NULL, SOCKET_SLEEP,
SOV_DEFAULT, CRED(), &err);