]> granicus.if.org Git - libnl/commitdiff
compat: add linux/socket.h for __kernel_sa_family_t
authorJeff Squyres <jsquyres@cisco.com>
Thu, 18 Aug 2016 22:40:27 +0000 (15:40 -0700)
committerThomas Haller <thaller@redhat.com>
Mon, 29 Aug 2016 10:49:45 +0000 (12:49 +0200)
The __kernel_sa_family_t type is not present on older systems (e.g.,
RHEL 6), and libnl3 will not built without it.  Copy
/usr/include/linux/socket.h from a RHEL7 system to
include/linux-private/linux/socket.h so that it will be found by the
build system.

Fortunately, this socket.h is small and self-contained; it contains
very little (and does not #include any other files) beyond necessary
type.

https://github.com/thom311/libnl/pull/107

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
include/Makefile.am
include/linux-private/linux/socket.h [new file with mode: 0644]

index f8b977ac46125c2e5a6df82a931d56dd3ce09849..fafb90a4c3d96487214587c13ff63902767349c8 100644 (file)
@@ -153,6 +153,7 @@ noinst_HEADERS = \
        linux-private/linux/netlink.h \
        linux-private/linux/pkt_cls.h \
        linux-private/linux/sock_diag.h \
+       linux-private/linux/socket.h \
        linux-private/linux/tc_act/tc_mirred.h \
        linux-private/linux/tc_act/tc_skbedit.h \
        linux-private/linux/pkt_sched.h \
diff --git a/include/linux-private/linux/socket.h b/include/linux-private/linux/socket.h
new file mode 100644 (file)
index 0000000..8c1e501
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef _LINUX_SOCKET_H
+#define _LINUX_SOCKET_H
+
+/*
+ * Desired design of maximum size and alignment (see RFC2553)
+ */
+#define _K_SS_MAXSIZE  128     /* Implementation specific max size */
+#define _K_SS_ALIGNSIZE        (__alignof__ (struct sockaddr *))
+                               /* Implementation specific desired alignment */
+
+typedef unsigned short __kernel_sa_family_t;
+
+struct __kernel_sockaddr_storage {
+       __kernel_sa_family_t    ss_family;              /* address family */
+       /* Following field(s) are implementation specific */
+       char            __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
+                               /* space to achieve desired size, */
+                               /* _SS_MAXSIZE value minus size of ss_family */
+} __attribute__ ((aligned(_K_SS_ALIGNSIZE)));  /* force desired alignment */
+
+#endif /* _LINUX_SOCKET_H */