Skip to content

Commit

Permalink
ovs-vsctl: Fix segfault when attempting to del-port from parent bridge.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
flavio-fernandes authored and blp committed May 7, 2018
1 parent b2dd816 commit 09f37a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tests/ovs-vsctl.at
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,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])
Expand Down
4 changes: 2 additions & 2 deletions utilities/ovs-vsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,9 +1748,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]);
Expand Down

0 comments on commit 09f37a1

Please sign in to comment.