]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Try to be compatible with older versions of NetSNMP
authorVincent Bernat <vbernat@wanadooportails.com>
Mon, 17 Nov 2008 08:52:31 +0000 (09:52 +0100)
committerVincent Bernat <vbernat@wanadooportails.com>
Mon, 17 Nov 2008 09:16:20 +0000 (10:16 +0100)
configure.ac
src/agent_priv.c

index b9dd1a49ee7896f6a9e2184ca4d24d934d4c7289..62e3df4d4ea99f8ca4132e3b85febda3e098d71c 100644 (file)
@@ -47,6 +47,12 @@ AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[#include <net/ethernet.h>]])
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_CHECK_TYPES([int16_t, u_int16_t, int8_t, u_int8_t, int32_t, u_int32_t],[],[AC_MSG_ERROR([mandatory type not found])])
+AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,
+       [
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/library/snmp_transport.h>
+])
 
 # Checks for library functions.
 AC_REPLACE_FUNCS([strlcpy])
index 90140b9b07ac1db098829a719da49bdbfb5a8be3..caf7cea6b84ebb0a5928bfcdc55f4919a11d0172 100644 (file)
@@ -170,14 +170,20 @@ agent_priv_unix_transport(const char *string, int len, int local)
 }
 
 netsnmp_transport *
-agent_priv_unix_create_tstring(const char *string, int local,
-    const char *default_target)
+#if !HAVE_NETSNMP_TDOMAIN_F_CREATE_FROM_TSTRING_NEW
+agent_priv_unix_create_tstring(const char *string, int local)
+#else
+agent_priv_unix_create_tstring(const char *string, int local, char *default_target)
+#endif
 {
+#if HAVE_NETSNMP_TDOMAIN_F_CREATE_FROM_TSTRING_NEW
        if ((!string || *string == '\0') && default_target &&
            *default_target != '\0') {
                string = default_target;
        }
-
+#endif
+       if (!string)
+               return NULL;
        return agent_priv_unix_transport(string, strlen(string), local);
 }
 
@@ -194,7 +200,11 @@ agent_priv_register_domain()
        unixDomain.name_length = sizeof(netsnmp_UnixDomain) / sizeof(oid);
        unixDomain.prefix = (const char**)calloc(2, sizeof(char *));
        unixDomain.prefix[0] = "unix";
+#if !HAVE_NETSNMP_TDOMAIN_F_CREATE_FROM_TSTRING_NEW
+       unixDomain.f_create_from_tstring = agent_priv_unix_create_tstring;
+#else
        unixDomain.f_create_from_tstring_new = agent_priv_unix_create_tstring;
+#endif
        unixDomain.f_create_from_ostring = agent_priv_unix_create_ostring;
        netsnmp_tdomain_register(&unixDomain);
 }