[ovs-dev] [PATCH 1/3] ovs-dpctl: In "dump-flows", only print flows that can be retrieved.

Ben Pfaff blp at nicira.com
Tue Apr 13 23:50:46 UTC 2010


If dpif_flow_get() returns an error then we'd better not try to print
the flow (especially not the actions since check_rw_odp_flow() clears
the first action to 0xcc).
---
 utilities/ovs-dpctl.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index eb78a57..ecfb306 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -473,11 +473,11 @@ do_dump_flows(int argc OVS_UNUSED, char *argv[])
 
         f->actions = actions;
         f->n_actions = MAX_ACTIONS;
-        dpif_flow_get(dpif, f);
-
-        ds_clear(&ds);
-        format_odp_flow(&ds, f);
-        printf("%s\n", ds_cstr(&ds));
+        if (!dpif_flow_get(dpif, f)) {
+            ds_clear(&ds);
+            format_odp_flow(&ds, f);
+            printf("%s\n", ds_cstr(&ds));
+        }
     }
     ds_destroy(&ds);
     dpif_close(dpif);
-- 
1.6.6.1





More information about the dev mailing list