From owner-svn-src-head@FreeBSD.ORG Sun Feb 26 13:55:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4C96106566B; Sun, 26 Feb 2012 13:55:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D44788FC12; Sun, 26 Feb 2012 13:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QDthwV068044; Sun, 26 Feb 2012 13:55:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QDth33068041; Sun, 26 Feb 2012 13:55:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202261355.q1QDth33068041@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 26 Feb 2012 13:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232179 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 26 Feb 2012 13:55:44 -0000 Author: kib Date: Sun Feb 26 13:55:43 2012 New Revision: 232179 URL: http://svn.freebsd.org/changeset/base/232179 Log: Add SO_PROTOCOL/SO_PROTOTYPE socket SOL_SOCKET-level option to get the socket protocol number. This is useful since the socket type can be implemented by different protocols in the same protocol family, e.g. SOCK_STREAM may be provided by both TCP and SCTP. Submitted by: Jukka A. Ukkonen PR: kern/162352 Discussed with: bz Reviewed by: glebius MFC after: 2 weeks Modified: head/sys/kern/uipc_socket.c head/sys/sys/socket.h Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun Feb 26 13:51:05 2012 (r232178) +++ head/sys/kern/uipc_socket.c Sun Feb 26 13:55:43 2012 (r232179) @@ -2733,6 +2733,10 @@ integer: optval = so->so_type; goto integer; + case SO_PROTOCOL: + optval = so->so_proto->pr_protocol; + goto integer; + case SO_ERROR: SOCK_LOCK(so); optval = so->so_error; Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Sun Feb 26 13:51:05 2012 (r232178) +++ head/sys/sys/socket.h Sun Feb 26 13:55:43 2012 (r232179) @@ -138,6 +138,8 @@ typedef __uid_t uid_t; #define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */ #define SO_SETFIB 0x1014 /* use this FIB to route */ #define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */ +#define SO_PROTOCOL 0x1016 /* get socket protocol (Linux name) */ +#define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */ #endif /*