]> git.puffer.fish Git - mirror/frr.git/commitdiff
[snmp] Fix asn_build calls to pass correct variable sizes (fixes 64-bit issues)
authorAndrew J. Schorr <ajschorr@alumni.princeton.edu>
Tue, 26 Sep 2006 15:30:43 +0000 (15:30 +0000)
committerAndrew J. Schorr <ajschorr@alumni.princeton.edu>
Tue, 26 Sep 2006 15:30:43 +0000 (15:30 +0000)
2006-09-26 Pierre-Yves Ritschard <pierre-yves@spootnik.org>

* smux.c: (smux_open,smux_trap,smux_register) Fix various
  asn_build_* calls to pass the proper length in the final
  argument: use sizeof(<variable>) instead of sizeof(<type>),
  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/ChangeLog
lib/smux.c

index 01f45ba5a3497d78fc95bfc00ace742989944a62..00ba44e0358c83a6f11c279547ded13bb39070df 100644 (file)
@@ -1,3 +1,13 @@
+2006-09-26 Pierre-Yves Ritschard <pierre-yves@spootnik.org>
+
+       * smux.c: (smux_open,smux_trap,smux_register) Fix various
+         asn_build_* calls to pass the proper length in the final
+         argument: use sizeof(<variable>) instead of sizeof(<type>),
+         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).
+
 2006-08-25 Paul Jakma <paul.jakma@sun.com>
 
        * thread.c: (general) Add support for monotonic clock, it may still
index c9b7a8809d7a2e152538d40202453854c581b542..1bec1209b57e2434c2d9a0150cbd8ce0b99ebcf8 100644 (file)
@@ -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)
         {