summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Caputo <ccaputo@alt.net>2008-12-22 09:52:46 +0000
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-06 15:33:13 -0700
commite305f18c5fd971d8ee6ffb19d6eefc620bcf7d31 (patch)
treeea8adf8c3191bf41e0c5f9049920fed9c3fe20f1
parent06252a4d3875bfd2e986ef0da86c4b111e7e2ce2 (diff)
downloadquagga-e305f18c5fd971d8ee6ffb19d6eefc620bcf7d31.tar.bz2
quagga-e305f18c5fd971d8ee6ffb19d6eefc620bcf7d31.tar.xz
64-bit fix for lib/smux.h SNMP_INTEGER() macro
Macro SNMP_INTEGER() prepares data which is eventually processed by asn_build_int(). SNMP_INTEGER() was using "int32_t" whereas asn_build_int() uses "long". On 32-bit systems these are the same, both 4 bytes, but on x86 64-bit systems "long" is 8 bytes. asn_build_int()'s reaction to an improperly sized value is to return a NULL pointer. Quagga's smux.c would eventually get this NULL pointer and use it in calculations to determine how much data to send over the smux connection, resulting in garbage being sent to the SNMP agent. Corrected SNMP_INTEGER() to use "long". Tested on 32-bit and 64-bit x86 Linux 2.6.27.10 systems running Quagga 0.99.11 with bgpd smux.
-rw-r--r--lib/smux.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/smux.h b/lib/smux.h
index 11f02e9e..87a76648 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -127,12 +127,12 @@ struct trap_object
/* Declare SMUX return value. */
#define SNMP_LOCAL_VARIABLES \
- static int32_t snmp_int_val; \
+ static long snmp_int_val; \
static struct in_addr snmp_in_addr_val;
#define SNMP_INTEGER(V) \
( \
- *var_len = sizeof (int32_t), \
+ *var_len = sizeof (snmp_int_val), \
snmp_int_val = V, \
(u_char *) &snmp_int_val \
)