From 867c773031aef74e66cd15b55418141bcc538b95 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 4 Feb 2025 15:50:02 +0000 Subject: [PATCH] make: allow setting the default network locking backend As different Linux distributions are switching away from iptables to nftables, this makes it easier to compile CRIU with a different default network locking backend. Instead of changing the source code it is now possible to select the nft backend like this: make NETWORK_LOCK_DEFAULT=NETWORK_LOCK_NFTABLES Signed-off-by: Adrian Reber --- Makefile | 4 ++++ criu/include/cr_options.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 90908de83..5d8e89ac1 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,10 @@ ifneq ($(GCOV),) CFLAGS += $(CFLAGS-GCOV) endif +ifneq ($(NETWORK_LOCK_DEFAULT),) + CFLAGS += -DNETWORK_LOCK_DEFAULT=$(NETWORK_LOCK_DEFAULT) +endif + ifeq ($(ASAN),1) CFLAGS-ASAN := -fsanitize=address export CFLAGS-ASAN diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h index 60cf9437e..ab0bd8fa3 100644 --- a/criu/include/cr_options.h +++ b/criu/include/cr_options.h @@ -70,7 +70,15 @@ enum NETWORK_LOCK_METHOD { NETWORK_LOCK_SKIP, }; +/** + * CRIU currently defaults to the iptables locking backend. + * + * It is, however, possible to change this by defining + * NETWORK_LOCK_DEFAULT to a different value on the command-line. + */ +#ifndef NETWORK_LOCK_DEFAULT #define NETWORK_LOCK_DEFAULT NETWORK_LOCK_IPTABLES +#endif /* * Ghost file size we allow to carry by default.