vconn: Add assertions to vconn_send() to check consistency of outgoing messages.
authorBen Pfaff <blp@nicira.com>
Mon, 14 Jul 2008 20:53:28 +0000 (13:53 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 18 Jul 2008 21:16:40 +0000 (14:16 -0700)
lib/vconn.c

index f0615d4380688222d737020c84ddd0b9edb70943..db1cc4c526abaf2760a3649d236008de8319cb81 100644 (file)
@@ -292,6 +292,8 @@ vconn_send(struct vconn *vconn, struct buffer *msg)
 {
     int retval = vconn_connect(vconn);
     if (!retval) {
+        assert(msg->size >= sizeof(struct ofp_header));
+        assert(((struct ofp_header *) msg->data)->length == htons(msg->size));
         if (!VLOG_IS_DBG_ENABLED()) { 
             retval = (vconn->class->send)(vconn, msg);
         } else {