mbox series

[iptables,0/2] Review xtables.h vs. xshared.h

Message ID 20220611100742.4888-1-phil@nwl.cc
Headers show
Series Review xtables.h vs. xshared.h | expand

Message

Phil Sutter June 11, 2022, 10:07 a.m. UTC
I didn't like how libxtables has to include xshared.h from iptables code
base, this series eliminates this:

* struct xtables_afinfo is used to hold family-specific configuration.
  There are static const instances in libxtables and
  xtables_set_nfproto() mangles the public 'afinfo' pointer. This is all
  libxtables code, so move the struct definition and pointer declaration
  into xtables.h (patch 1).

* XT_OPTION_OFFSET_SCALE is the base distance between different
  extensions' offset values. It is mostly used by libxtables when
  merging options and referenced by xshared.c for sanity checking only.
  Patch 2 moves it into xtables.h (and turns the single value enum into
  a define).

To avoid impact on external libxtables users, guard both changes above
by XTABLES_INTERNAL. Without access to xshared.h, external extensions
can't have made use of afinfo or XT_OPTION_OFFSET_SCALE yet.

Phil Sutter (2):
  libxtables: Move struct xtables_afinfo into xtables.h
  libxtables: Define XT_OPTION_OFFSET_SCALE in xtables.h

 extensions/libxt_set.c |  6 ++++++
 extensions/libxt_set.h |  1 -
 include/xtables.h      | 25 +++++++++++++++++++++++++
 iptables/xshared.h     | 26 --------------------------
 libxtables/xtables.c   |  1 -
 libxtables/xtoptions.c |  1 -
 6 files changed, 31 insertions(+), 29 deletions(-)