diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2017-11-13 12:21:19 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2017-11-13 10:07:25 -0800 |
commit | aba736dc251ee7aa7c2035e18bffc37b18f05222 (patch) | |
tree | 97dc74f9fcdfc2dcb17a1716046c93694adcd104 | |
parent | 7d14d00795c334a288f1733bfdabdf363a7f962c (diff) | |
download | platform_external_iproute2-aba736dc251ee7aa7c2035e18bffc37b18f05222.tar.gz platform_external_iproute2-aba736dc251ee7aa7c2035e18bffc37b18f05222.tar.bz2 platform_external_iproute2-aba736dc251ee7aa7c2035e18bffc37b18f05222.zip |
ip: Fix compilation break on old systems
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 ‘xfrm_selector_print’:
ipxfrm.c:479:7: error: ‘IPPROTO_MH’ 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 ‘xfrm_selector_upspec_parse’:
ipxfrm.c:1345:8: error: ‘IPPROTO_MH’ 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 kernel's
header file (libc-compat.h) and is set in case there are no previous
libc relevant declarations.
In ip code, the include of <netdb.h> causes to indirect inclusion of
<netinet/in.h> and it sets __UAPI_DEF_IPPROTO_V6 to be zero and prevents 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 <xiyou.wangcong@gmail.com>
Cc: Riad Abo Raed <riada@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
-rw-r--r-- | ip/xfrm.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -30,6 +30,10 @@ #include <linux/xfrm.h> #include <linux/ipsec.h> +#ifndef IPPROTO_MH +#define IPPROTO_MH 135 +#endif + #define XFRMS_RTA(x) ((struct rtattr*)(((char*)(x)) + NLMSG_ALIGN(sizeof(struct xfrm_usersa_info)))) #define XFRMS_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct xfrm_usersa_info)) |