[ovs-dev] [PATCH 1/2] dpif-linux: Fix the return type of dpif_linux_port_dump_next__().

Alex Wang alexw at nicira.com
Tue Dec 17 22:37:09 UTC 2013


Commit 222837 (dpif-linux: Factor out port dumping helper functions.)
introduced a bug by making dpif_linux_port_dump_next__() return 'bool'
instead of 'int' as defined in dpif-provider.h.  This bug causes ovs-
vswitchd failure with SEGFAULT when processing slow-path packet.

This commit fixes the bug by following the dpif-provider specification.

Signed-off-by: Alex Wang <alexw at nicira.com>
---
 lib/dpif-linux.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index d75bc95..52c3f65 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -739,7 +739,7 @@ dpif_linux_port_dump_start(const struct dpif *dpif, void **statep)
     return 0;
 }
 
-static bool
+static int
 dpif_linux_port_dump_next__(const struct dpif *dpif_, struct nl_dump *dump,
                             struct dpif_linux_vport *vport)
 {
@@ -1300,7 +1300,7 @@ dpif_linux_refresh_channels(struct dpif *dpif_)
     dpif->n_events = dpif->event_offset = 0;
 
     dpif_linux_port_dump_start__(dpif_, &dump);
-    while (dpif_linux_port_dump_next__(dpif_, &dump, &vport)) {
+    while (!dpif_linux_port_dump_next__(dpif_, &dump, &vport)) {
         uint32_t port_no = odp_to_u32(vport.port_no);
         struct nl_sock *sock = (port_no < dpif->uc_array_size
                                 ? dpif->channels[port_no].sock
-- 
1.7.9.5




More information about the dev mailing list