Discussion:
[Aardvark Bugs 0000840]: Add SO_DOMAIN and SO_PROTOCOL options for getsockopt()
Austin Group Bug Tracker
2014-05-23 16:00:46 UTC
Permalink
The following issue has been SUBMITTED.
======================================================================
http://austingroupbugs.net/view.php?id=840
======================================================================
Reported By: xroche
Assigned To:
======================================================================
Project: Aardvark Bugs
Issue ID: 840
Category: Aardvark Mk III
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Xavier Roche
Organization:
User Reference:
======================================================================
Date Submitted: 2014-05-23 16:00 UTC
Last Modified: 2014-05-23 16:00 UTC
======================================================================
Summary: Add SO_DOMAIN and SO_PROTOCOL options for
getsockopt()
Description:
Following the discussion "SO_DOMAIN and SO_PROTOCOL options for
getsockopt()" on the austin-group-l mailing-list, I am suggesting the
addition of two new features for getsockopt() to be used with sockets.

POSIX has a SO_TYPE option for getsockopt() to retrieve the socket type of
a given (socket) file descriptor.

The socket type is typically set when creating it through a call to:
int socket(int domain, int type, int protocol);

Unfortunately, there are no (standardized) options to fetch the first
domain attribute, or the last protocol attribute.

Linux has such options:
(http://man7.org/linux/man-pages/man7/socket.7.html)
SO_DOMAIN (since Linux 2.6.32)
Retrieves the socket domain as an integer, returning a value
such as AF_INET6. See socket(2) for details. This socket
option is read-only.

SO_PROTOCOL (since Linux 2.6.32)
Retrieves the socket protocol as an integer, returning a
value
such as IPPROTO_SCTP. See socket(2) for details. This
socket
option is read-only.

And Solaris has also a SO_DOMAIN option and a bit different SO_PROTOTYPE
one:
(http://docs.oracle.com/cd/E26505_01/html/816-5170/getsockopt-3socket.html#REFMAN3Bgetsockopt-3socket)
SO_DOMAIN
get the domain used in the socket (get only)

SO_PROTOTYPE
for socket in domains PF_INET and PF_INET6, get the underlying protocol
number used in the socket. For socket in domain PF_ROUTE, get the address
family used in the socket.

At last, FreeBSD has a SO_PROTOCOL (no SO_DOMAIN currently)
(http://www.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2)

SO_PROTOCOL
get the protocol number for the socket (get only)

Desired Action:
(1) add a SO_DOMAIN options for getsockopt() (invalid for setsockopt())
described as:
Retrieve the communications domain in which the socket was created

(2) add a SO_PROTOCOL options for getsockopt() (invalid for setsockopt())
described as:
Retrieve the protocol to be used with the socket

======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-05-23 16:00 xroche New Issue
2014-05-23 16:00 xroche Name => Xavier Roche
======================================================================
Loading...