Skip to content

Commit

Permalink
OVN: Add port addresses to IPAM after all ports are joined.
Browse files Browse the repository at this point in the history
Joining ports involves setting the peer field on ovn_ports. If a switch
port is visited, and it is connected to a router port, then the switch
port's peer is set to the router port and the router port's peer is set
to the switch port.

A router port's addresses are added to IPAM if it is peered with a
switch that has dynamic addressing enabled.

When visiting ports, if a router port is visited before its connected
switch port, then the router port's peer is not set yet. Therefore the
router's port addresses cannot be added to IPAM. The result is that
duplicate addresses can be assigned by a logical switch.

The fix for this is to wait until all ports have been joined and then
add port addresses to IPAM. This way, we guarantee that all peer
assignments have been set, and no duplicate IP addresses may be assigned
by a switch.

Reported-by: James Page <[email protected]>
Signed-off-by: Mark Michelson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
putnopvut authored and blp committed Mar 6, 2019
1 parent c225ce2 commit addc795
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,12 @@ join_logical_ports(struct northd_context *ctx,
}
}
}
}

/* Wait until all ports have been connected to add to IPAM since
* it relies on proper peers to be set
*/
HMAP_FOR_EACH (op, key_node, ports) {
ipam_add_port_addresses(op->od, op);
}
}
Expand Down

0 comments on commit addc795

Please sign in to comment.