From 1d73cec02c8d9a0f5bfbd2983c36cc1228b78f45 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 5 Nov 2021 22:02:45 +0100 Subject: xshared: Share print_rule_details() with legacy Have to pass pointer to counters directly since different fields are being used for some reason. Since proto_to_name() is not used outside of xshared.c anymore, make it static. Signed-off-by: Phil Sutter --- iptables/iptables.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'iptables/iptables.c') diff --git a/iptables/iptables.c b/iptables/iptables.c index 0d8beb04..29da40b1 100644 --- a/iptables/iptables.c +++ b/iptables/iptables.c @@ -322,25 +322,8 @@ print_firewall(const struct ipt_entry *fw, t = ipt_get_target((struct ipt_entry *)fw); flags = fw->ip.flags; - if (format & FMT_LINENUMBERS) - printf(FMT("%-4u ", "%u "), num); - - if (!(format & FMT_NOCOUNTS)) { - xtables_print_num(fw->counters.pcnt, format); - xtables_print_num(fw->counters.bcnt, format); - } - - if (!(format & FMT_NOTARGET)) - printf(FMT("%-9s ", "%s "), targname); - - fputc(fw->ip.invflags & XT_INV_PROTO ? '!' : ' ', stdout); - { - const char *pname = proto_to_name(fw->ip.proto, format&FMT_NUMERIC); - if (pname) - printf(FMT("%-5s", "%s "), pname); - else - printf(FMT("%-5hu", "%hu "), fw->ip.proto); - } + print_rule_details(num, &fw->counters, targname, fw->ip.proto, + fw->ip.flags, fw->ip.invflags, format); if (format & FMT_OPTIONS) { if (format & FMT_NOTABLE) -- cgit v1.2.3