Commit fed50218 for quagga.net
commit fed50218deeaef4d996d25c45b1aa56fe5e337c4
Author: Xiami <taopy@vip.qq.com>
Date: Sun Feb 4 16:35:42 2018 +0000
lib: Avoid re-definition of IPPROTO_IP with some versions of Linux
* Starting from linux-4.11 [commit
bcb41c6bced1ee778d23c53a6b4807fb08cf5540], linux/mroute.h includes
linux/in.h , that makes gcc roar a lot of things like "error:
redeclaration of enumerator 'IPPROTO_IP'" when compiling quagga-1.2.2
lib/zebra.h includes sys/capability.h first, then includes
netinet/in.h . In sys/capability.h, it includes linux/xattr.h, and
that includes linux/libc-compat.h . Since at that time netinet/in.h is
not included yet, _NETINET_IN_H is not defined, causing libc-compat.h
set __UAPI_DEF_IN_IPPROTO to 1. Then, a include of netinet/in.h
defines IPPROTO_IP. Later a include of linux/mroute.h includes
linux/in.h. Because __UAPI_DEF_IN_IPPROTO is set to non zero,
IPPROTO_IP is redeclared.
* lib/zebra.h: Move the privs/capabilities include block to after the
network block.
diff --git a/lib/zebra.h b/lib/zebra.h
index a405d46e..1bb951fe 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -130,16 +130,6 @@ typedef int socklen_t;
#endif /* !va_copy */
#endif /* !C99 */
-
-#ifdef HAVE_LCAPS
-#include <sys/capability.h>
-#include <sys/prctl.h>
-#endif /* HAVE_LCAPS */
-
-#ifdef HAVE_SOLARIS_CAPABILITIES
-#include <priv.h>
-#endif /* HAVE_SOLARIS_CAPABILITIES */
-
/* network include group */
#include <sys/socket.h>
@@ -224,6 +214,16 @@ typedef int socklen_t;
#include <netinet6/nd6.h>
#endif /* HAVE_NETINET6_ND6_H */
+/* Privileges / capabilities */
+#ifdef HAVE_LCAPS
+#include <sys/capability.h>
+#include <sys/prctl.h>
+#endif /* HAVE_LCAPS */
+
+#ifdef HAVE_SOLARIS_CAPABILITIES
+#include <priv.h>
+#endif /* HAVE_SOLARIS_CAPABILITIES */
+
/* Some systems do not define UINT32_MAX, etc.. from inttypes.h
* e.g. this makes life easier for FBSD 4.11 users.
*/