Page MenuHomeFreeBSD

D41412.diff
No OneTemporary

D41412.diff

diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -750,7 +750,19 @@
}
so->so_listen = head;
so->so_type = head->so_type;
- so->so_options = head->so_options & ~SO_ACCEPTCONN;
+ /*
+ * POSIX is ambiguous on what options an accept(2)ed socket should
+ * inherit from the listener. Words "create a new socket" may be
+ * interpreted as not inheriting anything. Best programming practice
+ * for application developers is to not rely on such inheritance.
+ * FreeBSD had historically inherited all so_options excluding
+ * SO_ACCEPTCONN, which virtually means all SOL_SOCKET level options,
+ * including those completely irrelevant to a new born socket. For
+ * compatibility with older versions we will inherit a list of
+ * meaningful options.
+ */
+ so->so_options = head->so_options & (SO_KEEPALIVE | SO_DONTROUTE |
+ SO_LINGER | SO_OOBINLINE | SO_NOSIGPIPE);
so->so_linger = head->so_linger;
so->so_state = head->so_state;
so->so_fibnum = head->so_fibnum;

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 3, 12:28 AM (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13408703
Default Alt Text
D41412.diff (1 KB)

Event Timeline