diff options
author | Phil Sutter <phil@nwl.cc> | 2024-07-26 13:21:09 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2024-07-31 23:13:55 +0200 |
commit | 1c86d5513cd79c1df1a5e473ce51256129723f3e (patch) | |
tree | 0ac27d0effc47a44293c414b9e2597c04ad1f333 /extensions | |
parent | 95cdf550cf1c8dfba4fd7af19e5cadc10daead9f (diff) |
extensions: conntrack: Reuse print_state() for old state match
The extra bits supported by print_state() won't be set by the parser, no
functional change expected.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/libxt_conntrack.c | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/extensions/libxt_conntrack.c b/extensions/libxt_conntrack.c index ccbf731d..04940154 100644 --- a/extensions/libxt_conntrack.c +++ b/extensions/libxt_conntrack.c @@ -1102,32 +1102,6 @@ static void state_ct23_parse(struct xt_option_call *cb) sinfo->invert_flags |= XT_CONNTRACK_STATE; } -static void state_print_state(unsigned int statemask) -{ - const char *sep = ""; - - if (statemask & XT_CONNTRACK_STATE_INVALID) { - printf("%sINVALID", sep); - sep = ","; - } - if (statemask & XT_CONNTRACK_STATE_BIT(IP_CT_NEW)) { - printf("%sNEW", sep); - sep = ","; - } - if (statemask & XT_CONNTRACK_STATE_BIT(IP_CT_RELATED)) { - printf("%sRELATED", sep); - sep = ","; - } - if (statemask & XT_CONNTRACK_STATE_BIT(IP_CT_ESTABLISHED)) { - printf("%sESTABLISHED", sep); - sep = ","; - } - if (statemask & XT_CONNTRACK_STATE_UNTRACKED) { - printf("%sUNTRACKED", sep); - sep = ","; - } -} - static void state_print(const void *ip, const struct xt_entry_match *match, @@ -1135,16 +1109,16 @@ state_print(const void *ip, { const struct xt_state_info *sinfo = (const void *)match->data; - printf(" state "); - state_print_state(sinfo->statemask); + printf(" state"); + print_state(sinfo->statemask); } static void state_save(const void *ip, const struct xt_entry_match *match) { const struct xt_state_info *sinfo = (const void *)match->data; - printf(" --state "); - state_print_state(sinfo->statemask); + printf(" --state"); + print_state(sinfo->statemask); } static void state_xlate_print(struct xt_xlate *xl, unsigned int statemask, int inverted) |