From 35097709fa3f0ab3eed083481a323e76947f24a5 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 30 Sep 2009 02:42:06 +0200 Subject: [PATCH] Define ioctl for VLAN and bond. We also give some kind of advice for people without if_vlan.h or with an outdated if_bonding.h (for example, people with RHEL 2.1). --- README | 10 ++++++++++ configure.ac | 21 ++++++++++++++++++++- src/compat.h | 12 ++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/README b/README index 971f3685..bdbec4d9 100644 --- a/README +++ b/README @@ -30,6 +30,16 @@ Net-SNMP is incomplete. The easiest way to fix this is to provide an empty struct.h: touch src/struct.h +If you are missing some headers or if some headers are incorrect +(if_vlan.h and if_bonding.h on RHEL 2.1 for example), you can copy +some more current version (for example from Debian Lenny or from +Fedora) in some directory like "extra-headers/": + - ./extra-headers/linux/if_vlan.h + - ./extra-headers/linux/if_bonding.h +Then, configure like this: + ./configure CFLAGS="-Wall -I${PWD}/extra-headers" +This has been tested with RHEL 2.1. + lldpd uses privilege separation to increase its security. Two processes, one running as root and doing minimal stuff and the other running as an unprivileged user into a chroot doing most of the stuff, diff --git a/configure.ac b/configure.ac index b373769b..71569415 100644 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,6 @@ AC_CHECK_HEADERS([ \ AC_CHECK_HEADERS([ \ linux/wireless.h \ linux/if_bonding.h \ - linux/if_vlan.h \ linux/if_bridge.h \ linux/if_packet.h \ ],,AC_MSG_ERROR([Required header missing.]),[ @@ -71,6 +70,12 @@ AC_CHECK_HEADERS([ \ ],,AC_MSG_ERROR([Required header missing.]),[ @%:@include ]) +AC_CHECK_HEADERS([ \ + linux/if_vlan.h \ +],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[ +@%:@include +@%:@include +]) AC_CACHE_SAVE @@ -90,6 +95,20 @@ SLIST_REMOVE_HEAD, \ SLIST_EMPTY \ ],[],[],[[@%:@include ]]) +# On some systems, some ioctl are not declared +AC_CHECK_DECLS([ \ +SIOCGIFVLAN, \ +SIOCBONDINFOQUERY, \ +SIOCBONDSLAVEINFOQUERY \ +],[],[],[[@%:@include ]]) +AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [], + [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])], + [ +@%:@include +@%:@include +@%:@include +]) + # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h) AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include ]]) diff --git a/src/compat.h b/src/compat.h index 3f5823de..f05b6a51 100644 --- a/src/compat.h +++ b/src/compat.h @@ -93,6 +93,18 @@ struct { \ #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #endif +#if !HAVE_SIOCGIFVLAN +#define SIOCGIFVLAN 0x8982 +#endif + +#if !HAVE_SIOCBONDINFOQUERY +#define SIOCBONDINFOQUERY 0x8994 +#endif + +#if !HAVE_SIOCBONDSLAVEINFOQUERY +#define SIOCBONDSLAVEINFOQUERY 0x8993 +#endif + #if !HAVE_DECL_SPEED_10000 #define SPEED_10000 10000 #endif -- 2.39.5