netfilter: add option for GCOV profiling

Similar to a few other subsystems: add a new config toggle to
enable netfilter gcov profiling in netfilter, including ebtables,
arptables and so on.

ipset and ipvs gain their own, dedicated toggles.

Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Florian Westphal <fw@strlen.de>
This commit is contained in:
Florian Westphal
2026-05-07 11:34:15 +02:00
parent ec1806a730
commit 403cec8ab6
12 changed files with 62 additions and 0 deletions

View File

@@ -29,3 +29,9 @@ obj-$(CONFIG_NETFILTER) += netfilter/
bridge-$(CONFIG_BRIDGE_MRP) += br_mrp_switchdev.o br_mrp.o br_mrp_netlink.o
bridge-$(CONFIG_BRIDGE_CFM) += br_cfm.o br_cfm_netlink.o
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE_br_nf_core.o := y
GCOV_PROFILE_br_netfilter_hooks.o := y
GCOV_PROFILE_br_netfilter_ipv6.o := y
endif

View File

@@ -38,3 +38,7 @@ obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_snat.o
# watchers
obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_log.o
obj-$(CONFIG_BRIDGE_EBT_NFLOG) += ebt_nflog.o
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE := y
endif

View File

@@ -71,3 +71,7 @@ obj-$(CONFIG_TCP_AO) += tcp_ao.o
ifeq ($(CONFIG_BPF_JIT),y)
obj-$(CONFIG_BPF_SYSCALL) += bpf_tcp_ca.o
endif
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE_netfilter.o := y
endif

View File

@@ -51,3 +51,7 @@ obj-$(CONFIG_IP_NF_ARP_MANGLE) += arpt_mangle.o
obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o
obj-$(CONFIG_NF_DUP_IPV4) += nf_dup_ipv4.o
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE := y
endif

View File

@@ -54,3 +54,7 @@ obj-$(CONFIG_NET_UDP_TUNNEL) += ip6_udp_tunnel.o
obj-y += mcast_snoop.o
obj-$(CONFIG_TCP_AO) += tcp_ao.o
endif
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE_netfilter.o := y
endif

View File

@@ -43,3 +43,7 @@ obj-$(CONFIG_IP6_NF_MATCH_SRH) += ip6t_srh.o
obj-$(CONFIG_IP6_NF_TARGET_NPT) += ip6t_NPT.o
obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
obj-$(CONFIG_IP6_NF_TARGET_SYNPROXY) += ip6t_SYNPROXY.o
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE := y
endif

View File

@@ -1648,6 +1648,14 @@ config NETFILTER_XT_MATCH_U32
endif # NETFILTER_XTABLES
config GCOV_PROFILE_NETFILTER
bool "Enable GCOV profiling for netfilter"
depends on GCOV_KERNEL
help
Enable GCOV profiling for netfilter to check which functions/lines
are executed.
If unsure, say N.
endmenu
source "net/netfilter/ipset/Kconfig"

View File

@@ -240,3 +240,7 @@ obj-$(CONFIG_IP_VS) += ipvs/
# lwtunnel
obj-$(CONFIG_LWTUNNEL) += nf_hooks_lwtunnel.o
ifdef CONFIG_GCOV_PROFILE_NETFILTER
GCOV_PROFILE := y
endif

View File

@@ -175,4 +175,13 @@ config IP_SET_LIST_SET
To compile it as a module, choose M here. If unsure, say N.
config GCOV_PROFILE_IPSET
bool "Enable GCOV profiling for ipset"
depends on GCOV_KERNEL
help
Enable GCOV profiling for ipset to check which functions/lines
are executed.
If unsure, say N.
endif # IP_SET

View File

@@ -29,3 +29,6 @@ obj-$(CONFIG_IP_SET_HASH_NETPORTNET) += ip_set_hash_netportnet.o
# list types
obj-$(CONFIG_IP_SET_LIST_SET) += ip_set_list_set.o
ifdef CONFIG_GCOV_PROFILE_IPSET
GCOV_PROFILE := y
endif

View File

@@ -349,4 +349,13 @@ config IP_VS_PE_SIP
help
Allow persistence based on the SIP Call-ID
config GCOV_PROFILE_IPVS
bool "Enable GCOV profiling for IPVS"
depends on GCOV_KERNEL
help
Enable GCOV profiling for IPVS to check which functions/lines
are executed.
If unsure, say N.
endif # IP_VS

View File

@@ -43,3 +43,6 @@ obj-$(CONFIG_IP_VS_FTP) += ip_vs_ftp.o
# IPVS connection template retrievers
obj-$(CONFIG_IP_VS_PE_SIP) += ip_vs_pe_sip.o
ifdef CONFIG_GCOV_PROFILE_IPVS
GCOV_PROFILE := y
endif