From c984ee5afdd84098fc103e110f4501d0ea196fe8 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 22 Jul 2022 15:31:16 +1000 Subject: Clarify semantics of c->v4 and c->v6 variables The v4 and v6 fields of the context structure can be confusing, because they change meaning part way through the code: Before conf_ip(), they are booleans which indicate whether the -4 or -6 options have been given. After conf_ip() they are DISABLED|ENABLED|PROBE enums which indicate whether the IP version is available (which means both that it was allowed on the command line and we were able to configure it). The PROBE variant of the enum is only used locally within conf_ip() and since recent changes there it no longer has a real purpose different from ENABLED. Simplify this all by making the context fields always just a boolean indicating the availability of the IP version. They both default to 1, but can be set to 0 by either command line options or configuration failures. We use some local variables in conf() for tracking the state of the command line options on their own. Signed-off-by: David Gibson [sbrivio: Minor coding style fix in conf.c] Signed-off-by: Stefano Brivio --- util.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index ae4cc54..8297bec 100644 --- a/util.h +++ b/util.h @@ -74,12 +74,6 @@ void trace_init(int enable); #define V6 1 #define IP_VERSIONS 2 -enum { - IP_VERSION_DISABLED = 0, - IP_VERSION_ENABLED, - IP_VERSION_PROBE, -}; - #define ARRAY_SIZE(a) ((int)(sizeof(a) / sizeof((a)[0]))) #define IN_INTERVAL(a, b, x) ((x) >= (a) && (x) <= (b)) -- cgit v1.2.3