summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Greg Hudson <ghudson@mit.edu>1998-03-03 16:05:17 +0000
committerGravatar Greg Hudson <ghudson@mit.edu>1998-03-03 16:05:17 +0000
commitab281e90df214db257acdbd140af23950a0ac863 (patch)
tree5d7eda2341772aa0dce3e472d61a93dbcfb99c26 /lib
parent723ffb41deb5c04d60f6c45ed71e1bff5add4278 (diff)
On Linux systems (or anything with SO_BSDCOMPAT), make sure we don't
get random ICMP errors on our unconnected socket.
Diffstat (limited to 'lib')
-rw-r--r--lib/ZOpenPort.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ZOpenPort.c b/lib/ZOpenPort.c
index cae00b8..74a6e97 100644
--- a/lib/ZOpenPort.c
+++ b/lib/ZOpenPort.c
@@ -24,6 +24,9 @@ Code_t ZOpenPort(port)
{
struct sockaddr_in bindin;
int len;
+#ifdef SO_BSDCOMPAT
+ int on = 1;
+#endif
(void) ZClosePort();
@@ -32,6 +35,11 @@ Code_t ZOpenPort(port)
return (errno);
}
+#ifdef SO_BSDCOMPAT
+ /* Prevent Linux from giving us socket errors we don't care about. */
+ setsockopt(__Zephyr_fd, SOL_SOCKET, SO_BSDCOMPAT, &on, sizeof(on));
+#endif
+
bindin.sin_family = AF_INET;
if (port && *port)