]> git.feebdaed.xyz Git - 0xmirror/ovs.git/commit
netlink: Fix build on kernels < 4.1 due to missing RTA_VIA.
authorIlya Maximets <i.maximets@ovn.org>
Thu, 9 Oct 2025 09:21:22 +0000 (11:21 +0200)
committerIlya Maximets <i.maximets@ovn.org>
Fri, 10 Oct 2025 18:04:33 +0000 (20:04 +0200)
commitf83d2e4d53ad06469d0847cb039b14ea476535b3
tree90244858978cc6f80ef249a8e4688672e090dd09
parent7fb51c4fdd99c51f2e7287f0e9391a85db1c312f
netlink: Fix build on kernels < 4.1 due to missing RTA_VIA.

Current code assumes that if the rtnetlink.h exists, then it must
have definitions for RTA_VIA and 'struct rtvia'.  This is causing
build failures on older systems:

  lib/netlink.c: In function 'min_attr_len':
  lib/netlink.c:832:38:
    error: invalid application of 'sizeof' to incomplete type 'struct rtvia'
     case NL_A_RTA_VIA: return sizeof(struct rtvia) + sizeof(struct in_addr);
                                      ^

The code structure overall is not great, we should not include Linux
specific headers in the common netlink.c.  The only reason for the
inclusion though is the structure size.  We can just put a number
instead, as it is already done for all other types.  It should never
change, as long as kernel uAPI is stable.

Structure and the RTA_VIA should be defined in the Linux-specific
route-table.c, in case rtnetlink.h doesn't have a definition for them.

Fixes: 9d9a99d157f2 ("route-table: Support parsing RTA_VIA attribute.")
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2025-September/053800.html
Reported-by: Brendan Doyle <brendan.doyle@oracle.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
acinclude.m4
lib/netlink.c
lib/route-table.c