summaryrefslogtreecommitdiffstats
path: root/iptables/xshared.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2020-11-17 02:49:32 +0100
committerPhil Sutter <phil@nwl.cc>2021-11-23 15:01:23 +0100
commit24f30842d979da464c1c3ef106d2efa66a480735 (patch)
tree9223ffde1be3e9c53c3a9feced463706c9cb7b33 /iptables/xshared.h
parenta323c28331a4807252b11a7a078dc68af82399ef (diff)
xshared: Share print_header() with legacy iptables
Legacy iptables fetches the relevant data via libiptc before calling the shared routine which merely prints data as requested. Drop the 'basechain' parameter, instead make sure a policy name is passed only with base chains. Since the function is not shared with ebtables (which uses a very rudimental header instead), this is safe. In order to support legacy iptables' checking of iptc_get_references() return code (printing an error message instead of the reference count), make refs parameter signed and print the error message if it's negative. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/xshared.h')
-rw-r--r--iptables/xshared.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/iptables/xshared.h b/iptables/xshared.h
index 48f314ca..75794009 100644
--- a/iptables/xshared.h
+++ b/iptables/xshared.h
@@ -220,6 +220,9 @@ void debug_print_argv(struct argv_store *store);
const char *ipv4_addr_to_string(const struct in_addr *addr,
const struct in_addr *mask,
unsigned int format);
+void print_header(unsigned int format, const char *chain, const char *pol,
+ const struct xt_counters *counters,
+ int refs, uint32_t entries);
void print_ipv4_addresses(const struct ipt_entry *fw, unsigned int format);
void save_ipv4_addr(char letter, const struct in_addr *addr,
const struct in_addr *mask, int invert);