[LEDE-DEV] [PATCH] libnl-tiny: Avoid re-defining ifmap

Florian Fainelli f.fainelli at gmail.com
Sun Nov 13 18:31:00 PST 2016


Guard the ifmap structure definition with __UAPI_DEF_IF_IFMAP to avoid
build errors like these with newer kernels:

In file included from
/home/florian/dev/openwrt/trunk/staging_dir/toolchain-arm_cortex-a8+vfpv3_gcc-6.2.0_glibc-2.24_eabi/include/linux/if_tunnel.h:5:0,
                 from
/home/florian/dev/openwrt/trunk/build_dir/target-arm_cortex-a8+vfpv3_glibc-2.24_eabi/netifd-2016-10-27/system-linux.c:37:
/home/florian/dev/openwrt/trunk/staging_dir/target-arm_cortex-a8+vfpv3_glibc-2.24_eabi/usr/include/libnl-tiny/linux/if.h:119:8:
error: redefinition of 'struct ifmap'
 struct ifmap
        ^~~~~
In file included from
/home/florian/dev/openwrt/trunk/build_dir/target-arm_cortex-a8+vfpv3_glibc-2.24_eabi/netifd-2016-10-27/system-linux.c:24:0:
/home/florian/dev/openwrt/trunk/staging_dir/toolchain-arm_cortex-a8+vfpv3_gcc-6.2.0_glibc-2.24_eabi/include/net/if.h:111:8:
note: originally defined here
 struct ifmap
        ^~~~~

Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
Not clear what's the best way to fix this, resyncing against a newer kernel's if.h turned out
to require pulling a lot more dependencies, like glibc-compat.h

This patch here is fairly non intrusive and works for the OpenWrt/LEDE kernels and a recent
upstream kernel as well.

 package/libs/libnl-tiny/src/include/linux/if.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/libs/libnl-tiny/src/include/linux/if.h b/package/libs/libnl-tiny/src/include/linux/if.h
index 4c1bcfec7f79..52eee433172e 100644
--- a/package/libs/libnl-tiny/src/include/linux/if.h
+++ b/package/libs/libnl-tiny/src/include/linux/if.h
@@ -116,6 +116,8 @@ enum {
  *	being very small might be worth keeping for clean configuration.
  */
 
+/* for compatibility with glibc net/if.h */
+#if __UAPI_DEF_IF_IFMAP
 struct ifmap 
 {
 	unsigned long mem_start;
@@ -126,6 +128,7 @@ struct ifmap
 	unsigned char port;
 	/* 3 bytes spare */
 };
+#endif
 
 
 #endif /* _LINUX_IF_H */
-- 
2.9.3




More information about the Lede-dev mailing list