From owner-svn-src-head@freebsd.org Tue Aug 21 14:04:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 437FD107364D; Tue, 21 Aug 2018 14:04:32 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED7BF84C6C; Tue, 21 Aug 2018 14:04:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAAD224FBF; Tue, 21 Aug 2018 14:04:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7LE4Vpr052362; Tue, 21 Aug 2018 14:04:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7LE4VlP052359; Tue, 21 Aug 2018 14:04:31 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201808211404.w7LE4VlP052359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 21 Aug 2018 14:04:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338136 - in head: lib/libc/sys sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: lib/libc/sys sys/kern sys/sys X-SVN-Commit-Revision: 338136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Aug 2018 14:04:32 -0000 Author: tuexen Date: Tue Aug 21 14:04:30 2018 New Revision: 338136 URL: https://svnweb.freebsd.org/changeset/base/338136 Log: Add SOL_SOCKET level socket option with name SO_DOMAIN to get the domain of a socket. This is helpful when testing and Solaris and Linux have the same socket option using the same name. Reviewed by: bcr@, rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16791 Modified: head/lib/libc/sys/getsockopt.2 head/sys/kern/uipc_socket.c head/sys/sys/socket.h Modified: head/lib/libc/sys/getsockopt.2 ============================================================================== --- head/lib/libc/sys/getsockopt.2 Tue Aug 21 13:37:06 2018 (r338135) +++ head/lib/libc/sys/getsockopt.2 Tue Aug 21 14:04:30 2018 (r338136) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd May 9, 2018 +.Dd August 21, 2018 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -172,6 +172,7 @@ for the socket .It Dv SO_TIMESTAMP Ta "enables reception of a timestamp with datagrams" .It Dv SO_BINTIME Ta "enables reception of a timestamp with datagrams" .It Dv SO_ACCEPTCONN Ta "get listening status of the socket (get only)" +.It Dv SO_DOMAIN Ta "get the domain of the socket (get only)" .It Dv SO_TYPE Ta "get the type of the socket (get only)" .It Dv SO_PROTOCOL Ta "get the protocol number for the socket (get only)" .It Dv SO_PROTOTYPE Ta "SunOS alias for the Linux SO_PROTOCOL (get only)" Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Aug 21 13:37:06 2018 (r338135) +++ head/sys/kern/uipc_socket.c Tue Aug 21 14:04:30 2018 (r338136) @@ -3008,6 +3008,10 @@ integer: error = sooptcopyout(sopt, &optval, sizeof optval); break; + case SO_DOMAIN: + optval = so->so_proto->pr_domain->dom_family; + goto integer; + case SO_TYPE: optval = so->so_type; goto integer; Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Tue Aug 21 13:37:06 2018 (r338135) +++ head/sys/sys/socket.h Tue Aug 21 14:04:30 2018 (r338136) @@ -171,6 +171,7 @@ typedef __uintptr_t uintptr_t; #define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */ #define SO_TS_CLOCK 0x1017 /* clock type used for SO_TIMESTAMP */ #define SO_MAX_PACING_RATE 0x1018 /* socket's max TX pacing rate (Linux name) */ +#define SO_DOMAIN 0x1019 /* get socket domain */ #endif #if __BSD_VISIBLE