tunnel: Fix bug where misconfiguration persists.
authorJoe Stringer <joestringer@nicira.com>
Sun, 4 May 2014 22:14:18 +0000 (10:14 +1200)
committerJoe Stringer <joestringer@nicira.com>
Wed, 7 May 2014 21:47:19 +0000 (09:47 +1200)
commit0fe1d7f39de9836fea01c560a6fdbfd1405096ea
tree250eaf1a4962968fcbe8252a9243a706684a7bdf
parent1fd335f3eb2dd6542a0e776df5fd4f8ea61297d2
tunnel: Fix bug where misconfiguration persists.

Previously, misconfiguring a tunnel port to use the exact same settings
would cause the corresponding netdev to never be destroyed. When
attempting to re-use the port as a different type, this would fail and
result in a discrepancy between reported port type and actual netdev in
use.

An example configuration that would previously give unexpected behaviour:

ovs-vsctl add-port br0 p0 -- set int p0 type=gre options:remote_ip=1.2.3.4
ovs-vsctl add-port br0 p1 -- set int p1 type=internal
ovs-vsctl set int p1 type=gre options:remote_ip=1.2.3.4
ovs-vsctl set int p1 type=internal

The final command would report in the ovs-vswitchd logs that it is
attempting to configure the port with the same gre settings as p0,
despite the command specifying the type as internal. Even after
deleting and re-adding the port, the message would reappear.

This patch fixes the bug by dereferencing the netdev in the failure
case of tnl_port_add__(), and ensures that the tnl_port structure is
freed in that case as well.

Bug #1198386.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ryan Wilson <wryan@vmware.com>
Acked-by: Alex Wang <alexw@nicira.com>
ofproto/tunnel.c