summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-07-26 14:45:33 +0200
committerPhil Sutter <phil@nwl.cc>2024-07-31 23:13:55 +0200
commitec64196bbb0520fc99d88e209ff00f8e9a56b3a0 (patch)
tree78a5e6cc04d61903107d67b69531320cfe2f30f4
parent8e3e579e753f7a00c099a37ca8601d0da19f14bf (diff)
libxtables: Debug: Slightly improve extension ordering debugging
Print the extension's real name (if present) and prefix the extension list by a position number for clarity. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--libxtables/xtables.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index 7b370d48..7d54540b 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -1171,11 +1171,21 @@ void xtables_register_match(struct xtables_match *me)
me->next = *pos;
*pos = me;
#ifdef DEBUG
- printf("%s: inserted match %s (family %d, revision %d):\n",
- __func__, me->name, me->family, me->revision);
- for (pos = &xtables_pending_matches; *pos; pos = &(*pos)->next) {
- printf("%s:\tmatch %s (family %d, revision %d)\n", __func__,
- (*pos)->name, (*pos)->family, (*pos)->revision);
+#define printmatch(m, sfx) \
+ printf("match %s (", (m)->name); \
+ if ((m)->real_name) \
+ printf("alias %s, ", (m)->real_name); \
+ printf("family %d, revision %d)%s", (m)->family, (m)->revision, sfx);
+
+ {
+ int i = 1;
+
+ printf("%s: inserted ", __func__);
+ printmatch(me, ":\n");
+ for (pos = &xtables_pending_matches; *pos; pos = &(*pos)->next) {
+ printf("pos %d:\t", i++);
+ printmatch(*pos, "\n");
+ }
}
#endif
}