Skip to content

Commit

Permalink
en-advertised-route-sync: Don't assume that switch peers are routers.
Browse files Browse the repository at this point in the history
A peer of a switch can be another switch, so the port type has to be
checked.  The missing check doesn't seem to lead to crashes, but it
leads to addresses of switch-switch ports not being advertised.

Fix that by checking the port type instead of assuming.

The issue is a result of two features being developed at the same time
and the code not being re-checked before merging the routing patches.

Fixes: 93f541f ("northd: Allow announcing individual host routes.")
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
igsilya committed Feb 26, 2025
1 parent fe26d5b commit 02dbce8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion northd/en-advertised-route-sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ publish_host_routes(struct hmap *sync_routes,

struct ovn_port *port;
HMAP_FOR_EACH (port, dp_node, &peer_od->ports) {
if (port->peer) {
if (port->peer && port->peer->nbrp) {
/* This is a LSP connected to an LRP */
publish_host_routes_lrp(sync_routes, lr_stateful_table, route,
data, port->peer);
Expand Down
15 changes: 15 additions & 0 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -15507,6 +15507,21 @@ check_row_count Advertised_Route 6 tracked_port!='[[]]'
check_row_count Advertised_Route 1 datapath=$datapath logical_port=$lr0lr2 \
ip_prefix=10.10.0.20 tracked_port=$lr2lr0

# Add a directly connected switch and make sure that northd is not confused.
# The IP on a switch-switch port should be advertised.
check ovn-nbctl ls-add sw1
check ovn-nbctl lsp-add sw0 sw0-sw1
check ovn-nbctl lsp-add sw1 sw1-sw0
check ovn-nbctl lsp-set-type sw0-sw1 switch peer=sw1-sw0 -- \
lsp-set-type sw1-sw0 switch peer=sw0-sw1
check ovn-nbctl --wait=sb lsp-set-addresses sw0-sw1 \
"11:aa:bb:cc:dd:ee 10.0.0.42"
sw0sw1=$(fetch_column port_binding _uuid logical_port=sw0-sw1)
check_row_count Advertised_Route 9
check_row_count Advertised_Route 7 tracked_port!='[[]]'
check_column $sw0sw1 Advertised_Route tracked_port \
datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.42/32

AT_CLEANUP
])

Expand Down

0 comments on commit 02dbce8

Please sign in to comment.