summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-02-26 13:55:43 +0000
committerkib <kib@FreeBSD.org>2012-02-26 13:55:43 +0000
commit79e65f67d444ac3cdd9179557856fdbd87e82852 (patch)
tree5d73908d32525c35824026a4535eb4d32443ce8a /sys/kern/uipc_socket.c
parent18b7fd6ba380a5cd9998a1717bae17f595440bd4 (diff)
downloadFreeBSD-src-79e65f67d444ac3cdd9179557856fdbd87e82852.zip
FreeBSD-src-79e65f67d444ac3cdd9179557856fdbd87e82852.tar.gz
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 <jau iki fi> PR: kern/162352 Discussed with: bz Reviewed by: glebius MFC after: 2 weeks
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 4cd6a93..4233dda 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -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;
OpenPOWER on IntegriCloud