diff --git a/doc/socat.yo b/doc/socat.yo index d8f2ab0..4124a35 100644 --- a/doc/socat.yo +++ b/doc/socat.yo @@ -1981,9 +1981,9 @@ label(OPTION_SO_TYPE)dit(bf(tt(type=))) [link(int)(TYPE_INT)]. Address resolution is not affected by this option. Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3 means raw socket. -label(OPTION_SO_PROTOTYPE)dit(bf(tt(prototype))) +label(OPTION_SO_PROTOCOL)dit(bf(tt(protocol))) Sets the protocol of the socket, specified as third argument to the - code(socket()) or code(socketpair()) calls, to + code(socket()) or code(socketpair()) calls, to [link(int)(TYPE_INT)]. Address resolution is not affected by this option. 6 means TCP, 17 means UDP. COMMENT(label(OPTION_USELOOPBACK)dit(bf(tt(useloopback))) diff --git a/xio-socket.c b/xio-socket.c index 3508254..7f4e461 100644 --- a/xio-socket.c +++ b/xio-socket.c @@ -173,7 +173,7 @@ const struct optdesc opt_so_dontlinger = {"so-dontlinger", "dontlinger", OPT_SO #endif /* the SO_PROTOTYPE is OS defined on Solaris, HP-UX; we lend this for a more general purpose */ -const struct optdesc opt_so_prototype = {"so-prototype", "prototype", OPT_SO_PROTOTYPE, GROUP_SOCKET,PH_SOCKET, TYPE_INT,OFUNC_SPEC, SOL_SOCKET,SO_PROTOTYPE }; +const struct optdesc opt_so_prototype = {"so-protocol", "protocol", OPT_SO_PROTOTYPE, GROUP_SOCKET,PH_SOCKET, TYPE_INT,OFUNC_SPEC, SOL_SOCKET,SO_PROTOCOL }; #ifdef FIOSETOWN const struct optdesc opt_fiosetown = { "fiosetown", NULL, OPT_FIOSETOWN, GROUP_SOCKET, PH_PASTSOCKET, TYPE_INT, OFUNC_IOCTL, FIOSETOWN }; #endif diff --git a/xio-socket.h b/xio-socket.h index e8f123c..62cfe72 100644 --- a/xio-socket.h +++ b/xio-socket.h @@ -5,10 +5,18 @@ #ifndef __xio_socket_h_included #define __xio_socket_h_included 1 -/* SO_PROTOTYPE is OS defined on Solaris, HP-UX; we lend this for a more - general purpose */ -#ifndef SO_PROTOTYPE -#define SO_PROTOTYPE 0x9999 +/* SO_PROTOTYPE is defined on Solaris, HP-UX + SO_PROTOCOL in Linux, is the better name, but came much later */ +#ifdef SO_PROTOCOL +# undef SO_PROTOTYPE +# define SO_PROTOTYPE SO_PROTOCOL +#else +# ifdef SO_PROTOTYPE +# define SO_PROTOCOL SO_PROTOTYPE +# else +# define SO_PROTOCOL 0x9999 +# define SO_PROTOTYPE SO_PROTOCOL +# endif #endif extern const struct addrdesc xioaddr_socket_connect; diff --git a/xioopts.c b/xioopts.c index ba2062b..6854235 100644 --- a/xioopts.c +++ b/xioopts.c @@ -1519,6 +1519,7 @@ const struct optname optionnames[] = { IF_SOCKET ("so-priority", &opt_so_priority) #endif #ifdef SO_PROTOTYPE + IF_SOCKET ("so-protocol", &opt_so_prototype) IF_SOCKET ("so-prototype", &opt_so_prototype) #endif IF_SOCKET ("so-rcvbuf", &opt_so_rcvbuf)