This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add a number of protocols to __SOCKADDR_ALLTYPES

__SOCKADDR_ALLTYPES is lacking a number of sockaddr_* variants so those
can't be passed to syscalls such as bind, sendto, recvfrom oder
getsockname or a warning or build error such as

beacon.c: In function ‘main’:
beacon.c:188:15: error: incompatible type for argument 2 of ‘bind’
   if (bind(s, &src, len) == -1) {

will hit.  Adding a number of sockaddr_* fixes these problems.

2017-08-03  Ralf Baechle  <>

        * socket/sys/socket.h (__SOCKADDR_ALLTYPES.): Add
        full_sockaddr_ax25 , sockaddr_ll, sockaddr_pkt and sockaddr_rose.

 socket/sys/socket.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index bbfde8f602..061f457993 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -61,6 +61,7 @@ enum
 /* Add more `struct sockaddr_AF' types here as necessary.
    These are all the ones I found on NetBSD and Linux.  */
+  __SOCKADDR_ONETYPE (full_sockaddr_ax25) \
   __SOCKADDR_ONETYPE (sockaddr) \
   __SOCKADDR_ONETYPE (sockaddr_at) \
   __SOCKADDR_ONETYPE (sockaddr_ax25) \
@@ -71,7 +72,10 @@ enum
   __SOCKADDR_ONETYPE (sockaddr_inarp) \
   __SOCKADDR_ONETYPE (sockaddr_ipx) \
   __SOCKADDR_ONETYPE (sockaddr_iso) \
+  __SOCKADDR_ONETYPE (sockaddr_ll) \
   __SOCKADDR_ONETYPE (sockaddr_ns) \
+  __SOCKADDR_ONETYPE (sockaddr_pkt) \
+  __SOCKADDR_ONETYPE (sockaddr_rose) \
   __SOCKADDR_ONETYPE (sockaddr_un) \
   __SOCKADDR_ONETYPE (sockaddr_x25)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]