From: Flavio Fernandes Date: Tue, 1 May 2018 23:07:36 +0000 (-0400) Subject: ovs-vsctl: Fix segfault when attempting to del-port from parent bridge. X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=2f4763dc4bce575b186126bac497c183a35535fd;p=ovs.git ovs-vsctl: Fix segfault when attempting to del-port from parent bridge. The error message in the check for improper bridge param is de-referencing parent from the wrong bridge. Also, the message itself had the parent and child bridges reversed, so that got a small tweak as well. Also, add a regression test. Signed-off-by: Flavio Fernandes Signed-off-by: Ben Pfaff --- diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index d54188976..06cdaa8de 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -565,6 +565,23 @@ CHECK_PORTS([xapi1], [eth0.$1]) CHECK_IFACES([xapi1], [eth0.$1]) OVS_VSCTL_CLEANUP AT_CLEANUP + +AT_SETUP([simple fake bridge + del-port from parent (VLAN $1)]) +AT_KEYWORDS([ovs-vsctl fake-bridge del-port]) +OVS_VSCTL_SETUP +OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1]) +AT_CHECK([RUN_OVS_VSCTL([del-port xenbr0 eth0.$1])], [1], [], + [ovs-vsctl: bridge xenbr0 does not have a port eth0.$1 (although its child bridge xapi1 does) +]) +CHECK_PORTS([xenbr0], [eth0]) +CHECK_IFACES([xenbr0], [eth0]) +CHECK_PORTS([xapi1], [eth0.$1]) +CHECK_IFACES([xapi1], [eth0.$1]) +AT_CHECK([RUN_OVS_VSCTL([del-port xapi1 eth0.$1])]) +CHECK_PORTS([xenbr0], [eth0]) +CHECK_IFACES([xenbr0], [eth0]) +OVS_VSCTL_CLEANUP +AT_CLEANUP ]) # OVS_VSCTL_FAKE_BRIDGE_TESTS OVS_VSCTL_FAKE_BRIDGE_TESTS([9]) diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index c347a3b60..a5a23db83 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -1677,9 +1677,9 @@ cmd_del_port(struct ctl_context *ctx) if (port->bridge != bridge) { if (port->bridge->parent == bridge) { ctl_fatal("bridge %s does not have a port %s (although " - "its parent bridge %s does)", + "its child bridge %s does)", ctx->argv[1], ctx->argv[2], - bridge->parent->name); + port->bridge->name); } else { ctl_fatal("bridge %s does not have a port %s", ctx->argv[1], ctx->argv[2]);