summaryrefslogtreecommitdiff
path: root/include/linux/socket.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-09-20 22:12:56 -0300
committerRenato Westphal <renato@opensourcerouting.org>2017-10-24 09:20:12 -0200
commitba7773964c87019308e65a15b509e9889f7edc49 (patch)
tree866360d3a33d6d15266314e9c8778a278a6a400a /include/linux/socket.h
parent72806e2d23228892993eacdf9415f29eadb52f55 (diff)
build: include our own copies of some linux kernel headers
This is the definitive solution to avoid build issues on old Linux systems, where the system kernel headers might not contain some constants or macros used by FRR (e.g. MPLS_IPTUNNEL_DST, introduced on 2015). This is the same strategy adopted by other projects, like iproute2, libnl, lldpd, strongswan, etc. These header files don't need to be in sync with upstream, they only need to be updated when necessary (e.g. if we want to use a new feature introduced by a recent kernel). Fixes #962 using the solution suggested by David Lamparter. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'include/linux/socket.h')
-rw-r--r--include/linux/socket.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/socket.h b/include/linux/socket.h
new file mode 100644
index 0000000000..8c1e501774
--- /dev/null
+++ b/include/linux/socket.h
@@ -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 */