From 1757ec846419c76da4e104f9675b40e05ac3eee6 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 22 Jul 2011 12:11:03 +0200 Subject: extensions: use multi-target registration Signed-off-by: Jan Engelhardt --- extensions/libxt_TCPMSS.c | 56 +++++++++++++++++++++++------------------------ extensions/libxt_TEE.c | 56 +++++++++++++++++++++++------------------------ 2 files changed, 56 insertions(+), 56 deletions(-) (limited to 'extensions') diff --git a/extensions/libxt_TCPMSS.c b/extensions/libxt_TCPMSS.c index 2266326d..48ab0445 100644 --- a/extensions/libxt_TCPMSS.c +++ b/extensions/libxt_TCPMSS.c @@ -91,36 +91,36 @@ static void TCPMSS_save(const void *ip, const struct xt_entry_target *target) printf(" --set-mss %u", mssinfo->mss); } -static struct xtables_target tcpmss_target = { - .family = NFPROTO_IPV4, - .name = "TCPMSS", - .version = XTABLES_VERSION, - .size = XT_ALIGN(sizeof(struct xt_tcpmss_info)), - .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)), - .help = TCPMSS_help, - .print = TCPMSS_print, - .save = TCPMSS_save, - .x6_parse = TCPMSS_parse, - .x6_fcheck = TCPMSS_check, - .x6_options = TCPMSS4_opts, -}; - -static struct xtables_target tcpmss_target6 = { - .family = NFPROTO_IPV6, - .name = "TCPMSS", - .version = XTABLES_VERSION, - .size = XT_ALIGN(sizeof(struct xt_tcpmss_info)), - .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)), - .help = TCPMSS_help6, - .print = TCPMSS_print, - .save = TCPMSS_save, - .x6_parse = TCPMSS_parse, - .x6_fcheck = TCPMSS_check, - .x6_options = TCPMSS6_opts, +static struct xtables_target tcpmss_tg_reg[] = { + { + .family = NFPROTO_IPV4, + .name = "TCPMSS", + .version = XTABLES_VERSION, + .size = XT_ALIGN(sizeof(struct xt_tcpmss_info)), + .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)), + .help = TCPMSS_help, + .print = TCPMSS_print, + .save = TCPMSS_save, + .x6_parse = TCPMSS_parse, + .x6_fcheck = TCPMSS_check, + .x6_options = TCPMSS4_opts, + }, + { + .family = NFPROTO_IPV6, + .name = "TCPMSS", + .version = XTABLES_VERSION, + .size = XT_ALIGN(sizeof(struct xt_tcpmss_info)), + .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)), + .help = TCPMSS_help6, + .print = TCPMSS_print, + .save = TCPMSS_save, + .x6_parse = TCPMSS_parse, + .x6_fcheck = TCPMSS_check, + .x6_options = TCPMSS6_opts, + }, }; void _init(void) { - xtables_register_target(&tcpmss_target); - xtables_register_target(&tcpmss_target6); + xtables_register_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg)); } diff --git a/extensions/libxt_TEE.c b/extensions/libxt_TEE.c index c89e5809..92c7601c 100644 --- a/extensions/libxt_TEE.c +++ b/extensions/libxt_TEE.c @@ -92,36 +92,36 @@ static void tee_tg6_save(const void *ip, const struct xt_entry_target *target) printf(" --oif %s", info->oif); } -static struct xtables_target tee_tg_reg = { - .name = "TEE", - .version = XTABLES_VERSION, - .revision = 1, - .family = NFPROTO_IPV4, - .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .help = tee_tg_help, - .print = tee_tg_print, - .save = tee_tg_save, - .x6_parse = xtables_option_parse, - .x6_options = tee_tg_opts, -}; - -static struct xtables_target tee_tg6_reg = { - .name = "TEE", - .version = XTABLES_VERSION, - .revision = 1, - .family = NFPROTO_IPV6, - .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .help = tee_tg_help, - .print = tee_tg6_print, - .save = tee_tg6_save, - .x6_parse = xtables_option_parse, - .x6_options = tee_tg_opts, +static struct xtables_target tee_tg_reg[] = { + { + .name = "TEE", + .version = XTABLES_VERSION, + .revision = 1, + .family = NFPROTO_IPV4, + .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .help = tee_tg_help, + .print = tee_tg_print, + .save = tee_tg_save, + .x6_parse = xtables_option_parse, + .x6_options = tee_tg_opts, + }, + { + .name = "TEE", + .version = XTABLES_VERSION, + .revision = 1, + .family = NFPROTO_IPV6, + .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .help = tee_tg_help, + .print = tee_tg6_print, + .save = tee_tg6_save, + .x6_parse = xtables_option_parse, + .x6_options = tee_tg_opts, + }, }; void _init(void) { - xtables_register_target(&tee_tg_reg); - xtables_register_target(&tee_tg6_reg); + xtables_register_targets(tee_tg_reg, ARRAY_SIZE(tee_tg_reg)); } -- cgit v1.2.3 From 4d8656ad9d0afd04820f125a85a7b673c7e74fe6 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 22 Jul 2011 12:25:43 +0200 Subject: libxt_TCPMSS: restore build with IPv6-less libcs Commit v1.4.10-149-gea2a02f added an netinet/ip6.h include, which is not available on systems without IPv6 header files. Signed-off-by: Jan Engelhardt --- extensions/GNUmakefile.in | 2 +- extensions/libxt_TCPMSS.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'extensions') diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in index fbaf2eca..2b48d841 100644 --- a/extensions/GNUmakefile.in +++ b/extensions/GNUmakefile.in @@ -21,7 +21,7 @@ regular_CPPFLAGS := @regular_CPPFLAGS@ kinclude_CPPFLAGS := @kinclude_CPPFLAGS@ AM_CFLAGS := ${regular_CFLAGS} -AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include ${kinclude_CPPFLAGS} +AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include ${kinclude_CPPFLAGS} AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ ifeq (${V},) diff --git a/extensions/libxt_TCPMSS.c b/extensions/libxt_TCPMSS.c index 48ab0445..4b71e44a 100644 --- a/extensions/libxt_TCPMSS.c +++ b/extensions/libxt_TCPMSS.c @@ -2,10 +2,10 @@ * * Copyright (c) 2000 Marc Boucher */ +#include "config.h" #include #include #include -#include #include enum { @@ -34,7 +34,7 @@ static void TCPMSS_help(void) static void TCPMSS_help6(void) { - __TCPMSS_help(sizeof(struct ip6_hdr)); + __TCPMSS_help(SIZEOF_STRUCT_IP6_HDR); } static const struct xt_option_entry TCPMSS4_opts[] = { @@ -47,7 +47,7 @@ static const struct xt_option_entry TCPMSS4_opts[] = { static const struct xt_option_entry TCPMSS6_opts[] = { {.name = "set-mss", .id = O_SET_MSS, .type = XTTYPE_UINT16, - .min = 0, .max = UINT16_MAX - sizeof(struct ip6_hdr), + .min = 0, .max = UINT16_MAX - SIZEOF_STRUCT_IP6_HDR, .flags = XTOPT_PUT, XTOPT_POINTER(struct xt_tcpmss_info, mss)}, {.name = "clamp-mss-to-pmtu", .id = O_CLAMP_MSS, .type = XTTYPE_NONE}, XTOPT_TABLEEND, -- cgit v1.2.3 From 67156c0b9a3d35f5e7836e5683d8ca0b46ac36ca Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 1 Aug 2011 20:08:42 +0200 Subject: libxt_string: define _GNU_SOURCE for strnlen On RHEL-5.6 and clones with its gcc-4.1.2 and glibc-2.5: libxt_string.c: In function "parse_string": libxt_string.c:84: warning: implicit declaration of function "strnlen" Signed-off-by: Jan Engelhardt --- extensions/libxt_string.c | 1 + 1 file changed, 1 insertion(+) (limited to 'extensions') diff --git a/extensions/libxt_string.c b/extensions/libxt_string.c index eef0b081..8cee3359 100644 --- a/extensions/libxt_string.c +++ b/extensions/libxt_string.c @@ -20,6 +20,7 @@ * updated to work with slightly modified * ipt_string_info. */ +#define _GNU_SOURCE 1 /* strnlen for older glibcs */ #include #include #include -- cgit v1.2.3