From 1776de0140fb663777d4590fbb849c1d0a0c7885 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 25 Jan 2022 19:55:54 +0100 Subject: tcp, netlink, HAS{BYTES_ACKED,MIN_RTT,GETRANDOM} and NETLINK_GET_STRICT_CHK tcpi_bytes_acked and tcpi_min_rtt are only available on recent kernel versions: provide fall-back paths (incurring some grade of performance penalty). Support for getrandom() was introduced in Linux 3.17 and glibc 2.25: provide an alternate mechanism for that as well, reading from /dev/random. Also check if NETLINK_GET_STRICT_CHK is defined before using it: it's not strictly needed, we'll filter out irrelevant results from netlink anyway. Signed-off-by: Stefano Brivio --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4647210..443c39d 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,21 @@ ifeq ($(shell printf "$(C)" | $(CC) -S -xc - -o - >/dev/null 2>&1; echo $$?),0) CFLAGS += -DHAS_SND_WND endif +C := \#include \nstruct tcp_info x = { .tcpi_bytes_acked = 0 }; +ifeq ($(shell printf "$(C)" | $(CC) -S -xc - -o - >/dev/null 2>&1; echo $$?),0) + CFLAGS += -DHAS_BYTES_ACKED +endif + +C := \#include \nstruct tcp_info x = { .tcpi_min_rtt = 0 }; +ifeq ($(shell printf "$(C)" | $(CC) -S -xc - -o - >/dev/null 2>&1; echo $$?),0) + CFLAGS += -DHAS_MIN_RTT +endif + +C := \#include \nint main(){int a=getrandom(0, 0, 0);} +ifeq ($(shell printf "$(C)" | $(CC) -S -xc - -o - >/dev/null 2>&1; echo $$?),0) + CFLAGS += -DHAS_GETRANDOM +endif + prefix ?= /usr/local all: passt pasta passt4netns qrap -- cgit v1.2.3