On Wed, Jun 08, 2011 at 01:05:45PM -0700, Jesse Gross wrote:
> On Mon, Jun 6, 2011 at 12:41 PM, Ben Pfaff <b...@nicira.com> wrote:
> > ovs-vsctl is carefully written to avoid races in database access. ??It is
> > much simpler to just call it than to reimplement its capabilities.
> >
> > This eliminates the requirement that bridges managed by ovs-brcompatd have
> > no ports at ovs-brcompatd startup time. ??It also eliminates races between
> > competing brctl and ovs-vsctl processes.
> 
> There are some new warnings after this patch (that look real):
> vswitchd/ovs-brcompatd.c:522: warning: 'br_vlan' is used uninitialized
> in this function
> vswitchd/ovs-brcompatd.c:522: warning: 'br_vlan' is used uninitialized
> in this function

You're right.  How's this look?  Does it fix the warning for you?  (My
GCC doesn't warn either way.)

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <b...@nicira.com>
Date: Wed, 8 Jun 2011 13:47:08 -0700
Subject: [PATCH] ovs-brcompatd: Fix uninitialized br_vlan variable in
 handle_fdb_query_cmd().

Reported-by: Jesse Gross <je...@nicira.com>
---
 vswitchd/ovs-brcompatd.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c
index 4f35452..3dd25c3 100644
--- a/vswitchd/ovs-brcompatd.c
+++ b/vswitchd/ovs-brcompatd.c
@@ -363,25 +363,29 @@ handle_port_cmd(struct ofpbuf *buffer, bool add)
 }
 
 static char *
-linux_bridge_to_ovs_bridge(const char *linux_name)
+linux_bridge_to_ovs_bridge(const char *linux_name, int *br_vlanp)
 {
     char *save_ptr = NULL;
-    const char *br_name;
+    const char *br_name, *br_vlan;
     char *br_name_copy;
     char *output;
 
-    output = capture_vsctl(vsctl_program, VSCTL_OPTIONS, "br-to-parent",
-                           linux_name, (char *) NULL);
+    output = capture_vsctl(vsctl_program, VSCTL_OPTIONS,
+                           "--", "br-to-parent", linux_name,
+                           "--", "br-to-vlan", linux_name,
+                           (char *) NULL);
     if (!output) {
         return NULL;
     }
 
     br_name = strtok_r(output, " \t\r\n", &save_ptr);
-    if (!br_name) {
+    br_vlan = strtok_r(NULL, " \t\r\n", &save_ptr);
+    if (!br_name || !br_vlan) {
         free(output);
         return NULL;
     }
     br_name_copy = xstrdup(br_name);
+    *br_vlanp = atoi(br_vlan);
 
     free(output);
 
@@ -458,7 +462,7 @@ handle_fdb_query_cmd(struct ofpbuf *buffer)
     }
 
     /* Figure out vswitchd bridge and VLAN. */
-    br_name = linux_bridge_to_ovs_bridge(linux_name);
+    br_name = linux_bridge_to_ovs_bridge(linux_name, &br_vlan);
     if (!br_name) {
         error = EINVAL;
         send_simple_reply(seq, error);
-- 
1.7.4.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to