diff mbox series

[iptables,1/3] libiptc: Extend struct xtc_ops

Message ID 20180919142558.29207-2-phil@nwl.cc
State Accepted
Delegated to: Pablo Neira
Headers show
Series Merge legacy save and restore implementations | expand

Commit Message

Phil Sutter Sept. 19, 2018, 2:25 p.m. UTC
Add a few more callbacks used by iptables-save.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 include/libiptc/xtcshared.h | 5 +++++
 libiptc/Makefile.am         | 4 ++--
 libiptc/libiptc.c           | 4 ++++
 3 files changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/include/libiptc/xtcshared.h b/include/libiptc/xtcshared.h
index 773ebc4c77e2c..341f9d4fac5d0 100644
--- a/include/libiptc/xtcshared.h
+++ b/include/libiptc/xtcshared.h
@@ -7,11 +7,16 @@  struct xt_counters;
 
 struct xtc_ops {
 	int (*commit)(struct xtc_handle *);
+	struct xtc_handle *(*init)(const char *);
 	void (*free)(struct xtc_handle *);
 	int (*builtin)(const char *, struct xtc_handle *const);
 	int (*is_chain)(const char *, struct xtc_handle *const);
 	int (*flush_entries)(const xt_chainlabel, struct xtc_handle *);
 	int (*create_chain)(const xt_chainlabel, struct xtc_handle *);
+	const char *(*first_chain)(struct xtc_handle *);
+	const char *(*next_chain)(struct xtc_handle *);
+	const char *(*get_policy)(const char *, struct xt_counters *,
+				  struct xtc_handle *);
 	int (*set_policy)(const xt_chainlabel, const xt_chainlabel,
 			  struct xt_counters *, struct xtc_handle *);
 	const char *(*strerror)(int);
diff --git a/libiptc/Makefile.am b/libiptc/Makefile.am
index f789d34e00c94..638295dbb7370 100644
--- a/libiptc/Makefile.am
+++ b/libiptc/Makefile.am
@@ -10,6 +10,6 @@  libiptc_la_SOURCES  =
 libiptc_la_LIBADD   = libip4tc.la libip6tc.la
 libiptc_la_LDFLAGS  = -version-info 0:0:0 ${libiptc_LDFLAGS2}
 libip4tc_la_SOURCES = libip4tc.c
-libip4tc_la_LDFLAGS = -version-info 1:0:1
+libip4tc_la_LDFLAGS = -version-info 2:0:0
 libip6tc_la_SOURCES = libip6tc.c
-libip6tc_la_LDFLAGS = -version-info 1:0:1 ${libiptc_LDFLAGS2}
+libip6tc_la_LDFLAGS = -version-info 2:0:0 ${libiptc_LDFLAGS2}
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index f16dacbb73fe1..6b5f4234d08b8 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -2753,11 +2753,15 @@  TC_STRERROR(int err)
 
 const struct xtc_ops TC_OPS = {
 	.commit        = TC_COMMIT,
+	.init          = TC_INIT,
 	.free          = TC_FREE,
 	.builtin       = TC_BUILTIN,
 	.is_chain      = TC_IS_CHAIN,
 	.flush_entries = TC_FLUSH_ENTRIES,
 	.create_chain  = TC_CREATE_CHAIN,
+	.first_chain   = TC_FIRST_CHAIN,
+	.next_chain    = TC_NEXT_CHAIN,
+	.get_policy    = TC_GET_POLICY,
 	.set_policy    = TC_SET_POLICY,
 	.strerror      = TC_STRERROR,
 };