Skip to contentSkip to conversation

ss: fix compilation under glibc < 2.18

PATCH In review Thomas De Schampheleire 2 participants 4 messages Feb 20, 2019 – Feb 21, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ss: fix compilation under glibc < 2.18

From: Thomas De Schampheleire <[email protected]>

Commit c759116a0b2b6da8df9687b0a40ac69050132c77 introduced support for AF_VSOCK. This define is only provided since glibc version 2.18, so compilation fails when using older toolchains.

Provide the necessary definitions if needed.

---
 misc/ss.c | 8 ++++++++
 1 file changed, 8 insertions(+)
misc/ss.c +8 -0
index 9e821faf..766fdc5f 100644
@@ -51,6 +51,14 @@
 #include <linux/tipc_netlink.h>
 #include <linux/tipc_sockets_diag.h>
 
+/* AF_VSOCK/PF_VSOCK is only provided since glibc 2.18 */
+#ifndef PF_VSOCK
+#define PF_VSOCK 40
+#endif
+#ifndef AF_VSOCK
+#define AF_VSOCK PF_VSOCK
+#endif
+
 #define MAGIC_SEQ 123456
 #define BUF_CHUNK (1024 * 1024)
 #define LEN_ALIGN(x) (((x) + 1) & ~1)
Signature · 1 line
2.19.2
#1 lore raw
Quoted 9 lines · On Wed, 20 Feb 2019 15:41:51 +0100 Thomas De Schampheleire…

From: Thomas De Schampheleire <[email protected]>

Commit c759116a0b2b6da8df9687b0a40ac69050132c77 introduced support for AF_VSOCK. This define is only provided since glibc version 2.18, so compilation fails when using older toolchains.

Provide the necessary definitions if needed.

Not sure why you would want new iproute2 with a 5 year old version of glibc? Yes that means update your tool chain.

#2 lore raw
Quoted 10 lines · Stephen Hemminger
Quoted 6 lines · On Wed, 20 Feb 2019 15:41:51 +0100 Thomas De Schampheleire…

From: Thomas De Schampheleire <[email protected]>

Commit c759116a0b2b6da8df9687b0a40ac69050132c77 introduced support for AF_VSOCK. This define is only provided since glibc version 2.18, so compilation fails when using older toolchains.

Quoted 7 lines
Quoted 3 lines

Provide the necessary definitions if needed.

Not sure why you would want new iproute2 with a 5 year old version of glibc? Yes that means update your tool chain.

This problem is noticed for an embedded system. It has up-to-date applications and libraries (built via Buildroot) but the toolchain and kernel are supplied by the SoC vendor (in this case Marvell, formerly Cavium Networks). Unfortunately their toolchain is lagging behind and is still using glibc 2.16.

I could handle this patch locally, but I think there may be other people in a similar situation which would benefit from an upstream fix.

Best regards,
Thomas

#3 lore raw
Quoted 26 lines · On Thu, 21 Feb 2019 08:43:08 +0100 Thomas De Schampheleire…
Quoted 10 lines · Stephen Hemminger
Quoted 6 lines · On Wed, 20 Feb 2019 15:41:51 +0100 Thomas De Schampheleire…

From: Thomas De Schampheleire <[email protected]>

Commit c759116a0b2b6da8df9687b0a40ac69050132c77 introduced support for AF_VSOCK. This define is only provided since glibc version 2.18, so compilation fails when using older toolchains.

Quoted 7 lines
Quoted 3 lines

Provide the necessary definitions if needed.

Not sure why you would want new iproute2 with a 5 year old version of glibc? Yes that means update your tool chain.

This problem is noticed for an embedded system. It has up-to-date applications and libraries (built via Buildroot) but the toolchain and kernel are supplied by the SoC vendor (in this case Marvell, formerly Cavium Networks). Unfortunately their toolchain is lagging behind and is still using glibc 2.16.

Quoted 3 lines

I could handle this patch locally, but I think there may be other people in a similar situation which would benefit from an upstream fix.

OK applied, just don't want to keep lots of old cruft in the code since it can lead to future suprise bugs.