diff mbox series

[iproute2] ss: fix compilation under glibc < 2.18

Message ID 20190220144151.17943-1-patrickdepinguin@gmail.com
State Accepted
Delegated to: stephen hemminger
Headers show
Series [iproute2] ss: fix compilation under glibc < 2.18 | expand

Commit Message

Thomas De Schampheleire Feb. 20, 2019, 2:41 p.m. UTC
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

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.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 misc/ss.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Stephen Hemminger Feb. 21, 2019, 1:53 a.m. UTC | #1
On Wed, 20 Feb 2019 15:41:51 +0100
Thomas De Schampheleire <patrickdepinguin@gmail.com> wrote:

> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> 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.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Not sure why you would want new iproute2 with a 5 year old version of glibc?
Yes that means update your tool chain.
Thomas De Schampheleire Feb. 21, 2019, 7:43 a.m. UTC | #2
El jue., 21 feb. 2019 a las 2:53, Stephen Hemminger
(<stephen@networkplumber.org>) escribió:
>
> On Wed, 20 Feb 2019 15:41:51 +0100
> Thomas De Schampheleire <patrickdepinguin@gmail.com> wrote:
>
> > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >
> > 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.
> >
> > Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> 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
Stephen Hemminger Feb. 21, 2019, 10:49 p.m. UTC | #3
On Thu, 21 Feb 2019 08:43:08 +0100
Thomas De Schampheleire <patrickdepinguin@gmail.com> wrote:

> El jue., 21 feb. 2019 a las 2:53, Stephen Hemminger
> (<stephen@networkplumber.org>) escribió:
> >
> > On Wed, 20 Feb 2019 15:41:51 +0100
> > Thomas De Schampheleire <patrickdepinguin@gmail.com> wrote:
> >  
> > > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> > >
> > > 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.
> > >
> > > Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>  
> >
> > 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.

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

Patch

diff --git a/misc/ss.c b/misc/ss.c
index 9e821faf..766fdc5f 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -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)