On 7/14/26 11:09 AM, Alexandra Rukomoinikova via dev wrote:
> 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.
> 
> Signed-off-by: Alexandra Rukomoinikova <[email protected]>

Hi Alexandra, thanks for the patch! I have a few comments.

Since this is a bug-fix you should include the "Fixes:" tag.

> ---
>  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

(This is unrelated to this patch but the VIF macros should be
together... Oh well :))

>  OVN_CHECK_LINUX_NEXTHOP_WEIGHT
> +OVN_CHECK_LINUX_NDA_NH_ID
> +OVN_CHECK_LINUX_NHA_FDB

These are defined before OVN_CHECK_LINUX_NEXTHOP_WEIGHT in ovn.m4.

>  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..f11dd3112 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"
>  
> +/* NDA_NH_ID was added in Linux 5.13 and might be missing on older kernel
> + * headers. */

It was added in 5.8, verified with this command:
git tag --contains 1274e1cc42264d4e629841e4f182795cb0becfd2 | sort -V

Also s/on/in.

> +#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..925baebf2 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 6.x and might be missing on older kernel
> + * headers. */

This one was also added in 5.8 :)

Same thing s/on/in.

> +#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>], [

Shouldn't this be <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.
-- 
Rosemarie O'Riorden
Lowell, MA, United States
[email protected]

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

Reply via email to