Older kernels don't support nexthops groups, so
add configure checks and fall back to their known constant
values when unsupported.

Signed-off-by: Alexandra Rukomoinikova <[email protected]>
---
 configure.ac                           |  2 ++
 controller/neighbor-exchange-netlink.c |  6 ++++++
 controller/nexthop-exchange.c          |  6 ++++++
 m4/ovn.m4                              | 24 ++++++++++++++++++++++++
 4 files changed, 38 insertions(+)

diff --git a/configure.ac b/configure.ac
index cfa4cc386..754b7a3c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,6 +172,8 @@ OVN_CHECK_VERSION_SUFFIX
 OVN_CHECK_OVS
 OVN_CHECK_VIF_PLUG_PROVIDER
 OVN_CHECK_LINUX_NEXTHOP_WEIGHT
+OVN_CHECK_LINUX_NDA_NH_ID
+OVN_CHECK_LINUX_NHA_FDB
 OVN_ENABLE_VIF_PLUG
 OVS_CTAGS_IDENTIFIERS
 AC_SUBST([OVS_CFLAGS])
diff --git a/controller/neighbor-exchange-netlink.c 
b/controller/neighbor-exchange-netlink.c
index 23df6d501..2f0093895 100644
--- a/controller/neighbor-exchange-netlink.c
+++ b/controller/neighbor-exchange-netlink.c
@@ -31,6 +31,12 @@
 #include "neighbor-exchange-netlink.h"
 #include "neighbor.h"
 
+/* Fallback for older kernels that do not support
+ * nexthops groups */
+#ifndef HAVE_NDA_NH_ID
+#define NDA_NH_ID 13
+#endif
+
 VLOG_DEFINE_THIS_MODULE(neighbor_exchange_netlink);
 
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
diff --git a/controller/nexthop-exchange.c b/controller/nexthop-exchange.c
index 8718b893f..ab910eda0 100644
--- a/controller/nexthop-exchange.c
+++ b/controller/nexthop-exchange.c
@@ -39,6 +39,12 @@ static int nh_table_parse__(struct ofpbuf *, size_t ofs,
 static void nh_populate_grp_pointers(struct nexthop_entry *, struct hmap *);
 static uint32_t nexthop_entry_hash(uint32_t id);
 
+/* Fallback for older kernels that do not support
+ * nexthops groups */
+#ifndef HAVE_NHA_FDB
+#define NHA_FDB 11
+#endif
+
 /* The following definition should be available in Linux 6.12 and might be
  * missing if we have older headers. */
 #ifndef HAVE_NH_GRP_WEIGHT
diff --git a/m4/ovn.m4 b/m4/ovn.m4
index 22ad1a27f..b2f616691 100644
--- a/m4/ovn.m4
+++ b/m4/ovn.m4
@@ -453,6 +453,30 @@ AC_DEFUN([OVS_CHECK_LINUX_NETLINK], [
     [Define to 1 if struct nla_bitfield32 is available.])])
 ])
 
+dnl OVN_CHECK_LINUX_NDA_NH_ID
+dnl
+dnl Configure Linux netlink neighbour NDA_NH_ID compat.
+AC_DEFUN([OVN_CHECK_LINUX_NDA_NH_ID], [
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([#include <linux/rtnetlink.h>], [
+        int x = NDA_NH_ID;
+    ])],
+    [AC_DEFINE([HAVE_NDA_NH_ID], [1],
+    [Define to 1 if NDA_NH_ID is available.])])
+])
+
+dnl OVN_CHECK_LINUX_NHA_FDB
+dnl
+dnl Configure Linux netlink nexthop NHA_FDB compat.
+AC_DEFUN([OVN_CHECK_LINUX_NHA_FDB], [
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([#include <linux/nexthop.h>], [
+        int x = NHA_FDB;
+    ])],
+    [AC_DEFINE([HAVE_NHA_FDB], [1],
+    [Define to 1 if NHA_FDB is available.])])
+])
+
 dnl OVN_CHECK_LINUX_NEXTHOP_WEIGHT
 dnl
 dnl Configure Linux netlink nexthop compat.
-- 
2.48.1

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

Reply via email to