Older kernels don't support NDA_NH_ID and NHA_FDB, so
their headers lack these definitions, breaking the build.
Add configure checks and fall back to their known constant
values when unsupported.
Fixes: 0f8551611cfe ("controller: Support FDB entries with nexthop ID defined.")
Fixes: c9af703c618a ("controller: Add support for syncing the nexthop table.")
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..f0628d687 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,8 @@ OVS_CHECK_PRAGMA_MESSAGE
OVN_CHECK_VERSION_SUFFIX
OVN_CHECK_OVS
OVN_CHECK_VIF_PLUG_PROVIDER
+OVN_CHECK_LINUX_NDA_NH_ID
+OVN_CHECK_LINUX_NHA_FDB
OVN_CHECK_LINUX_NEXTHOP_WEIGHT
OVN_ENABLE_VIF_PLUG
OVS_CTAGS_IDENTIFIERS
diff --git a/controller/neighbor-exchange-netlink.c
b/controller/neighbor-exchange-netlink.c
index f01bfda5b..c6b21e7a2 100644
--- a/controller/neighbor-exchange-netlink.c
+++ b/controller/neighbor-exchange-netlink.c
@@ -27,6 +27,12 @@
#include "neighbor-exchange-netlink.h"
#include "neighbor.h"
+/* NDA_NH_ID was added in Linux 5.8 and might be missing in older kernel
+ * headers. */
+#ifndef HAVE_NDA_NH_ID
+#define NDA_NH_ID 13
+#endif
+
VLOG_DEFINE_THIS_MODULE(neighbor_exchange_netlink);
#define NETNL_REQ_BUFFER_SIZE 128
diff --git a/controller/nexthop-exchange.c b/controller/nexthop-exchange.c
index 8718b893f..37e80f161 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);
+/* NHA_FDB was added in Linux 5.8 and might be missing in older kernel
+ * headers. */
+#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..6be2bba09 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/neighbour.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