]> git.proxmox.com Git - mirror_ovs.git/commit - lib/dpctl.c
netdev, dpif: fix the crash/assert on port delete
authorAshish Varma <ashishvarma.ovs@gmail.com>
Mon, 6 Nov 2017 20:17:45 +0000 (12:17 -0800)
committerBen Pfaff <blp@ovn.org>
Mon, 13 Nov 2017 19:05:31 +0000 (11:05 -0800)
commit97459c2f011341d6f8376b84af52dd34fed629ba
tree1595c02c653b027a659d163c11c1a38d7f6e2085
parentb4027b17e890915472d568619ea9f3ae675d4ac8
netdev, dpif: fix the crash/assert on port delete

a crash is seen in "netdev_ports_remove" when an interface is deleted and added
back in the system and when the interface is part of a bridge configuration.
e.g. steps:
  create a tap0 interface using "ip tuntap add.."
  add the tap0 interface to br0 using "ovs-vsctl add-port.."
  delete the tap0 interface from system using "ip tuntap del.."
  add the tap0 interface back in system using "ip tuntap add.."
                       (this changes the ifindex of the interface)
  delete tap0 from br0 using "ovs-vsctl del-port.."

In the function "netdev_ports_insert", two hmap entries were created for
mapping "portnum -> netdev" and "ifindex -> portnum".
When the interface is deleted from the system, the "netdev_ports_remove"
function is not getting called and the old ifindex entry is not getting
cleaned up from the "ifindex_to_port" hmap.

As part of the fix, added function "dpif_port_remove" which will call
"netdev_ports_remove" in the path where the interface deletion from the system
is detected.
Also, in "netdev_ports_remove", added the code where the "ifindex_to_port_data"
(ifindex -> portnum map node) is getting freed when the ifindex is not
available any more. (as the interface is already deleted.)

VMware-BZ: #1975788
Signed-off-by: Ashish Varma <ashishvarma.ovs@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
AUTHORS.rst
lib/dpctl.c
lib/dpif.c
lib/dpif.h
lib/netdev.c
ofproto/ofproto-dpif.c