If tnl_port_should_receive() is false, we're looking for a normal
port, not a tunnel one.  And it's better to print recirculation IDs
in hex since they are typically printed this way in flow dumps.

Fixes: d40533fc820c ("odp-util: Improve log messages and error reporting for 
Netlink parsing.")
Signed-off-by: Ilya Maximets <[email protected]>
---
 ofproto/ofproto-dpif-xlate.c |  4 ++--
 tests/ofproto-dpif.at        | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index fda802e83..5c3021765 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -1515,7 +1515,7 @@ xlate_lookup_ofproto_(const struct dpif_backer *backer,
         if (OVS_UNLIKELY(!recirc_id_node)) {
             if (errorp) {
                 *errorp = xasprintf("no recirculation data for recirc_id "
-                                    "%"PRIu32, flow->recirc_id);
+                                    "%#"PRIx32, flow->recirc_id);
             }
             return NULL;
         }
@@ -1556,7 +1556,7 @@ xlate_lookup_ofproto_(const struct dpif_backer *backer,
         if (errorp) {
             *errorp = (tnl_port_should_receive(flow)
                        ? xstrdup("no OpenFlow tunnel port for this packet")
-                       : xasprintf("no OpenFlow tunnel port for datapath "
+                       : xasprintf("no OpenFlow port for datapath "
                                    "port %"PRIu32, flow->in_port.odp_port));
         }
         return NULL;
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 2e91ae1a1..f32a16981 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -6393,6 +6393,20 @@ AT_CHECK([tail -2 stderr], [0], [dnl
 ovs-appctl: ovs-vswitchd: server returned an error
 ])
 
+# Test incorrect command: ofproto/trace with nonexistent port number
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "in_port(42)" ], [2], [stdout], 
[stderr])
+AT_CHECK([tail -2 stderr], [0], [dnl
+no OpenFlow port for datapath port 42
+ovs-appctl: ovs-vswitchd: server returned an error
+])
+
+# Test incorrect command: ofproto/trace with nonexistent recirc_id
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "recirc_id(0x42)" ], [2], 
[stdout], [stderr])
+AT_CHECK([tail -2 stderr], [0], [dnl
+no recirculation data for recirc_id 0x42
+ovs-appctl: ovs-vswitchd: server returned an error
+])
+
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
-- 
2.34.3

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to