The nexthop column was deprecated for a long time. Stop using it
completely in northd.

Reported-at: https://issues.redhat.com/browse/FDP-1807
Signed-off-by: Ales Musil <[email protected]>
---
v2: Rebase on top of main.
    Add extra warning and update the documentation.
---
 northd/northd.c | 21 +++++++++++++--------
 ovn-nb.xml      |  3 ++-
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index 88b912122..d305f5806 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -14708,6 +14708,15 @@ build_route_policies(struct ovn_datapath *od, const 
struct hmap *lr_ports,
 
     for (int i = 0; i < od->nbr->n_policies; i++) {
         const struct nbrec_logical_router_policy *rule = od->nbr->policies[i];
+
+        if (rule->nexthop && rule->nexthop[0]) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
+            VLOG_WARN_RL(&rl, "Logical router: %s, policy uses deprecated"
+                         " column \"nexthop\", this column is ignored. Please"
+                         "use \"nexthops\" column instead.", od->nbr->name);
+            continue;
+        }
+
         size_t n_valid_nexthops = 0;
         char **valid_nexthops = NULL;
         uint32_t chain_id = 0;
@@ -14748,9 +14757,7 @@ build_route_policies(struct ovn_datapath *od, const 
struct hmap *lr_ports,
         }
 
         if (!strcmp(rule->action, "reroute")) {
-            size_t n_nexthops = rule->n_nexthops ? rule->n_nexthops : 1;
-
-            if (rule->output_port && n_nexthops != 1) {
+            if (rule->output_port && rule->n_nexthops != 1) {
                 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
                 VLOG_WARN_RL(&rl,
                              "Logical router: %s, policy "
@@ -14763,11 +14770,9 @@ build_route_policies(struct ovn_datapath *od, const 
struct hmap *lr_ports,
                 continue;
             }
 
-            valid_nexthops = xcalloc(n_nexthops, sizeof *valid_nexthops);
-            for (size_t j = 0; j < n_nexthops; j++) {
-                char *nexthop = rule->n_nexthops
-                    ? rule->nexthops[j] : rule->nexthop;
-
+            valid_nexthops = xcalloc(rule->n_nexthops, sizeof *valid_nexthops);
+            for (size_t j = 0; j < rule->n_nexthops; j++) {
+                char *nexthop = rule->nexthops[j];
                 if (!nexthop || !nexthop[0]) {
                     continue;
                 }
diff --git a/ovn-nb.xml b/ovn-nb.xml
index a1edd8d35..e74c0d010 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -4923,7 +4923,8 @@ or
 
     <column name="nexthop">
       <p>
-        Note: This column is deprecated in favor of <ref column="nexthops"/>.
+        Note: This column is deprecated in favor of <ref column="nexthops"/>
+        and is ignored by northd.
       </p>
       <p>
         Next-hop IP address for this route, which should be the IP
-- 
2.52.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to