/extensions/targets?.man
/include/xtables.h
+/include/xtables/internal.h
/aclocal.m4
/autom4te*.cache
lib_LTLIBRARIES = libxtables.la
libxtables_la_SOURCES = xtables.c
-libxtables_la_LDFLAGS = -version-info 1:0:0
+libxtables_la_LDFLAGS = -version-info ${libxtables_vcurrent}:0:${libxtables_vage}
# iptables, dynamic
iptables_SOURCES = iptables-standalone.c iptables.c
-define([_XTABLES_VERSION_MAJOR], 1)
-define([_XTABLES_VERSION_MINOR], 4)
-define([_XTABLES_VERSION_PATCH], 3)
-define([_XTABLES_VERSION_EXTRA], -rc1)
-define([_XTABLES_VERSION],_XTABLES_VERSION_MAJOR._XTABLES_VERSION_MINOR._XTABLES_VERSION_PATCH[]_XTABLES_VERSION_EXTRA)
+AC_INIT([iptables], [1.4.3-rc1])
+
+# See libtool.info "Libtool's versioning system"
+libxtables_vcurrent=1
+libxtables_vage=0
-AC_INIT([iptables], _XTABLES_VERSION)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_INSTALL
AC_SUBST([ksourcedir])
AC_SUBST([xtlibdir])
AC_SUBST([pkgconfigdir])
-
-XTABLES_VERSION_MAJOR=_XTABLES_VERSION_MAJOR
-XTABLES_VERSION_MINOR=_XTABLES_VERSION_MINOR
-XTABLES_VERSION_PATCH=_XTABLES_VERSION_PATCH
-XTABLES_VERSION_EXTRA=_XTABLES_VERSION_EXTRA
-AC_SUBST([XTABLES_VERSION_MAJOR])
-AC_SUBST([XTABLES_VERSION_MINOR])
-AC_SUBST([XTABLES_VERSION_PATCH])
-AC_SUBST([XTABLES_VERSION_EXTRA])
+AC_SUBST([libxtables_vcurrent])
+AC_SUBST([libxtables_vage])
+libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
+AC_SUBST([libxtables_vmajor])
AC_CONFIG_FILES([Makefile extensions/GNUmakefile libipq/Makefile
- include/xtables.h xtables.pc])
+ include/xtables.h include/xtables/internal.h xtables.pc])
AC_OUTPUT
#ifndef _XTABLES_H
#define _XTABLES_H
+/*
+ * Changing any structs/functions may incur a needed change
+ * in libxtables_vcurrent/vage too.
+ */
+
#include <sys/socket.h> /* PF_* */
#include <sys/types.h>
#include <stdbool.h>
#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;
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;
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 *);
#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
/* 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 */
int in_table = 0, testing = 0;
program_name = "ip6tables-restore";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
line = 0;
+ xtables_program_name = program_name;
xtables_init();
#ifdef NO_SHARED_LIBS
init_extensions();
break;
case 'h':
print_usage("ip6tables-restore",
- XTABLES_VERSION);
+ IPTABLES_VERSION);
break;
case 'n':
noflush = 1;
time_t now = time(NULL);
printf("# Generated by ip6tables-save v%s on %s",
- XTABLES_VERSION, ctime(&now));
+ IPTABLES_VERSION, ctime(&now));
printf("*%s\n", tablename);
/* Dump out chain names first,
int c;
program_name = "ip6tables-save";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
+ xtables_program_name = program_name;
xtables_init();
#ifdef NO_SHARED_LIBS
init_extensions();
struct ip6tc_handle *handle = NULL;
program_name = "ip6tables";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
+ xtables_program_name = program_name;
xtables_init();
#ifdef NO_SHARED_LIBS
init_extensions();
const char *tablename = NULL;
program_name = "iptables-restore";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
line = 0;
+ xtables_program_name = program_name;
xtables_init();
#ifdef NO_SHARED_LIBS
init_extensions();
break;
case 'h':
print_usage("iptables-restore",
- XTABLES_VERSION);
+ IPTABLES_VERSION);
break;
case 'n':
noflush = 1;
time_t now = time(NULL);
printf("# Generated by iptables-save v%s on %s",
- XTABLES_VERSION, ctime(&now));
+ IPTABLES_VERSION, ctime(&now));
printf("*%s\n", tablename);
/* Dump out chain names first,
int c;
program_name = "iptables-save";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
+ xtables_program_name = program_name;
xtables_init();
#ifdef NO_SHARED_LIBS
init_extensions();
struct iptc_handle *handle = NULL;
program_name = "iptables";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
+ xtables_program_name = program_name;
xtables_init();
#ifdef NO_SHARED_LIBS
init_extensions();
FILE *in;
program_name = "iptables-xml";
- program_version = XTABLES_VERSION;
+ program_version = IPTABLES_VERSION;
line = 0;
while ((c = getopt_long(argc, argv, "cvh", options, NULL)) != -1) {
verbose = 1;
break;
case 'h':
- print_usage("iptables-xml", XTABLES_VERSION);
+ print_usage("iptables-xml", IPTABLES_VERSION);
break;
}
}
#define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe"
#endif
+/**
+ * Program will set this to its own name.
+ */
+const char *xtables_program_name;
+
/* Search path for Xtables .so files */
static const char *xtables_libdir;
{
struct xtables_match **i, *old;
- if (strcmp(me->version, program_version) != 0) {
- fprintf(stderr, "%s: match `%s' v%s (I'm v%s).\n",
- program_name, me->name, me->version, program_version);
+ if (strcmp(me->version, XTABLES_VERSION) != 0) {
+ fprintf(stderr, "%s: match \"%s\" has version \"%s\", "
+ "but \"%s\" is required.\n",
+ xtables_program_name, me->name,
+ me->version, XTABLES_VERSION);
exit(1);
}
/* Revision field stole a char from name. */
if (strlen(me->name) >= XT_FUNCTION_MAXNAMELEN-1) {
fprintf(stderr, "%s: target `%s' has invalid name\n",
- program_name, me->name);
+ xtables_program_name, me->name);
exit(1);
}
if (me->family >= NPROTO) {
fprintf(stderr,
"%s: BUG: match %s has invalid protocol family\n",
- program_name, me->name);
+ xtables_program_name, me->name);
exit(1);
}
old->family == me->family) {
fprintf(stderr,
"%s: match `%s' already registered.\n",
- program_name, me->name);
+ xtables_program_name, me->name);
exit(1);
}
if (me->size != XT_ALIGN(me->size)) {
fprintf(stderr, "%s: match `%s' has invalid size %u.\n",
- program_name, me->name, (unsigned int)me->size);
+ xtables_program_name, me->name, (unsigned int)me->size);
exit(1);
}
{
struct xtables_target *old;
- if (strcmp(me->version, program_version) != 0) {
- fprintf(stderr, "%s: target `%s' v%s (I'm v%s).\n",
- program_name, me->name, me->version, program_version);
+ if (strcmp(me->version, XTABLES_VERSION) != 0) {
+ fprintf(stderr, "%s: target \"%s\" has version \"%s\", "
+ "but \"%s\" is required.\n",
+ xtables_program_name, me->name,
+ me->version, XTABLES_VERSION);
exit(1);
}
/* Revision field stole a char from name. */
if (strlen(me->name) >= XT_FUNCTION_MAXNAMELEN-1) {
fprintf(stderr, "%s: target `%s' has invalid name\n",
- program_name, me->name);
+ xtables_program_name, me->name);
exit(1);
}
if (me->family >= NPROTO) {
fprintf(stderr,
"%s: BUG: target %s has invalid protocol family\n",
- program_name, me->name);
+ xtables_program_name, me->name);
exit(1);
}
old->family == me->family) {
fprintf(stderr,
"%s: target `%s' already registered.\n",
- program_name, me->name);
+ xtables_program_name, me->name);
exit(1);
}
if (me->size != XT_ALIGN(me->size)) {
fprintf(stderr, "%s: target `%s' has invalid size %u.\n",
- program_name, me->name, (unsigned int)me->size);
+ xtables_program_name, me->name, (unsigned int)me->size);
exit(1);
}