If the number of flows over a gateway exceeds the flow cache size of the Linux
kernel, policy lookup gets very expensive. Policies covering more than a single
address don't get hash-indexed by default, which results in wasting most of
the cycles in xfrm_policy_lookup_bytype() and its xfrm_policy_match() use.
Starting with several hundred policies the overhead gets inacceptable.
Starting with Linux 3.18, Linux can hash the first n-bit of a policy subnet
to perform indexed lookup. With correctly chosen netbits, this can completely
eliminate the performance impact of policy lookups, freeing the resources
for ESP crypto.
WARNING: Due to a bug in kernels 3.19 through 4.7, the kernel crashes with a
NULL pointer dereference if a socket policy is installed while hash thresholds
are changed. And because the hashtable rebuild triggered by the threshold
change that causes this is scheduled it might also happen if the socket
policies are seemingly installed after setting the thresholds.
The fix for this bug - 6916fb3b10b3 ("xfrm: Ignore socket policies when
rebuilding hash tables") - is included since 4.8 (and might get backported).
As a workaround `charon.plugins.kernel-netlink.port_bypass` may be enabled
to replace the socket policies that allow IKE traffic with port specific
bypass policies.
102 lines
4.2 KiB
Plaintext
102 lines
4.2 KiB
Plaintext
charon.plugins.kernel-netlink.buflen = <min(PAGE_SIZE, 8192)>
|
|
Buffer size for received Netlink messages.
|
|
|
|
charon.plugins.kernel-netlink.fwmark =
|
|
Firewall mark to set on the routing rule that directs traffic to our routing
|
|
table.
|
|
|
|
Firewall mark to set on the routing rule that directs traffic to our routing
|
|
table. The format is [!]mark[/mask], where the optional exclamation mark
|
|
inverts the meaning (i.e. the rule only applies to packets that don't match
|
|
the mark).
|
|
|
|
charon.plugins.kernel-netlink.mss = 0
|
|
MSS to set on installed routes, 0 to disable.
|
|
|
|
charon.plugins.kernel-netlink.mtu = 0
|
|
MTU to set on installed routes, 0 to disable.
|
|
|
|
charon.plugins.kernel-netlink.parallel_route = no
|
|
Whether to perform concurrent Netlink ROUTE queries on a single socket.
|
|
|
|
Whether to perform concurrent Netlink ROUTE queries on a single socket.
|
|
While parallel queries can improve throughput, it has more overhead. On
|
|
vanilla Linux, DUMP queries fail with EBUSY and must be retried, further
|
|
decreasing performance.
|
|
|
|
charon.plugins.kernel-netlink.parallel_xfrm = no
|
|
Whether to perform concurrent Netlink XFRM queries on a single socket.
|
|
|
|
charon.plugins.kernel-netlink.policy_update = no
|
|
Whether to always use XFRM_MSG_UPDPOLICY to install policies.
|
|
|
|
charon.plugins.kernel-netlink.port_bypass = no
|
|
Whether to use port or socket based IKE XFRM bypass policies.
|
|
|
|
Whether to use port or socket based IKE XFRM bypass policies.
|
|
IKE bypass policies are used to exempt IKE traffic from XFRM processing.
|
|
The default socket based policies are directly tied to the IKE UDP sockets,
|
|
port based policies use global XFRM bypass policies for the used IKE UDP
|
|
ports.
|
|
|
|
charon.plugins.kernel-netlink.roam_events = yes
|
|
Whether to trigger roam events when interfaces, addresses or routes change.
|
|
|
|
charon.plugins.kernel-netlink.set_proto_port_transport_sa = no
|
|
Whether to set protocol and ports in the selector installed on transport
|
|
mode IPsec SAs in the kernel.
|
|
|
|
Whether to set protocol and ports in the selector installed on transport
|
|
mode IPsec SAs in the kernel. While doing so enforces policies for inbound
|
|
traffic, it also prevents the use of a single IPsec SA by more than one
|
|
traffic selector.
|
|
|
|
charon.plugins.kernel-netlink.spdh_thresh {}
|
|
XFRM policy hashing threshold configuration for IPv4 and IPv6.
|
|
|
|
XFRM policy hashing threshold configuration for IPv4 and IPv6.
|
|
|
|
The section defines hashing thresholds to configure in the kernel during
|
|
daemon startup. Each address family takes a threshold for the local subnet
|
|
of an IPsec policy (src in out-policies, dst in in- and forward-policies)
|
|
and the remote subnet (dst in out-policies, src in in- and
|
|
forward-policies).
|
|
|
|
If the subnet has more or equal net bits than the threshold, the first
|
|
threshold bits are used to calculate a hash to lookup the policy.
|
|
|
|
Policy hashing thresholds are not supported before Linux 3.18 and might
|
|
conflict with socket policies before Linux 4.8.
|
|
|
|
charon.plugins.kernel-netlink.spdh_thresh.ipv4.lbits = 32
|
|
Local subnet XFRM policy hashing threshold for IPv4.
|
|
|
|
charon.plugins.kernel-netlink.spdh_thresh.ipv4.rbits = 32
|
|
Remote subnet XFRM policy hashing threshold for IPv4.
|
|
|
|
charon.plugins.kernel-netlink.spdh_thresh.ipv6.lbits = 128
|
|
Local subnet XFRM policy hashing threshold for IPv6.
|
|
|
|
charon.plugins.kernel-netlink.spdh_thresh.ipv6.rbits = 128
|
|
Remote subnet XFRM policy hashing threshold for IPv6.
|
|
|
|
charon.plugins.kernel-netlink.retries = 0
|
|
Number of Netlink message retransmissions to send on timeout.
|
|
|
|
charon.plugins.kernel-netlink.timeout = 0
|
|
Netlink message retransmission timeout, 0 to disable retransmissions.
|
|
|
|
charon.plugins.kernel-netlink.ignore_retransmit_errors = no
|
|
Whether to ignore errors potentially resulting from a retransmission.
|
|
|
|
charon.plugins.kernel-netlink.xfrm_acq_expires = 165
|
|
Lifetime of XFRM acquire state and allocated SPIs in kernel.
|
|
|
|
Lifetime of XFRM acquire state created by the kernel when traffic matches a
|
|
trap policy. The value gets written to /proc/sys/net/core/xfrm_acq_expires.
|
|
Indirectly controls the delay between XFRM acquire messages triggered by the
|
|
kernel for a trap policy. The same value is used as timeout for SPIs
|
|
allocated by the kernel. The default value equals the default total
|
|
retransmission timeout for IKE messages, see IKEv2 RETRANSMISSION
|
|
in **strongswan.conf**(5).
|