From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2] ip: Fix compilation break on old systems Date: Mon, 13 Nov 2017 07:33:37 -0800 Message-ID: <20171113073337.1387f7fa@xeon-e3> References: <20171113102119.11687-1-leon@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: netdev@vger.kernel.org, Leon Romanovsky , Cong Wang , Riad Abo Raed To: Leon Romanovsky Return-path: Received: from mail-pg0-f68.google.com ([74.125.83.68]:55721 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751605AbdKMPdl (ORCPT ); Mon, 13 Nov 2017 10:33:41 -0500 Received: by mail-pg0-f68.google.com with SMTP id 207so10105968pgc.12 for ; Mon, 13 Nov 2017 07:33:41 -0800 (PST) In-Reply-To: <20171113102119.11687-1-leon@kernel.org> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 13 Nov 2017 12:21:19 +0200 Leon Romanovsky wrote: > From: Leon Romanovsky >=20 > 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: >=20 > 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 use= 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 us= e in this > function) > case IPPROTO_MH: > ^ = = make[1]: *** [ipxfrm.o] Error 1 >=20 > 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 kernel's > header file (libc-compat.h) and is set in case there are no previous > libc relevant declarations. >=20 > In ip code, the include of causes to indirect inclusion of > and it sets __UAPI_DEF_IPPROTO_V6 to be zero and prevents = from > IPPROTO_MH declaration. >=20 > 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. >=20 > [1] https://www.spinics.net/lists/netdev/msg463980.html >=20 > Cc: Cong Wang > Cc: Riad Abo Raed > Signed-off-by: Leon Romanovsky > --- > ip/xfrm.h | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > 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 >=20 > +#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.