ovs-ofctl: Avoid segfault upon receive error for "monitor", "snoop".
authorBen Pfaff <blp@nicira.com>
Wed, 7 Mar 2012 21:52:55 +0000 (13:52 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 7 Mar 2012 21:59:01 +0000 (13:59 -0800)
Bug #10062.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
utilities/ovs-ofctl.c

index fd0829eaa42922b098a2b41f690d380d011a8293..607ec256a6d509365cd429fa0a057ad74bacd035 100644 (file)
@@ -1004,9 +1004,8 @@ monitor_vconn(struct vconn *vconn)
             if (retval == EAGAIN) {
                 break;
             }
-            msg_type = ((const struct ofp_header *) b->data)->type;
-
             run(retval, "vconn_recv");
+
             if (timestamp) {
                 time_t now = time_wall();
                 char s[32];
@@ -1014,6 +1013,8 @@ monitor_vconn(struct vconn *vconn)
                 strftime(s, sizeof s, "%Y-%m-%d %H:%M:%S: ", localtime(&now));
                 fputs(s, stderr);
             }
+
+            msg_type = ((const struct ofp_header *) b->data)->type;
             ofp_print(stderr, b->data, b->size, verbosity + 2);
             ofpbuf_delete(b);