[quagga-dev 4382] Re: bgpd printf size_t warning

Andrew J. Schorr aschorr at telemetry-investments.com
Fri Sep 22 20:53:30 BST 2006


On Wed, Sep 20, 2006 at 11:07:27AM -0400, Greg Troxel wrote:
> So the question is really what features platforms we want quagga to
> work on have.  It would seem goofy for Solaris 9 not to support
> virtually all of C99, but there's no "Solaris (or anything else) is
> never goofy" axiom....
> 
> I'm ambivalent here; the cast to unsigned long isn't bothersome.

I see that you updated INSTALL.quagga.txt to indicate that C99
header files and libraries are required.  This seems to invalidate
Solaris 9, if I read that man page correctly.

In any case, I've had this patch queued up for a while.  Is the
feeling that I should change it to use %zu instead of casting the
size_t's to u_long?

Regards,
Andy
-------------- next part --------------
Index: ospf_packet.c
===================================================================
RCS file: /var/cvsroot/quagga/ospfd/ospf_packet.c,v
retrieving revision 1.93
diff -b -u -p -r1.93 ospf_packet.c
--- ospf_packet.c	30 Aug 2006 18:47:37 -0000	1.93
+++ ospf_packet.c	22 Sep 2006 19:52:42 -0000
@@ -216,8 +216,8 @@ ospf_packet_dup (struct ospf_packet *op)
   struct ospf_packet *new;
 
   if (stream_get_endp(op->s) != op->length)
-    zlog_warn ("ospf_packet_dup stream %ld ospf_packet %d size mismatch",
-	       STREAM_SIZE(op->s), op->length);
+    zlog_warn ("ospf_packet_dup stream %lu ospf_packet %d size mismatch",
+	       (u_long)STREAM_SIZE(op->s), op->length);
 
   /* Reserve space for MD5 authentication that may be added later. */
   new = ospf_packet_new (stream_get_endp(op->s) + OSPF_AUTH_MD5_SIZE);
@@ -371,7 +371,8 @@ ospf_make_md5_digest (struct ospf_interf
   op->length = ntohs (ospfh->length) + OSPF_AUTH_MD5_SIZE;
 
   if (stream_get_endp(op->s) != op->length)
-    zlog_warn("ospf_make_md5_digest: length mismatch stream %ld ospf_packet %d", stream_get_endp(op->s), op->length);
+    zlog_warn("ospf_make_md5_digest: length mismatch stream %lu ospf_packet %d",
+	      (u_long)stream_get_endp(op->s), op->length);
 
   return OSPF_AUTH_MD5_SIZE;
 }
@@ -796,8 +797,11 @@ ospf_hello (struct ip *iph, struct ospf_
   /* Compare Router Dead Interval. */
   if (OSPF_IF_PARAM (oi, v_wait) != ntohl (hello->dead_interval))
     {
-      zlog_warn ("Packet %s [Hello:RECV]: RouterDeadInterval mismatch.",
-		 inet_ntoa (ospfh->router_id));
+      zlog_warn ("Packet %s [Hello:RECV]: RouterDeadInterval mismatch "
+      		 "(expected %lu, but received %lu).",
+		 inet_ntoa(ospfh->router_id),
+		 (u_long)OSPF_IF_PARAM(oi, v_wait),
+		 (u_long)ntohl(hello->dead_interval));
       return;
     }
 
@@ -806,8 +810,11 @@ ospf_hello (struct ip *iph, struct ospf_
     {
       if (OSPF_IF_PARAM (oi, v_hello) != ntohs (hello->hello_interval))
         {
-          zlog_warn ("Packet %s [Hello:RECV]: HelloInterval mismatch.",
-                     inet_ntoa (ospfh->router_id));
+          zlog_warn ("Packet %s [Hello:RECV]: HelloInterval mismatch "
+		     "(expected %lu, but received %lu).",
+		     inet_ntoa(ospfh->router_id),
+		     (u_long)OSPF_IF_PARAM(oi, v_hello),
+		     (u_long)ntohs(hello->hello_interval));
           return;
         }
     }


More information about the Quagga-dev mailing list