At the moment Linux Kernel 3.2 is the last supported LTS. It comes
without AF_VSOCK support (added only in 3.10), therefore old libcs,
such as glibc before 2.18 does not provide, cause ss(8) tool build
failures like following:

  ss.c:294:15: error: 'AF_VSOCK' undeclared here (not in a function)
  ss.c:323:2: error: array index in initializer not of integer type
  ss.c:323:2: error: (near initialization for 'default_afs')
  make[1]: *** [ss.o] Error 1
  make[1]: *** Waiting for unfinished jobs....
  make: *** [all] Error 2

Provide AF_VSOCK and PF_VSOCK defines for compatibility; adjust
AF_MAX and PF_MAX to reflect change.

Tested in Debian 7 (Wheezy) environment with glibc-2.13 and Linux
Kernel 3.2. Still supported config until 31 May 2018 according to
Debian LTS support page.

Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com>
---
 include/compat/libc/bits/socket.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 include/compat/libc/bits/socket.h

diff --git a/include/compat/libc/bits/socket.h 
b/include/compat/libc/bits/socket.h
new file mode 100644
index 0000000..25ef0d5
--- /dev/null
+++ b/include/compat/libc/bits/socket.h
@@ -0,0 +1,15 @@
+#ifndef _IP_COMPAT_BITS_SOCKET_H
+#define _IP_COMPAT_BITS_SOCKET_H
+
+#include_next <bits/socket.h>
+
+#ifndef AF_VSOCK
+#define PF_VSOCK       40
+#define AF_VSOCK       PF_VSOCK
+#undef PF_MAX
+#undef AF_MAX
+#define PF_MAX         41
+#define AF_MAX         PF_MAX
+#endif /* AF_VSOCK */
+
+#endif /* _IP_COMPAT_BITS_SOCKET_H */
-- 
1.7.10.4

Reply via email to