Magnus Fromreide wrote:
On Thu, Mar 26, 2009 at 11:10:24AM +0900, Mitsuru Chinen wrote:
Hi Thomas,

What kind of Linux distribution are you using?

I supppose he is using a linux distribution with a libc version lower than
2.4 - at a guess RHEL4 is one of those.

For glibc 2.4 MLD_LISTENER_QUERY changed name from ICMP6_MEMBERSHIP_QUERY.
For glibc 2.0.99 ICMP6_MEMBERSHIP_QUERY changed name from ICMPV6_MGM_QUERY.
ICMPV6_MGM_QUERY was never in any released glibc.

I think you need a configure check to verify that MLD_LISTENER_QUERY exists.

I am not good at autoconf, could you please check attached patch? After 'autoheader && autoconf' it creates expected result and it's compilable on RHEL4 and current Fedora. I am not if config_os_misc4 is the right file to modify.

Maybe plain #ifdef checks in icmp.c would be more readable, the MLD_ macros are used only there...

Jan
commit 9d7948a7a6bf9fe3e1c3b92547064a985a4ab1a0
Author: Jan Safranek <[email protected]>
Date:   Mon Mar 30 11:57:38 2009 +0200

    Add configure checks for MLD_ style ICMPv6 message type definitions. Fall
    back to ICMP6_ definitions and redefine them to MLD_, if they are
    available.

diff --git a/net-snmp/agent/mibgroup/mibII/icmp.c 
b/net-snmp/agent/mibgroup/mibII/icmp.c
index 10ae07e..386a697 100644
--- a/net-snmp/agent/mibgroup/mibII/icmp.c
+++ b/net-snmp/agent/mibgroup/mibII/icmp.c
@@ -307,6 +307,7 @@ icmp_msg_stats_load(netsnmp_cache *cache, void *vmagic)
         icmp_msg_stats_table[i].icmpMsgStatsOutPkts = 
v6icmp.icmp6OutEchoReplies;
         i++;
 
+#ifdef HAVE_MLD_ICMP6
         icmp_msg_stats_table[i].icmpMsgStatsType = MLD_LISTENER_QUERY;
         icmp_msg_stats_table[i].icmpMsgStatsInPkts = 
v6icmp.icmp6InGroupMembQueries;
         icmp_msg_stats_table[i].icmpMsgStatsOutPkts = 0;
@@ -321,6 +322,7 @@ icmp_msg_stats_load(netsnmp_cache *cache, void *vmagic)
         icmp_msg_stats_table[i].icmpMsgStatsInPkts = 
v6icmp.icmp6InGroupMembReductions;
         icmp_msg_stats_table[i].icmpMsgStatsOutPkts = 
v6icmp.icmp6OutGroupMembReductions;
         i++;
+#endif
 
         icmp_msg_stats_table[i].icmpMsgStatsType = ND_ROUTER_SOLICIT;
         icmp_msg_stats_table[i].icmpMsgStatsInPkts = 
v6icmp.icmp6InRouterSolicits;
diff --git a/net-snmp/configure.d/config_os_misc4 
b/net-snmp/configure.d/config_os_misc4
index 8b00c02..0725731 100644
--- a/net-snmp/configure.d/config_os_misc4
+++ b/net-snmp/configure.d/config_os_misc4
@@ -284,3 +284,23 @@ And this can be very slow.])
     fi         # "test $ac_inet_ip_h = yes"
     ;;
 esac
+
+
+#
+# Check icmp6 message type definitons on Linux/glibc
+#
+AC_CHECK_DECL([MLD_LISTENER_QUERY],
+        [AC_DEFINE(HAVE_MLD_ICMP6, [1], [Define to 1 if you have glibc >= 2.4 
with MLD_ constants for ICMPv6 message types.])],
+        [AC_CHECK_DECL([ICMP6_MEMBERSHIP_QUERY],
+                [AC_DEFINE(HAVE_OLD_ICMP6, [1], [Define to 1 if you have glibc 
< 2.4 with ICMP6_ constants for ICMPv6 message types.])],
+                [],
+                [[#include </usr/include/netinet/icmp6.h>]])],
+        [[#include </usr/include/netinet/icmp6.h>]])
+
+AH_BOTTOM([#ifdef HAVE_OLD_ICMP6
+#define MLD_LISTENER_QUERY ICMP6_MEMBERSHIP_QUERY
+#define MLD_LISTENER_REPORT ICMP6_MEMBERSHIP_REPORT
+#define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
+#define HAVE_MLD_ICMP6 1
+#endif
+])
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to