[PATCH v2 3/4] virnetdevbridge: Include virnetlink.h more often

Michal Privoznik via Devel posted 4 patches 3 months, 4 weeks ago
[PATCH v2 3/4] virnetdevbridge: Include virnetlink.h more often
Posted by Michal Privoznik via Devel 3 months, 4 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

The whole point of virnetlink.h is that it hides away the build
time dependency on netlink. It wraps netlink functions in our
functions which then have a stub implementation in case netlink
support was disabled.

Though, netlink is still Linux specific, so keep it in the
'#ifdef __linux__` block to cause a compilation error should
anybody try to use any of the wrapped functions on non-Linux.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virnetdevbridge.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index 3b54e2cb1e..806ccc5fa7 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -30,9 +30,7 @@
 #endif
 
 #ifdef __linux__
-# if defined(WITH_LIBNL)
-#  include "virnetlink.h"
-# endif
+# include "virnetlink.h"
 # include <linux/sockios.h>
 # include <linux/param.h>     /* HZ                 */
 # include <linux/in6.h>
-- 
2.49.0
Re: [PATCH v2 3/4] virnetdevbridge: Include virnetlink.h more often
Posted by Peter Krempa via Devel 3 months, 4 weeks ago
On Tue, May 13, 2025 at 16:43:52 +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> The whole point of virnetlink.h is that it hides away the build
> time dependency on netlink. It wraps netlink functions in our
> functions which then have a stub implementation in case netlink
> support was disabled.
> 
> Though, netlink is still Linux specific, so keep it in the
> '#ifdef __linux__` block to cause a compilation error should
> anybody try to use any of the wrapped functions on non-Linux.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/util/virnetdevbridge.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>