Patchwork Add a number of protocols to __SOCKADDR_ALLTYPES

login
register
mail settings
Submitter Ralf Baechle
Date Aug. 3, 2017, 12:04 p.m.
Message ID <20170803120448.GA24196@linux-mips.org>
Download mbox | patch
Permalink /patch/21890/
State New
Headers show

Comments

Ralf Baechle - Aug. 3, 2017, 12:04 p.m.
__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  <ralf@linux-mips.org>

        * 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(+)

Patch

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.  */
 # define __SOCKADDR_ALLTYPES \
+  __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)