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 <areber@redhat.com>
This commit is contained in:
Adrian Reber 2025-02-04 15:50:02 +00:00 committed by Andrei Vagin
parent 720bf67e06
commit 867c773031
2 changed files with 12 additions and 0 deletions

View file

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

View file

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