aboutsummaryrefslogtreecommitdiffstats
path: root/extensions/libip6t_REDIRECT.c
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2017-03-24 06:34:41 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-24 06:34:41 +0000
commit3c9546c0d95e649f59e239b9a20ef398eb553774 (patch)
tree4400fe0ba9baae676633293796954b4061726d5d /extensions/libip6t_REDIRECT.c
parent70bc36c5ebb934f094bd2135d0ff14280bcef024 (diff)
parente20d6bf62b07e455e15b3d8982fb83dc99b9e564 (diff)
downloadplatform_external_iptables-3c9546c0d95e649f59e239b9a20ef398eb553774.tar.gz
platform_external_iptables-3c9546c0d95e649f59e239b9a20ef398eb553774.tar.bz2
platform_external_iptables-3c9546c0d95e649f59e239b9a20ef398eb553774.zip
Merge changes from topic 'iptables-1.6.1' am: c784fc47e6 am: ff45753ae3
am: e20d6bf62b Change-Id: I7f42039a088b89201367df2b0a926fcd88987776
Diffstat (limited to 'extensions/libip6t_REDIRECT.c')
-rw-r--r--extensions/libip6t_REDIRECT.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/extensions/libip6t_REDIRECT.c b/extensions/libip6t_REDIRECT.c
index 1724aa67..8e04d2cd 100644
--- a/extensions/libip6t_REDIRECT.c
+++ b/extensions/libip6t_REDIRECT.c
@@ -132,6 +132,24 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
}
}
+static int REDIRECT_xlate(struct xt_xlate *xl,
+ const struct xt_xlate_tg_params *params)
+{
+ const struct nf_nat_range *range = (const void *)params->target->data;
+
+ if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
+ xt_xlate_add(xl, "redirect to :%hu",
+ ntohs(range->min_proto.tcp.port));
+ if (range->max_proto.tcp.port != range->min_proto.tcp.port)
+ xt_xlate_add(xl, "-%hu ",
+ ntohs(range->max_proto.tcp.port));
+ if (range->flags & NF_NAT_RANGE_PROTO_RANDOM)
+ xt_xlate_add(xl, " random ");
+ }
+
+ return 1;
+}
+
static struct xtables_target redirect_tg_reg = {
.name = "REDIRECT",
.version = XTABLES_VERSION,
@@ -143,6 +161,7 @@ static struct xtables_target redirect_tg_reg = {
.print = REDIRECT_print,
.save = REDIRECT_save,
.x6_options = REDIRECT_opts,
+ .xlate = REDIRECT_xlate,
};
void _init(void)