1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

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
This commit is contained in:
Konstantin Belousov 2012-02-26 13:55:43 +00:00
parent 9493639e35
commit 747d2fa178
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232179
2 changed files with 6 additions and 0 deletions

View File

@ -2733,6 +2733,10 @@ sogetopt(struct socket *so, struct sockopt *sopt)
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;

View File

@ -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
/*