This brings it on par with how we advertise NAT/LB host routes, so I'm
+1. AFAIK, the missing prefix in host routes does not cause any
problems.

Acked-by: Martin Kalcok <martin.kal...@canonical.com>

On Tue, 2025-02-25 at 00:01 +0100, Dumitru Ceara wrote:
> It's anyway /32 (or /128 for IPv6) by default.
> 
> Fixes: 93f541f342f9 ("northd: Allow announcing individual host
> routes.")
> Signed-off-by: Dumitru Ceara <dce...@redhat.com>
> ---
>  northd/en-advertised-route-sync.c |  6 ++----
>  tests/ovn-northd.at               | 10 +++++-----
>  2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/northd/en-advertised-route-sync.c b/northd/en-
> advertised-route-sync.c
> index 7ad06b70c8..e4d24b5173 100644
> --- a/northd/en-advertised-route-sync.c
> +++ b/northd/en-advertised-route-sync.c
> @@ -310,18 +310,16 @@ publish_lport_addresses(struct hmap
> *sync_routes,
>  {
>      for (size_t i = 0; i < addresses->n_ipv4_addrs; i++) {
>          const struct ipv4_netaddr *addr = &addresses->ipv4_addrs[i];
> -        char *addr_s = xasprintf("%s/32", addr->addr_s);
>          ar_add_entry(sync_routes, sb_db, logical_port->sb,
> -                       addr_s, tracking_port->sb);
> +                     xstrdup(addr->addr_s), tracking_port->sb);
>      }
>      for (size_t i = 0; i < addresses->n_ipv6_addrs; i++) {
>          if (in6_is_lla(&addresses->ipv6_addrs[i].network)) {
>              continue;
>          }
>          const struct ipv6_netaddr *addr = &addresses->ipv6_addrs[i];
> -        char *addr_s = xasprintf("%s/128", addr->addr_s);
>          ar_add_entry(sync_routes, sb_db, logical_port->sb,
> -                       addr_s, tracking_port->sb);
> +                     xstrdup(addr->addr_s), tracking_port->sb);
>      }
>  }
>  
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index c74d57f7eb..bee6ed7b14 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -15450,7 +15450,7 @@ datapath=$(fetch_column datapath_binding
> _uuid external_ids:name=lr0)
>  check ovn-nbctl --wait=sb set Logical_Router_Port lr0-sw0 \
>      options:dynamic-routing-redistribute="connected-as-host,static"
>  check_row_count Advertised_Route 2
> -check_column 10.0.0.1/32 Advertised_Route ip_prefix \
> +check_column 10.0.0.1 Advertised_Route ip_prefix \
>      datapath=$datapath logical_port=$sw0
>  check_column $sw0 Advertised_Route tracked_port \
>      datapath=$datapath logical_port=$sw0
> @@ -15463,7 +15463,7 @@ vif0=$(fetch_column port_binding _uuid
> logical_port=sw0-vif0)
>  check_row_count Advertised_Route 3
>  check_row_count Advertised_Route 2 tracked_port!='[[]]'
>  check_column $vif0 Advertised_Route tracked_port \
> -    datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.2/32
> +    datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.2
>  
>  # Adding a LR lr1 to the LS sw0 will advertise the LRP of the new
> router.
>  check ovn-nbctl lr-add lr1
> @@ -15475,14 +15475,14 @@ check ovn-nbctl --wait=sb set
> Logical_Switch_Port sw0-lr1 \
>  check_row_count Advertised_Route 4
>  check_row_count Advertised_Route 3 tracked_port!='[[]]'
>  check_column $lr1 Advertised_Route tracked_port \
> -    datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.10/32
> +    datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.10
>  
>  # Adding a NAT rule to lr1 will advertise it as well.
>  check ovn-nbctl --wait=sb lr-nat-add lr1 dnat_and_snat 10.0.0.100
> 192.168.0.1
>  check_row_count Advertised_Route 5
>  check_row_count Advertised_Route 4 tracked_port!='[[]]'
>  check_column $lr1 Advertised_Route tracked_port \
> -    datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.100/32
> +    datapath=$datapath logical_port=$sw0 ip_prefix=10.0.0.100
>  
>  # Adding a static route to lr1 will be advertised just normally.
>  check ovn-nbctl --wait=sb lr-route-add lr0 172.16.0.0/24 10.0.0.200
> @@ -15505,7 +15505,7 @@ check ovn-nbctl --wait=sb lr-nat-add lr2
> dnat_and_snat 10.10.0.20 10.20.0.123
>  check_row_count Advertised_Route 8
>  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/32 tracked_port=$lr2lr0
> +    ip_prefix=10.10.0.20 tracked_port=$lr2lr0
>  
>  AT_CLEANUP
>  ])

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to