From 965b83f9cc287ca36f5a4152c2ac39007c5bc6d8 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Tue, 26 Sep 2006 15:30:43 +0000 Subject: [snmp] Fix asn_build calls to pass correct variable sizes (fixes 64-bit issues) 2006-09-26 Pierre-Yves Ritschard * smux.c: (smux_open,smux_trap,smux_register) Fix various asn_build_* calls to pass the proper length in the final argument: use sizeof() instead of sizeof(), since there were several inconsistencies between the actual variable type and the size that was passed. This should fix some problems on 64-bit architectures where sizeof(int) != sizeof(long). --- lib/smux.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/smux.c') diff --git a/lib/smux.c b/lib/smux.c index c9b7a880..1bec1209 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -963,7 +963,7 @@ smux_open (int sock) version = 0; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &version, sizeof (u_long)); + &version, sizeof (version)); /* SMUX connection oid. */ ptr = asn_build_objid (ptr, &len, @@ -1026,25 +1026,25 @@ smux_trap (oid *name, size_t namelen, ptr = asn_build_string (ptr, &len, (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_IPADDRESS), - (u_char *)&addr, sizeof (struct in_addr)); + (u_char *)&addr, sizeof (addr)); /* Generic trap integer. */ val = SNMP_TRAP_ENTERPRISESPECIFIC; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &val, sizeof (int)); + &val, sizeof (val)); /* Specific trap integer. */ val = sptrap; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &val, sizeof (int)); + &val, sizeof (val)); /* Timeticks timestamp. */ val = 0; ptr = asn_build_unsigned_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_TIMETICKS), - &val, sizeof (int)); + &val, sizeof (val)); /* Variables. */ h1 = ptr; @@ -1148,13 +1148,13 @@ smux_register (int sock) priority = -1; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &priority, sizeof (u_long)); + &priority, sizeof (priority)); /* Operation. */ operation = 2; /* Register R/W */ ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &operation, sizeof (u_long)); + &operation, sizeof (operation)); if (debug_smux) { -- cgit v1.2.3 From eda9ba743c1eb7c32b2ae9b8989d3555f1890758 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Fri, 27 Apr 2007 18:13:15 +0000 Subject: [64-bit] Fix 4 problems with printf formats and 64-bit size_t 2007-04-27 Andrew J. Schorr * lib/smux.c: (smux_trap) Fix printf format to work with 64-bit size_t. * ospf6d/ospf6_snmp.c: (ospfv3AreaEntry, ospfv3AreaLsdbEntry) Fix some zlog_debug printf formats to work with 64-bit size_t. --- lib/smux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/smux.c') diff --git a/lib/smux.c b/lib/smux.c index 1bec1209..8f809c0d 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1091,7 +1091,7 @@ smux_trap (oid *name, size_t namelen, smux_oid_dump ("Trap", iname, inamelen); } smux_oid_dump ("Trap", oid, oid_len); - zlog_info ("BUFSIZ: %d // oid_len: %d", BUFSIZ, oid_len); + zlog_info ("BUFSIZ: %d // oid_len: %lu", BUFSIZ, (u_long)oid_len); } ret = smux_get (oid, &oid_len, 1, &val_type, &val, &val_len); -- cgit v1.2.3 From 6f0e3f6e17687eb25b7b77c4fdc8324837d4700f Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 10 May 2007 02:38:51 +0000 Subject: [autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings 2007-05-09 Paul Jakma * configure.ac: sys/conf.h depends on sys/param.h, at least on FBSD 6.2. (bug #363) Should check for in_pktinfo for IRDP 2006-05-27 Paul Jakma * configure.ac: General cleanup of header and type checks, introducing an internal define, QUAGGA_INCLUDES, to build up a list of stuff to include so as to avoid 'present but cant be compiled' warnings. Misc additional checks of things missing according to autoscan. Add LIBM, for bgpd's use of libm, so as to avoid burdening LIBS, and all the binaries, with libm linkage. Remove the bad practice of using m4 changequote(), just quote the []'s in the case statements properly. This should fix bugs 162, 303 and 178. * */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN, * bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow(). --- lib/smux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/smux.c') diff --git a/lib/smux.c b/lib/smux.c index 8f809c0d..8218c440 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -237,9 +237,9 @@ smux_socket () memset (&serv, 0, sizeof (struct sockaddr_in)); serv.sin_family = AF_INET; -#ifdef HAVE_SIN_LEN +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN serv.sin_len = sizeof (struct sockaddr_in); -#endif /* HAVE_SIN_LEN */ +#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ sp = getservbyname ("smux", "tcp"); if (sp != NULL) -- cgit v1.2.3 From a56ef88348be9f019631d6bc92801aae647be05b Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Mon, 22 Oct 2007 15:53:17 +0000 Subject: [snmp-smux] Fix problems if 'smux peer ...' is issued multiple times 2007-10-22 Lorenzo Colitti * smux.c: (smux_stop) Avoid cancelling a defunct thread pointer (smux_start) Stop smux before trying to start it, possibly again. --- lib/smux.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/smux.c') diff --git a/lib/smux.c b/lib/smux.c index 8218c440..6285c94d 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1228,9 +1228,16 @@ void smux_stop () { if (smux_read_thread) - thread_cancel (smux_read_thread); + { + thread_cancel (smux_read_thread); + smux_read_thread = NULL; + } + if (smux_connect_thread) - thread_cancel (smux_connect_thread); + { + thread_cancel (smux_connect_thread); + smux_connect_thread = NULL; + } if (smux_sock >= 0) { @@ -1534,6 +1541,9 @@ smux_init (struct thread_master *tm) void smux_start(void) { + /* Close any existing connections. */ + smux_stop(); + /* Schedule first connection. */ smux_event (SMUX_SCHEDULE, 0); } -- cgit v1.2.3 From fb62a3cef5960885119f9e87c833520ddf2a9b49 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Tue, 13 May 2008 20:03:32 +0200 Subject: Make --enable-snmp cross compile and make libcrypto optional with --without-crypto Autoconfig work by me, the rest was done by "Kirill K. Smirnov" --- lib/smux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/smux.c') diff --git a/lib/smux.c b/lib/smux.c index 6285c94d..4a3696c7 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -24,10 +24,12 @@ #ifdef HAVE_SNMP #ifdef HAVE_NETSNMP #include -#endif +#include +#else #include #include #include +#endif #include "log.h" #include "thread.h" -- cgit v1.2.3