From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com ([209.85.215.68]:36804 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbeBZT1T (ORCPT ); Mon, 26 Feb 2018 14:27:19 -0500 Received: by mail-lf0-f68.google.com with SMTP id g72so4492198lfg.3 for ; Mon, 26 Feb 2018 11:27:18 -0800 (PST) Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4 To: Thomas De Schampheleire , netdev@vger.kernel.org References: <20180226185112.9657-1-thomas.de_schampheleire@nokia.com> From: Serhey Popovych Message-ID: Date: Mon, 26 Feb 2018 21:27:10 +0200 MIME-Version: 1.0 In-Reply-To: <20180226185112.9657-1-thomas.de_schampheleire@nokia.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="K6X3pUXQl5NHvNlbg1gr8DVY4jCcQqTHu" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --K6X3pUXQl5NHvNlbg1gr8DVY4jCcQqTHu Content-Type: multipart/mixed; boundary="2zrtKuAnwMnjFNmNb013vUtMz4BKVCFdv"; protected-headers="v1" From: Serhey Popovych To: Thomas De Schampheleire , netdev@vger.kernel.org Message-ID: Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4 References: <20180226185112.9657-1-thomas.de_schampheleire@nokia.com> In-Reply-To: <20180226185112.9657-1-thomas.de_schampheleire@nokia.com> --2zrtKuAnwMnjFNmNb013vUtMz4BKVCFdv Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thomas De Schampheleire wrote: > Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses ty= pes > __kernel_long_t and __kernel_ulong_t but does not provide internal > definitions for it. I tried one time to build with headers from 3.2 (last supported LTS at the moment) and found that AF_VSOCK is missing. As result of defining AF_VSOCK we need to adjust AF_MAX. Not sure this is correct at all but this helps to build with old headers. diff --git a/misc/ss.c b/misc/ss.c index 49f9c49..2849bc6 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -46,6 +46,16 @@ #include #include +#ifndef AF_VSOCK +#define AF_VSOCK 40 +#if defined(AF_MAX) && AF_MAX < 41 +#undef AF_MAX +#endif +#ifndef AF_MAX +#define AF_MAX 41 +#endif /* AF_MAX */ +#endif /* AF_VSOCK */ >=20 > This means that compilation using kernel headers that are older than 3.= 4 > (where these types were added) will fail. This situation may be uncommo= n for > native compilation, but not uncommon for cross compilation where the > toolchains may be a bit older. >=20 > Provide the necessary types internally if not provided by the kernel > headers to fix compilation in such cases. >=20 > Signed-off-by: Thomas De Schampheleire > --- > include/uapi/linux/posix_types.h | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posi= x_types.h > index 9a7a740b..60f3d378 100644 > --- a/include/uapi/linux/posix_types.h > +++ b/include/uapi/linux/posix_types.h > @@ -35,4 +35,13 @@ typedef int __kernel_mqd_t; > =20 > #include > =20 > +/* in case the kernel header asm/posix_types.h is too old (< 3.4) to p= rovide > + * __kernel_long_t, provide it here */ > +#ifndef __kernel_long_t > +typedef long __kernel_long_t; > +#endif > +#ifndef __kernel_ulong_t There is no such define. Only __kernel_long_t. > +typedef unsigned long __kernel_ulong_t; > +#endif > + > #endif /* _LINUX_POSIX_TYPES_H */ >=20 --2zrtKuAnwMnjFNmNb013vUtMz4BKVCFdv-- --K6X3pUXQl5NHvNlbg1gr8DVY4jCcQqTHu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJalF+TAAoJEBTawMmQ61bBp0oH/2+ppvubPN/mV3KdxmJHU418 BwSK1o21r0kwWyYj96rd74sAOaKvW5Jb8usNPSli/O4j9brzO+idOsoVBXsoLiO9 k7BmSPdeDSLAgC2UeXY8qgKcEt4luMvroZQRwvwxUTjSJ6Y1AAKVmFWSNVUJXcqs +T2T78wMFaudFCrDSu8GkLeq72ZmfSNhs2dpNwLUgoT8GiSWuZwh7YAhNP8xdWJJ LfZnd0GOKq2zJ2EuLs3KdeRYSOGoMnr53mIdFz+RjE/LcXqclSfJabUkGyhxSNjg Yv+6bhqu9UqRemdIyyidgap13MlpevlZ9YJmtAx0G8fNpxur/F+g8Iqk+l58ujw= =uP1s -----END PGP SIGNATURE----- --K6X3pUXQl5NHvNlbg1gr8DVY4jCcQqTHu--