From dacafa55379fd98212031d8c559096c91d7ce93b Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 27 Jan 2009 20:56:23 +0100 Subject: libxtables: prefix/order - program_name Split XTABLES_VERSION into xtables and iptables, and encode the xtables soversion into the extensions instead. This makes it possible to upgrade iptables without having to recompile 3rd-party extensions (if the libxtables version matches, of course). Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 13 ++++++++----- include/xtables/internal.h | 34 ---------------------------------- include/xtables/internal.h.in | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 39 deletions(-) delete mode 100644 include/xtables/internal.h create mode 100644 include/xtables/internal.h.in (limited to 'include') diff --git a/include/xtables.h.in b/include/xtables.h.in index f372d334..e1f9c926 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -1,6 +1,11 @@ #ifndef _XTABLES_H #define _XTABLES_H +/* + * Changing any structs/functions may incur a needed change + * in libxtables_vcurrent/vage too. + */ + #include /* PF_* */ #include #include @@ -20,10 +25,8 @@ #define IPPROTO_UDPLITE 136 #endif -#define XTABLES_VERSION "@PACKAGE_VERSION@" -#define XTABLES_VERSION_CODE (0x10000 * @XTABLES_VERSION_MAJOR@ + 0x100 * @XTABLES_VERSION_MINOR@ + @XTABLES_VERSION_PATCH@) - -#define XTABLES_API_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) +#define XTABLES_VERSION "libxtables.so.@libxtables_vmajor@" +#define XTABLES_VERSION_CODE @libxtables_vmajor@ struct in_addr; @@ -155,6 +158,7 @@ enum xtables_tryload { XTF_LOAD_MUST_SUCCEED, }; +extern const char *xtables_program_name; extern const char *xtables_modprobe_program; extern struct xtables_match *xtables_matches; extern struct xtables_target *xtables_targets; @@ -202,7 +206,6 @@ int check_inverse(const char option[], int *invert, int *my_optind, int argc); void exit_error(enum exittype, const char *, ...)__attribute__((noreturn, format(printf,2,3))); extern void param_act(unsigned int, const char *, ...); -extern const char *program_name, *program_version; extern const char *ipaddr_to_numeric(const struct in_addr *); extern const char *ipaddr_to_anyname(const struct in_addr *); diff --git a/include/xtables/internal.h b/include/xtables/internal.h deleted file mode 100644 index 21c4401f..00000000 --- a/include/xtables/internal.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _XTABLES_INTERNAL_H -#define _XTABLES_INTERNAL_H 1 - -#ifndef XT_LIB_DIR -# define XT_LIB_DIR "/usr/local/lib/iptables" -#endif - -/* protocol family dependent informations */ -struct afinfo { - /* protocol family */ - int family; - - /* prefix of library name (ex "libipt_" */ - char *libprefix; - - /* used by setsockopt (ex IPPROTO_IP */ - int ipproto; - - /* kernel module (ex "ip_tables" */ - char *kmod; - - /* optname to check revision support of match */ - int so_rev_match; - - /* optname to check revision support of match */ - int so_rev_target; -}; - -/* This is decleared in ip[6]tables.c */ -extern struct afinfo afinfo; - -extern void _init(void); - -#endif /* _XTABLES_INTERNAL_H */ diff --git a/include/xtables/internal.h.in b/include/xtables/internal.h.in new file mode 100644 index 00000000..21438290 --- /dev/null +++ b/include/xtables/internal.h.in @@ -0,0 +1,41 @@ +#ifndef _XTABLES_INTERNAL_H +#define _XTABLES_INTERNAL_H 1 + +#define IPTABLES_VERSION "@PACKAGE_VERSION@" + +#ifndef XT_LIB_DIR +# define XT_LIB_DIR "/usr/local/lib/iptables" +#endif + +/* protocol family dependent informations */ +struct afinfo { + /* protocol family */ + int family; + + /* prefix of library name (ex "libipt_" */ + char *libprefix; + + /* used by setsockopt (ex IPPROTO_IP */ + int ipproto; + + /* kernel module (ex "ip_tables" */ + char *kmod; + + /* optname to check revision support of match */ + int so_rev_match; + + /* optname to check revision support of match */ + int so_rev_target; +}; + +/* This is decleared in ip[6]tables.c */ +extern struct afinfo afinfo; + +/** + * Program's own name and version. + */ +extern const char *program_name, *program_version; + +extern void _init(void); + +#endif /* _XTABLES_INTERNAL_H */ -- cgit v1.2.3