From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leon Romanovsky Subject: Re: [PATCH iproute2] ip: Fix compilation break on old systems Date: Mon, 13 Nov 2017 18:04:44 +0200 Message-ID: <20171113160444.GM18825@mtr-leonro.local> References: <20171113102119.11687-1-leon@kernel.org> <20171113073337.1387f7fa@xeon-e3> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zS9klqLmw6ZV6yuC" Cc: netdev@vger.kernel.org, Cong Wang , Riad Abo Raed To: Stephen Hemminger Return-path: Received: from mail.kernel.org ([198.145.29.99]:55048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753209AbdKMQEs (ORCPT ); Mon, 13 Nov 2017 11:04:48 -0500 Content-Disposition: inline In-Reply-To: <20171113073337.1387f7fa@xeon-e3> Sender: netdev-owner@vger.kernel.org List-ID: --zS9klqLmw6ZV6yuC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 13, 2017 at 07:33:37AM -0800, Stephen Hemminger wrote: > On Mon, 13 Nov 2017 12:21:19 +0200 > Leon Romanovsky wrote: > > > From: Leon Romanovsky > > > > As was reported [1], the iproute2 fails to compile on old systems, > > in Cong's case, it was Fedora 19, in our case it was RedHat 7.2, which > > failed with the following errors during compilation: > > > > ipxfrm.c: In function =E2=80=98xfrm_selector_print=E2=80=99: > > ipxfrm.c:479:7: error: =E2=80=98IPPROTO_MH=E2=80=99 undeclared (first u= se in this > > function) > > case IPPROTO_MH: > > ^ > > ipxfrm.c:479:7: note: each undeclared identifier is reported only once > > for each function it appears in > > ipxfrm.c: In function =E2=80=98xfrm_selector_upspec_parse=E2=80=99: > > ipxfrm.c:1345:8: error: =E2=80=98IPPROTO_MH=E2=80=99 undeclared (first = use in this > > function) > > case IPPROTO_MH: > > ^ = = make[1]: *** [ipxfrm.o] Error 1 > > > > The reason to it is the order of headers files. The IPPROTO_MH field is > > set in kernel's UAPI header file (in6.h), but only in case > > __UAPI_DEF_IPPROTO_V6 is set before. That define comes from other kerne= l's > > header file (libc-compat.h) and is set in case there are no previous > > libc relevant declarations. > > > > In ip code, the include of causes to indirect inclusion of > > and it sets __UAPI_DEF_IPPROTO_V6 to be zero and prevent= s from > > IPPROTO_MH declaration. > > > > This patch takes the simplest possible approach to fix the compilation > > error by checking if IPPROTO_MH was defined before and in case it > > wasn't, it defines it to be the same as in the kernel. > > > > [1] https://www.spinics.net/lists/netdev/msg463980.html > > > > Cc: Cong Wang > > Cc: Riad Abo Raed > > Signed-off-by: Leon Romanovsky > > --- > > ip/xfrm.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/ip/xfrm.h b/ip/xfrm.h > > index 8566d639..71be574d 100644 > > --- a/ip/xfrm.h > > +++ b/ip/xfrm.h > > @@ -30,6 +30,10 @@ > > #include > > #include > > > > +#ifndef IPPROTO_MH > > +#define IPPROTO_MH 135 > > +#endif > > + > > Is there some way to add an additional header to the file instead? > Doing local definitions seems like it might cause a future issue. I tried various combinations of includes and didn't find working solution. In this specific case, the value of IPPROTO_MH is defined in kernel UAPI an= d it will be with us forever. Thanks --zS9klqLmw6ZV6yuC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkhr/r4Op1/04yqaB5GN7iDZyWKcFAloJwpwACgkQ5GN7iDZy WKdyPBAAzFts6LdejG7Liv4WQoyZDLdp8dUa1SY3V/5jg8HjulYqxk34/rHs5Ztj lyhMHaJVwytslB2yYn8K1tY5Itq4y8O2jr/oH28VRbAM6FSnpQsQ4PoHuY0UKVGw bKuO/6mHgD6LQQVdSAbgOR6xFodjw4Zmip3KSN1GRM3yIET5eCPeruWvaWp8WSW+ rzSmOlG7aNNVre/wXxNc4k6SVjUoxoWlKN3hLCJXQ2/DARvGP1X2k+YYppif4gf2 oJCxVvOglUCTXaJYKhqDP2KKIVgWfqO0ViL17csGapb8ydSba/yNuSDhIcY0o8OJ D/2DPcNte04PajsHaxNIP146dtld+nO9hgcBYdJUUA1Gokq22HOgMxpB14pscon4 KLAIyVCsZa+qphzeWZG/o8j9pcXJ18y82y04RwaI29QjjdJriWEXpv1kqYgzKmx0 yjRQy8BYyzryxHNNbR391W7PQ2kjZ6rrTh9s0XgT7KN/eCF5ZQu19DfQEAg7s/gT gjN1uvRQFMo3vk5PGkyM/4t4/0jjkmTwLP7vKDqReJAdcDFnGEboeQmsMUHg1zUH XlHiXq979/TsQji987fT/uprca+IPg+a/mBFlgSYXw24DIUVfkwF3TK73B9k94g5 cXh4VBgaALHAbDNUHGA/tLN4HGPO4REyfS623XGVxHGja8kmduw= =P3xd -----END PGP SIGNATURE----- --zS9klqLmw6ZV6yuC--