Reviewed: https://review.opendev.org/c/openstack/neutron/+/859143 Committed: https://opendev.org/openstack/neutron/commit/1abb77d7a63cde2aa9640351f663870c14430919 Submitter: "Zuul (22348)" Branch: master
commit 1abb77d7a63cde2aa9640351f663870c14430919 Author: Fernando Royo <[email protected]> Date: Fri Sep 23 20:53:09 2022 +0200 Check subnet overlapping after add router interface When simultaneous attempts are made to add an interface to the same router including overlapping networks in cidrs, both attempts are successful. There is a check to avoid this overlap but is performed when creating the network interface and it is done over the ports already attached to the router, so at this moment the check is not able to detect the overlapping. Furthermore, the create_port operation over the ML2 plugin must be executed in isolated transactions, so trying to control the execution context or adding additional steps to the transaction is not feasible. This patch checks once the RouterPort is created on the neutron database if there is more than one overlapping port, triggering in that case the exception that will remove the the culprit of overlapping. Closes-Bug: #1987666 Change-Id: I7cec8b53e72e7abf34012906e6adfecf079525af ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1987666 Title: Race condition when adding two subnet with same cidr to router Status in neutron: Fix Released Bug description: When two subnets with the same cidr are connected to a router, the second request should fail with an error like this: BadRequest: resources._ipv4_gateway_interface: Bad router request: Cidr 10.100.130.0/24 of subnet 41626435-77b8-4858-9594-a6709e2de5c5 overlaps with cidr 10.100.130.0/24 of subnet cd6566de- add9-4129-9f5e-5b99cc57194c But if those connections are triggered simultaneously, both subnets finally are connected to the router without raising the previous BadRequest. A simple script like this allow to replicate the situation described: echo "create resources" openstack router create r0 openstack network create n0-A openstack subnet create sn0-A --network n0-A --subnet-range 10.100.0.0/24 openstack network create n0-B openstack subnet create sn0-B --network n0-B --subnet-range 10.100.0.0/24 echo "connect subnets to routers" openstack router add subnet r0 sn0-A& openstack router add subnet r0 sn0-B as result: (overcloud) [stack@undercloud-0 ~]$ openstack router show r0 -c interfaces_info -f value; done [{'port_id': '171028ae-3a0d-4690-86fd-09bf3cf9fabe', 'ip_address': '10.100.0.1', 'subnet_id': 'b1f1cfb0-3d8d-41ae-b5e4-4839f4c5d7a4'}, {'port_id': '46596629-a1bc-49d6-903e-45cd27ba6b22', 'ip_address': '10.100.0.1', 'subnet_id': '1f463853-487e-4aeb-b0ec-cd43048bf692'}] To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1987666/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

