Re: [PATCH 2/4] netlink: Fix compilation on really old platforms

Marcel Holtmann <[email protected]> Thu, 9 Nov 2023 15:53:35 +0100
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Hi Denis,

> Some platforms lack definitions of new netlink features.  Fix this
> by including a local copy of the most up to date netlink.h header.
> 
>  CC       ell/netlink.lo
> ell/netlink.c: In function ‘l_netlink_set_debug’:
> ell/netlink.c:629:56: error: ‘NETLINK_EXT_ACK’ undeclared (first use in this function)
>  if (setsockopt(l_io_get_fd(netlink->io), SOL_NETLINK, NETLINK_EXT_ACK,
>                                                        ^
> ell/netlink.c:629:56: note: each undeclared identifier is reported only once for each function it appears in
> ell/netlink.c: In function ‘netlink_parse_ext_ack_error’:
> ell/netlink.c:649:29: error: ‘NLM_F_ACK_TLVS’ undeclared (first use in this function)
>  if (!(nlmsg->nlmsg_flags & NLM_F_ACK_TLVS))
>                             ^
> ell/netlink.c:657:29: error: ‘NLM_F_CAPPED’ undeclared (first use in this function)
>  if (!(nlmsg->nlmsg_flags & NLM_F_CAPPED))
>                             ^
> ell/netlink.c:677:8: error: ‘NLMSGERR_ATTR_MSG’ undeclared (first use in this function)
>   case NLMSGERR_ATTR_MSG:
>        ^
> ell/netlink.c:681:8: error: ‘NLMSGERR_ATTR_OFFS’ undeclared (first use in this function)
>   case NLMSGERR_ATTR_OFFS:
>        ^
> ---
> Makefile.am     |   2 +-
> linux/netlink.h | 383 ++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 384 insertions(+), 1 deletion(-)
> create mode 100644 linux/netlink.h
> 
> diff --git a/Makefile.am b/Makefile.am
> index 6c86e94e963e..ec75bb46ed44 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -12,7 +12,7 @@ ELL_CURRENT = 0
> ELL_REVISION = 2
> ELL_AGE = 0
> 
> -linux_headers = linux/gpio.h
> +linux_headers = linux/gpio.h linux/netlink.h

so while we could do this, I really don’t like it. Running after upstream netlink.h changes is something I rather not keep doing. For the nl80211.h header this is semi-ok, but I rather not keep doing that for all netlink headers.

Can we just add some of these into missing.h and #ifdef fallbacks. We do that for AF_ALG for example and I would prefer that than chasing upstream.

Regards

Marcel