diff mbox series

[ovs-dev,v2,12/32] northd: Add filtering which routes to advertise.

Message ID 38bc91302837ed382ee20d1aef259d7d52f23db5.1730713432.git.felix.huettner@stackit.cloud
State Superseded
Headers show
Series OVN Fabric integration | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success

Commit Message

Felix Huettner Nov. 4, 2024, 11:04 a.m. UTC
previously all routes of a logical router where announced. However in
some cases it makes more sense to only announce static or connected
routes. Therefor we add options to LR and LRP to define which routes to
advertise.

Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
---
 northd/en-routes-sync.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Lorenzo Bianconi Nov. 14, 2024, 10:57 a.m. UTC | #1
> previously all routes of a logical router where announced. However in
> some cases it makes more sense to only announce static or connected
> routes. Therefor we add options to LR and LRP to define which routes to
> advertise.
> 
> Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
> ---
>  northd/en-routes-sync.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/northd/en-routes-sync.c b/northd/en-routes-sync.c
> index bb61e0d51..581f21b8e 100644
> --- a/northd/en-routes-sync.c
> +++ b/northd/en-routes-sync.c
> @@ -15,6 +15,7 @@
>  #include <config.h>
>  
>  #include "openvswitch/vlog.h"
> +#include "smap.h"
>  #include "stopwatch.h"
>  #include "northd.h"
>  
> @@ -128,6 +129,13 @@ route_erase_entry(struct route_entry *route_e)
>      free(route_e);
>  }
>  
> +static bool
> +get_nbrp_or_nbr_option(const struct ovn_port *op, const char *key)
> +{
> +    return smap_get_bool(&op->nbrp->options, key,
> +        smap_get_bool(&op->od->nbr->options, key, false));
> +}
> +
>  static void
>  routes_table_sync(struct ovsdb_idl_txn *ovnsb_txn,
>                    const struct sbrec_route_table *sbrec_route_table,
> @@ -164,6 +172,16 @@ routes_table_sync(struct ovsdb_idl_txn *ovnsb_txn,
>                             false)) {
>              continue;
>          }
> +        if (route->source == ROUTE_SOURCE_CONNECTED &&
> +                !get_nbrp_or_nbr_option(route->out_port,
> +                                        "dynamic-routing-connected")) {

I guess we need some documentation for this option.

Regards,
Lorenzo

> +            continue;
> +        }
> +        if (route->source == ROUTE_SOURCE_STATIC &&
> +                !get_nbrp_or_nbr_option(route->out_port,
> +                                        "dynamic-routing-static")) {
> +            continue;
> +        }
>          route_e = route_lookup_or_add(&sync_routes,
>                                        route->od->sb,
>                                        route->out_port->key,
> -- 
> 2.47.0
> 
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/northd/en-routes-sync.c b/northd/en-routes-sync.c
index bb61e0d51..581f21b8e 100644
--- a/northd/en-routes-sync.c
+++ b/northd/en-routes-sync.c
@@ -15,6 +15,7 @@ 
 #include <config.h>
 
 #include "openvswitch/vlog.h"
+#include "smap.h"
 #include "stopwatch.h"
 #include "northd.h"
 
@@ -128,6 +129,13 @@  route_erase_entry(struct route_entry *route_e)
     free(route_e);
 }
 
+static bool
+get_nbrp_or_nbr_option(const struct ovn_port *op, const char *key)
+{
+    return smap_get_bool(&op->nbrp->options, key,
+        smap_get_bool(&op->od->nbr->options, key, false));
+}
+
 static void
 routes_table_sync(struct ovsdb_idl_txn *ovnsb_txn,
                   const struct sbrec_route_table *sbrec_route_table,
@@ -164,6 +172,16 @@  routes_table_sync(struct ovsdb_idl_txn *ovnsb_txn,
                            false)) {
             continue;
         }
+        if (route->source == ROUTE_SOURCE_CONNECTED &&
+                !get_nbrp_or_nbr_option(route->out_port,
+                                        "dynamic-routing-connected")) {
+            continue;
+        }
+        if (route->source == ROUTE_SOURCE_STATIC &&
+                !get_nbrp_or_nbr_option(route->out_port,
+                                        "dynamic-routing-static")) {
+            continue;
+        }
         route_e = route_lookup_or_add(&sync_routes,
                                       route->od->sb,
                                       route->out_port->key,