aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-07-22 15:31:16 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-07-30 22:09:38 +0200
commitc984ee5afdd84098fc103e110f4501d0ea196fe8 (patch)
tree22010c756380246a3dc8e1f292cc04d388bfcae0 /util.h
parent4bc883aeab9b05d66baa4fcf3c0e993ffa6f8a0b (diff)
downloadpasst-c984ee5afdd84098fc103e110f4501d0ea196fe8.tar
passt-c984ee5afdd84098fc103e110f4501d0ea196fe8.tar.gz
passt-c984ee5afdd84098fc103e110f4501d0ea196fe8.tar.bz2
passt-c984ee5afdd84098fc103e110f4501d0ea196fe8.tar.lz
passt-c984ee5afdd84098fc103e110f4501d0ea196fe8.tar.xz
passt-c984ee5afdd84098fc103e110f4501d0ea196fe8.tar.zst
passt-c984ee5afdd84098fc103e110f4501d0ea196fe8.zip
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 <david@gibson.dropbear.id.au> [sbrivio: Minor coding style fix in conf.c] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
-rw-r--r--util.h6
1 files changed, 0 insertions, 6 deletions
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))