Commit 706c32c9 authored by Arturo Borrero Gonzalez's avatar Arturo Borrero Gonzalez
Browse files

Update upstream source from tag 'upstream/1.6.2'

Update to upstream version '1.6.2'
with Debian dir 709e57568379856beca5301ab2678ceffca94a99
parents a82b926a 5beab31f
iptables-translate -A INPUT -m ecn --ecn-ip-ect 0
nft add rule ip filter INPUT ip ecn not-ect counter
iptables-translate -A INPUT -m ecn --ecn-ip-ect 1
nft add rule ip filter INPUT ip ecn ect1 counter
iptables-translate -A INPUT -m ecn --ecn-ip-ect 2
nft add rule ip filter INPUT ip ecn ect0 counter
iptables-translate -A INPUT -m ecn --ecn-ip-ect 3
nft add rule ip filter INPUT ip ecn ce counter
iptables-translate -A INPUT -m ecn ! --ecn-ip-ect 0
nft add rule ip filter INPUT ip ecn != not-ect counter
iptables-translate -A INPUT -m ecn ! --ecn-ip-ect 1
nft add rule ip filter INPUT ip ecn != ect1 counter
iptables-translate -A INPUT -m ecn ! --ecn-ip-ect 2
nft add rule ip filter INPUT ip ecn != ect0 counter
iptables-translate -A INPUT -m ecn ! --ecn-ip-ect 3
nft add rule ip filter INPUT ip ecn != ce counter
iptables-translate -A FORWARD -p esp -j ACCEPT
nft add rule ip filter FORWARD ip protocol esp counter accept
iptables-translate -A INPUT --in-interface wan --protocol esp -j ACCEPT
nft add rule ip filter INPUT iifname wan ip protocol esp counter accept
iptables-translate -A INPUT -p 50 -m esp --espspi 500 -j DROP
nft add rule ip filter INPUT esp spi 500 counter drop
iptables-translate -A INPUT -p 50 -m esp --espspi 500:600 -j DROP
nft add rule ip filter INPUT esp spi 500-600 counter drop
......@@ -11,10 +11,11 @@
* Error corections by nmalykh@bilim.com (22.01.2005)
*/
#define _BSD_SOURCE 1
#define _DEFAULT_SOURCE 1
#define _ISOC99_SOURCE 1
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -68,10 +69,13 @@ enum {
O_HTABLE_MAX,
O_HTABLE_GCINT,
O_HTABLE_EXPIRE,
O_RATEMATCH,
O_INTERVAL,
F_BURST = 1 << O_BURST,
F_UPTO = 1 << O_UPTO,
F_ABOVE = 1 << O_ABOVE,
F_HTABLE_EXPIRE = 1 << O_HTABLE_EXPIRE,
F_RATEMATCH = 1 << O_RATEMATCH,
};
static void hashlimit_mt_help(void)
......@@ -95,6 +99,29 @@ static void hashlimit_mt_help(void)
"\n", XT_HASHLIMIT_BURST);
}
static void hashlimit_mt_help_v3(void)
{
printf(
"hashlimit match options:\n"
" --hashlimit-upto <avg> max average match rate\n"
" [Packets per second unless followed by \n"
" /sec /minute /hour /day postfixes]\n"
" --hashlimit-above <avg> min average match rate\n"
" --hashlimit-mode <mode> mode is a comma-separated list of\n"
" dstip,srcip,dstport,srcport (or none)\n"
" --hashlimit-srcmask <length> source address grouping prefix length\n"
" --hashlimit-dstmask <length> destination address grouping prefix length\n"
" --hashlimit-name <name> name for /proc/net/ipt_hashlimit\n"
" --hashlimit-burst <num> number to match in a burst, default %u\n"
" --hashlimit-htable-size <num> number of hashtable buckets\n"
" --hashlimit-htable-max <num> number of hashtable entries\n"
" --hashlimit-htable-gcinterval interval between garbage collection runs\n"
" --hashlimit-htable-expire after which time are idle entries expired?\n"
" --hashlimit-rate-match rate match the flow without rate-limiting it\n"
" --hashlimit-rate-interval interval in seconds for hashlimit-rate-match\n"
"\n", XT_HASHLIMIT_BURST);
}
#define s struct xt_hashlimit_info
static const struct xt_option_entry hashlimit_opts[] = {
{.name = "hashlimit", .id = O_UPTO, .excl = F_ABOVE,
......@@ -153,6 +180,35 @@ static const struct xt_option_entry hashlimit_mt_opts_v1[] = {
#undef s
#define s struct xt_hashlimit_mtinfo2
static const struct xt_option_entry hashlimit_mt_opts_v2[] = {
{.name = "hashlimit-upto", .id = O_UPTO, .excl = F_ABOVE,
.type = XTTYPE_STRING, .flags = XTOPT_INVERT},
{.name = "hashlimit-above", .id = O_ABOVE, .excl = F_UPTO,
.type = XTTYPE_STRING, .flags = XTOPT_INVERT},
{.name = "hashlimit", .id = O_UPTO, .excl = F_ABOVE,
.type = XTTYPE_STRING, .flags = XTOPT_INVERT}, /* old name */
{.name = "hashlimit-srcmask", .id = O_SRCMASK, .type = XTTYPE_PLEN},
{.name = "hashlimit-dstmask", .id = O_DSTMASK, .type = XTTYPE_PLEN},
{.name = "hashlimit-burst", .id = O_BURST, .type = XTTYPE_STRING},
{.name = "hashlimit-htable-size", .id = O_HTABLE_SIZE,
.type = XTTYPE_UINT32, .flags = XTOPT_PUT,
XTOPT_POINTER(s, cfg.size)},
{.name = "hashlimit-htable-max", .id = O_HTABLE_MAX,
.type = XTTYPE_UINT32, .flags = XTOPT_PUT,
XTOPT_POINTER(s, cfg.max)},
{.name = "hashlimit-htable-gcinterval", .id = O_HTABLE_GCINT,
.type = XTTYPE_UINT32, .flags = XTOPT_PUT,
XTOPT_POINTER(s, cfg.gc_interval)},
{.name = "hashlimit-htable-expire", .id = O_HTABLE_EXPIRE,
.type = XTTYPE_UINT32, .flags = XTOPT_PUT,
XTOPT_POINTER(s, cfg.expire)},
{.name = "hashlimit-mode", .id = O_MODE, .type = XTTYPE_STRING},
{.name = "hashlimit-name", .id = O_NAME, .type = XTTYPE_STRING,
.flags = XTOPT_MAND | XTOPT_PUT, XTOPT_POINTER(s, name), .min = 1},
};
#undef s
#define s struct xt_hashlimit_mtinfo3
static const struct xt_option_entry hashlimit_mt_opts[] = {
{.name = "hashlimit-upto", .id = O_UPTO, .excl = F_ABOVE,
.type = XTTYPE_STRING, .flags = XTOPT_INVERT},
......@@ -178,12 +234,14 @@ static const struct xt_option_entry hashlimit_mt_opts[] = {
{.name = "hashlimit-mode", .id = O_MODE, .type = XTTYPE_STRING},
{.name = "hashlimit-name", .id = O_NAME, .type = XTTYPE_STRING,
.flags = XTOPT_MAND | XTOPT_PUT, XTOPT_POINTER(s, name), .min = 1},
{.name = "hashlimit-rate-match", .id = O_RATEMATCH, .type = XTTYPE_NONE},
{.name = "hashlimit-rate-interval", .id = O_INTERVAL, .type = XTTYPE_STRING},
XTOPT_TABLEEND,
};
#undef s
static int
cfg_copy(struct hashlimit_cfg2 *to, const void *from, int revision)
cfg_copy(struct hashlimit_cfg3 *to, const void *from, int revision)
{
if (revision == 1) {
struct hashlimit_cfg1 *cfg = (struct hashlimit_cfg1 *)from;
......@@ -198,7 +256,19 @@ cfg_copy(struct hashlimit_cfg2 *to, const void *from, int revision)
to->srcmask = cfg->srcmask;
to->dstmask = cfg->dstmask;
} else if (revision == 2) {
memcpy(to, from, sizeof(struct hashlimit_cfg2));
struct hashlimit_cfg2 *cfg = (struct hashlimit_cfg2 *)from;
to->mode = cfg->mode;
to->avg = cfg->avg;
to->burst = cfg->burst;
to->size = cfg->size;
to->max = cfg->max;
to->gc_interval = cfg->gc_interval;
to->expire = cfg->expire;
to->srcmask = cfg->srcmask;
to->dstmask = cfg->dstmask;
} else if (revision == 3) {
memcpy(to, from, sizeof(struct hashlimit_cfg3));
} else {
return -EINVAL;
}
......@@ -262,7 +332,7 @@ static uint64_t parse_burst(const char *burst, int revision)
if (v > max)
xtables_error(PARAMETER_PROBLEM, "bad value for option "
"\"--hashlimit-burst\", value \"%s\" too large "
"(max %lumb).", burst, max/1024/1024);
"(max %"PRIu64"mb).", burst, max/1024/1024);
return v;
}
......@@ -285,8 +355,8 @@ static bool parse_bytes(const char *rate, void *val, struct hashlimit_mt_udata *
tmp = (uint64_t) r * factor;
if (tmp > max)
xtables_error(PARAMETER_PROBLEM,
"Rate value too large \"%llu\" (max %lu)\n",
(unsigned long long)tmp, max);
"Rate value too large \"%"PRIu64"\" (max %"PRIu64")\n",
tmp, max);
tmp = bytes_to_cost(tmp);
if (tmp == 0)
......@@ -346,6 +416,16 @@ int parse_rate(const char *rate, void *val, struct hashlimit_mt_udata *ud, int r
return 1;
}
static int parse_interval(const char *rate, uint32_t *val)
{
int r = atoi(rate);
if (r <= 0)
return 0;
*val = r;
return 1;
}
static void hashlimit_init(struct xt_entry_match *m)
{
struct xt_hashlimit_info *r = (struct xt_hashlimit_info *)m->data;
......@@ -377,7 +457,7 @@ static void hashlimit_mt6_init_v1(struct xt_entry_match *match)
info->cfg.dstmask = 128;
}
static void hashlimit_mt4_init(struct xt_entry_match *match)
static void hashlimit_mt4_init_v2(struct xt_entry_match *match)
{
struct xt_hashlimit_mtinfo2 *info = (void *)match->data;
......@@ -388,7 +468,7 @@ static void hashlimit_mt4_init(struct xt_entry_match *match)
info->cfg.dstmask = 32;
}
static void hashlimit_mt6_init(struct xt_entry_match *match)
static void hashlimit_mt6_init_v2(struct xt_entry_match *match)
{
struct xt_hashlimit_mtinfo2 *info = (void *)match->data;
......@@ -399,6 +479,30 @@ static void hashlimit_mt6_init(struct xt_entry_match *match)
info->cfg.dstmask = 128;
}
static void hashlimit_mt4_init(struct xt_entry_match *match)
{
struct xt_hashlimit_mtinfo3 *info = (void *)match->data;
info->cfg.mode = 0;
info->cfg.burst = XT_HASHLIMIT_BURST;
info->cfg.gc_interval = XT_HASHLIMIT_GCINTERVAL;
info->cfg.srcmask = 32;
info->cfg.dstmask = 32;
info->cfg.interval = 0;
}
static void hashlimit_mt6_init(struct xt_entry_match *match)
{
struct xt_hashlimit_mtinfo3 *info = (void *)match->data;
info->cfg.mode = 0;
info->cfg.burst = XT_HASHLIMIT_BURST;
info->cfg.gc_interval = XT_HASHLIMIT_GCINTERVAL;
info->cfg.srcmask = 128;
info->cfg.dstmask = 128;
info->cfg.interval = 0;
}
/* Parse a 'mode' parameter into the required bitmask */
static int parse_mode(uint32_t *mode, const char *option_arg)
{
......@@ -488,7 +592,7 @@ static void hashlimit_mt_parse_v1(struct xt_option_call *cb)
}
}
static void hashlimit_mt_parse(struct xt_option_call *cb)
static void hashlimit_mt_parse_v2(struct xt_option_call *cb)
{
struct xt_hashlimit_mtinfo2 *info = cb->data;
......@@ -529,6 +633,54 @@ static void hashlimit_mt_parse(struct xt_option_call *cb)
}
}
static void hashlimit_mt_parse(struct xt_option_call *cb)
{
struct xt_hashlimit_mtinfo3 *info = cb->data;
xtables_option_parse(cb);
switch (cb->entry->id) {
case O_BURST:
info->cfg.burst = parse_burst(cb->arg, 2);
break;
case O_UPTO:
if (cb->invert)
info->cfg.mode |= XT_HASHLIMIT_INVERT;
if (parse_bytes(cb->arg, &info->cfg.avg, cb->udata, 2))
info->cfg.mode |= XT_HASHLIMIT_BYTES;
else if (!parse_rate(cb->arg, &info->cfg.avg, cb->udata, 2))
xtables_param_act(XTF_BAD_VALUE, "hashlimit",
"--hashlimit-upto", cb->arg);
break;
case O_ABOVE:
if (!cb->invert)
info->cfg.mode |= XT_HASHLIMIT_INVERT;
if (parse_bytes(cb->arg, &info->cfg.avg, cb->udata, 2))
info->cfg.mode |= XT_HASHLIMIT_BYTES;
else if (!parse_rate(cb->arg, &info->cfg.avg, cb->udata, 2))
xtables_param_act(XTF_BAD_VALUE, "hashlimit",
"--hashlimit-above", cb->arg);
break;
case O_MODE:
if (parse_mode(&info->cfg.mode, cb->arg) < 0)
xtables_param_act(XTF_BAD_VALUE, "hashlimit",
"--hashlimit-mode", cb->arg);
break;
case O_SRCMASK:
info->cfg.srcmask = cb->val.hlen;
break;
case O_DSTMASK:
info->cfg.dstmask = cb->val.hlen;
break;
case O_RATEMATCH:
info->cfg.mode |= XT_HASHLIMIT_RATE_MATCH;
break;
case O_INTERVAL:
if (!parse_interval(cb->arg, &info->cfg.interval))
xtables_param_act(XTF_BAD_VALUE, "hashlimit",
"--hashlimit-rate-interval", cb->arg);
}
}
static void hashlimit_check(struct xt_fcheck_call *cb)
{
const struct hashlimit_mt_udata *udata = cb->udata;
......@@ -557,7 +709,8 @@ static void hashlimit_mt_check_v1(struct xt_fcheck_call *cb)
if (cb->xflags & F_BURST) {
if (info->cfg.burst < cost_to_bytes(info->cfg.avg))
xtables_error(PARAMETER_PROBLEM,
"burst cannot be smaller than %lub", cost_to_bytes(info->cfg.avg));
"burst cannot be smaller than %"PRIu64"b",
cost_to_bytes(info->cfg.avg));
burst = info->cfg.burst;
burst /= cost_to_bytes(info->cfg.avg);
......@@ -571,11 +724,42 @@ static void hashlimit_mt_check_v1(struct xt_fcheck_call *cb)
burst_error_v1();
}
static void hashlimit_mt_check(struct xt_fcheck_call *cb)
static void hashlimit_mt_check_v2(struct xt_fcheck_call *cb)
{
const struct hashlimit_mt_udata *udata = cb->udata;
struct xt_hashlimit_mtinfo2 *info = cb->data;
if (!(cb->xflags & (F_UPTO | F_ABOVE)))
xtables_error(PARAMETER_PROBLEM,
"You have to specify --hashlimit");
if (!(cb->xflags & F_HTABLE_EXPIRE))
info->cfg.expire = udata->mult * 1000; /* from s to msec */
if (info->cfg.mode & XT_HASHLIMIT_BYTES) {
uint32_t burst = 0;
if (cb->xflags & F_BURST) {
if (info->cfg.burst < cost_to_bytes(info->cfg.avg))
xtables_error(PARAMETER_PROBLEM,
"burst cannot be smaller than %"PRIu64"b",
cost_to_bytes(info->cfg.avg));
burst = info->cfg.burst;
burst /= cost_to_bytes(info->cfg.avg);
if (info->cfg.burst % cost_to_bytes(info->cfg.avg))
burst++;
if (!(cb->xflags & F_HTABLE_EXPIRE))
info->cfg.expire = XT_HASHLIMIT_BYTE_EXPIRE_BURST * 1000;
}
info->cfg.burst = burst;
} else if (info->cfg.burst > XT_HASHLIMIT_BURST_MAX)
burst_error();
}
static void hashlimit_mt_check(struct xt_fcheck_call *cb)
{
const struct hashlimit_mt_udata *udata = cb->udata;
struct xt_hashlimit_mtinfo3 *info = cb->data;
if (!(cb->xflags & (F_UPTO | F_ABOVE)))
xtables_error(PARAMETER_PROBLEM,
"You have to specify --hashlimit");
......@@ -599,6 +783,18 @@ static void hashlimit_mt_check(struct xt_fcheck_call *cb)
info->cfg.burst = burst;
} else if (info->cfg.burst > XT_HASHLIMIT_BURST_MAX)
burst_error();
if (cb->xflags & F_RATEMATCH) {
if (!(info->cfg.mode & XT_HASHLIMIT_BYTES))
info->cfg.avg /= udata->mult;
if (info->cfg.interval == 0) {
if (info->cfg.mode & XT_HASHLIMIT_BYTES)
info->cfg.interval = 1;
else
info->cfg.interval = udata->mult;
}
}
}
struct rates {
......@@ -615,7 +811,7 @@ static const struct rates rates[] = {
{ "min", XT_HASHLIMIT_SCALE_v2*60 },
{ "sec", XT_HASHLIMIT_SCALE_v2 } };
static uint32_t print_rate(uint32_t period, int revision)
static uint32_t print_rate(uint64_t period, int revision)
{
unsigned int i;
const struct rates *_rates = (revision == 1) ? rates_v1 : rates;
......@@ -631,7 +827,7 @@ static uint32_t print_rate(uint32_t period, int revision)
|| _rates[i].mult/period < _rates[i].mult%period)
break;
printf(" %lu/%s", _rates[i-1].mult / period, _rates[i-1].name);
printf(" %"PRIu64"/%s", _rates[i-1].mult / period, _rates[i-1].name);
/* return in msec */
return _rates[i-1].mult / scale * 1000;
}
......@@ -721,9 +917,10 @@ static void hashlimit_print(const void *ip,
}
static void
hashlimit_mt_print(const struct hashlimit_cfg2 *cfg, unsigned int dmask, int revision)
hashlimit_mt_print(const struct hashlimit_cfg3 *cfg, unsigned int dmask, int revision)
{
uint32_t quantum;
uint64_t quantum;
uint64_t period;
if (cfg->mode & XT_HASHLIMIT_INVERT)
fputs(" limit: above", stdout);
......@@ -732,8 +929,16 @@ hashlimit_mt_print(const struct hashlimit_cfg2 *cfg, unsigned int dmask, int rev
if (cfg->mode & XT_HASHLIMIT_BYTES) {
quantum = print_bytes(cfg->avg, cfg->burst, "");
} else {
if (revision == 3) {
period = cfg->avg;
if (cfg->interval != 0)
period *= cfg->interval;
quantum = print_rate(period, revision);
} else {
quantum = print_rate(cfg->avg, revision);
}
printf(" burst %llu", cfg->burst);
}
if (cfg->mode & (XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT |
......@@ -754,6 +959,13 @@ hashlimit_mt_print(const struct hashlimit_cfg2 *cfg, unsigned int dmask, int rev
printf(" srcmask %u", cfg->srcmask);
if (cfg->dstmask != dmask)
printf(" dstmask %u", cfg->dstmask);
if ((revision == 3) && (cfg->mode & XT_HASHLIMIT_RATE_MATCH))
printf(" rate-match");
if ((revision == 3) && (cfg->mode & XT_HASHLIMIT_RATE_MATCH))
if (cfg->interval != 1)
printf(" rate-interval %u", cfg->interval);
}
static void
......@@ -761,7 +973,7 @@ hashlimit_mt4_print_v1(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct xt_hashlimit_mtinfo1 *info = (const void *)match->data;
struct hashlimit_cfg2 cfg;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 1);
......@@ -777,7 +989,7 @@ hashlimit_mt6_print_v1(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct xt_hashlimit_mtinfo1 *info = (const void *)match->data;
struct hashlimit_cfg2 cfg;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 1);
......@@ -789,21 +1001,52 @@ hashlimit_mt6_print_v1(const void *ip, const struct xt_entry_match *match,
}
static void
hashlimit_mt4_print(const void *ip, const struct xt_entry_match *match,
hashlimit_mt4_print_v2(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct xt_hashlimit_mtinfo2 *info = (const void *)match->data;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 2);
if (ret)
xtables_error(OTHER_PROBLEM, "unknown revision");
hashlimit_mt_print(&info->cfg, 32, 2);
hashlimit_mt_print(&cfg, 32, 2);
}
static void
hashlimit_mt6_print(const void *ip, const struct xt_entry_match *match,
hashlimit_mt6_print_v2(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct xt_hashlimit_mtinfo2 *info = (const void *)match->data;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 2);
if (ret)
xtables_error(OTHER_PROBLEM, "unknown revision");
hashlimit_mt_print(&info->cfg, 128, 2);
hashlimit_mt_print(&cfg, 128, 2);
}
static void
hashlimit_mt4_print(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct xt_hashlimit_mtinfo3 *info = (const void *)match->data;
hashlimit_mt_print(&info->cfg, 32, 3);
}
static void
hashlimit_mt6_print(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct xt_hashlimit_mtinfo3 *info = (const void *)match->data;
hashlimit_mt_print(&info->cfg, 128, 3);
}
static void hashlimit_save(const void *ip, const struct xt_entry_match *match)
......@@ -831,7 +1074,7 @@ static void hashlimit_save(const void *ip, const struct xt_entry_match *match)
}
static void
hashlimit_mt_save(const struct hashlimit_cfg2 *cfg, const char* name, unsigned int dmask, int revision)
hashlimit_mt_save(const struct hashlimit_cfg3 *cfg, const char* name, unsigned int dmask, int revision)
{
uint32_t quantum;
......@@ -868,13 +1111,20 @@ hashlimit_mt_save(const struct hashlimit_cfg2 *cfg, const char* name, unsigned i
printf(" --hashlimit-srcmask %u", cfg->srcmask);
if (cfg->dstmask != dmask)
printf(" --hashlimit-dstmask %u", cfg->dstmask);
if ((revision == 3) && (cfg->mode & XT_HASHLIMIT_RATE_MATCH))
printf(" --hashlimit-rate-match");
if ((revision == 3) && (cfg->mode & XT_HASHLIMIT_RATE_MATCH))
if (cfg->interval != 1)
printf(" --hashlimit-rate-interval %u", cfg->interval);
}
static void
hashlimit_mt4_save_v1(const void *ip, const struct xt_entry_match *match)
{
const struct xt_hashlimit_mtinfo1 *info = (const void *)match->data;
struct hashlimit_cfg2 cfg;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 1);
......@@ -889,7 +1139,7 @@ static void
hashlimit_mt6_save_v1(const void *ip, const struct xt_entry_match *match)
{
const struct xt_hashlimit_mtinfo1 *info = (const void *)match->data;
struct hashlimit_cfg2 cfg;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 1);
......@@ -901,19 +1151,300 @@ hashlimit_mt6_save_v1(const void *ip, const struct xt_entry_match *match)
}
static void
hashlimit_mt4_save(const void *ip, const struct xt_entry_match *match)
hashlimit_mt4_save_v2(const void *ip, const struct xt_entry_match *match)
{
const struct xt_hashlimit_mtinfo2 *info = (const void *)match->data;
struct hashlimit_cfg3 cfg;
int ret;
hashlimit_mt_save(&info->cfg, info->name, 32, 2);
ret = cfg_copy(&cfg, (const void *)&info->cfg, 2);
if (ret)
xtables_error(OTHER_PROBLEM, "unknown revision");
hashlimit_mt_save(&cfg, info->name, 32, 2);
}
static void
hashlimit_mt6_save(const void *ip, const struct xt_entry_match *match)
hashlimit_mt6_save_v2(const void *ip, const struct xt_entry_match *match)
{
const struct xt_hashlimit_mtinfo2 *info = (const void *)match->data;
struct hashlimit_cfg3 cfg;
int ret;
ret = cfg_copy(&cfg, (const void *)&info->cfg, 2);
if (ret)
xtables_error(OTHER_PROBLEM, "unknown revision");
hashlimit_mt_save(&info->cfg, info->name, 128, 2);
hashlimit_mt_save(&cfg, info->name, 128, 2);
}
static void
hashlimit_mt4_save(const void *ip, const struct xt_entry_match *match)
{
const struct xt_hashlimit_mtinfo3 *info = (const void *)match->data;
hashlimit_mt_save(&info->cfg, info->name, 32, 3);
}
static void
hashlimit_mt6_save(const void *ip, const struct xt_entry_match *match)
{
const struct xt_hashlimit_mtinfo3 *info = (const void *)match->data;
hashlimit_mt_save(&info->cfg, info->name, 128, 3);
}
static const struct rates rates_v1_xlate[] = {
{ "day", XT_HASHLIMIT_SCALE * 24 * 60 * 60 },
{ "hour", XT_HASHLIMIT_SCALE * 60 * 60 },
{ "minute", XT_HASHLIMIT_SCALE * 60 },
{ "second", XT_HASHLIMIT_SCALE } };
static const struct rates rates_xlate[] = {
{ "day", XT_HASHLIMIT_SCALE_v2 * 24 * 60 * 60 },
{ "hour", XT_HASHLIMIT_SCALE_v2 * 60 * 60 },
{ "minute", XT_HASHLIMIT_SCALE_v2 * 60 },
{ "second", XT_HASHLIMIT_SCALE_v2 } };
static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg,
int revision)
{
unsigned int i;
const struct rates *_rates = (revision == 1) ?
rates_v1_xlate : rates_xlate;
for (i = 1; i < ARRAY_SIZE(rates); ++i)
if (avg > _rates[i].mult ||
_rates[i].mult / avg < _rates[i].mult % avg)
break;
xt_xlate_add(xl, " %llu/%s ",
_rates[i-1].mult / avg, _rates[i-1].name);
}
static void print_bytes_rate_xlate(struct xt_xlate *xl,
const struct hashlimit_cfg3 *cfg)
{
unsigned int i;
unsigned long long r;
r = cost_to_bytes(cfg->avg);
for (i = 0; i < ARRAY_SIZE(units) -1; ++i)
if (r >= units[i].thresh &&
bytes_to_cost(r & ~(units[i].thresh - 1)) == cfg->avg)
break;
xt_xlate_add(xl, " %llu %sbytes/second", r / units[i].thresh,
units[i].name);
r *= cfg->burst;
for (i = 0; i < ARRAY_SIZE(units) -1; ++i)
if (r >= units[i].thresh)
break;
if (cfg->burst > 0)
xt_xlate_add(xl, " burst %llu %sbytes", r / units[i].thresh,
units[i].name);
}
static void hashlimit_print_subnet_xlate(struct xt_xlate *xl,
uint32_t nsub, int family)
{
char sep = (family == NFPROTO_IPV4) ? '.' : ':';
char *fmt = (family == NFPROTO_IPV4) ? "%u" : "%04x";
unsigned int nblocks = (family == NFPROTO_IPV4) ? 4 : 8;
unsigned int nbits = (family == NFPROTO_IPV4) ? 8 : 16;
unsigned int acm, i;
xt_xlate_add(xl, " and ");
while (nblocks--) {
acm = 0;
for (i = 0; i < nbits; i++) {
acm <<= 1;
if (nsub > 0) {
acm++;
nsub--;
}
}
xt_xlate_add(xl, fmt, acm);
if (nblocks > 0)
xt_xlate_add(xl, "%c", sep);
}
}
static const char *const hashlimit_modes4_xlate[] = {
[XT_HASHLIMIT_HASH_DIP] = "ip daddr",
[XT_HASHLIMIT_HASH_DPT] = "tcp dport",
[XT_HASHLIMIT_HASH_SIP] = "ip saddr",
[XT_HASHLIMIT_HASH_SPT] = "tcp sport",
};
static const char *const hashlimit_modes6_xlate[] = {
[XT_HASHLIMIT_HASH_DIP] = "ip6 daddr",
[XT_HASHLIMIT_HASH_DPT] = "tcp dport",
[XT_HASHLIMIT_HASH_SIP] = "ip6 saddr",
[XT_HASHLIMIT_HASH_SPT] = "tcp sport",
};
static int hashlimit_mode_xlate(struct xt_xlate *xl,
uint32_t mode, int family,
unsigned int nsrc, unsigned int ndst)
{
const char * const *_modes = (family == NFPROTO_IPV4) ?
hashlimit_modes4_xlate : hashlimit_modes6_xlate;
bool prevopt = false;
unsigned int mask;
mode &= ~XT_HASHLIMIT_INVERT & ~XT_HASHLIMIT_BYTES;
for (mask = 1; mode > 0; mask <<= 1) {
if (!(mode & mask))
continue;
if (!prevopt) {
xt_xlate_add(xl, " ");
prevopt = true;
}
else {
xt_xlate_add(xl, " . ");
}
xt_xlate_add(xl, "%s", _modes[mask]);
if (mask == XT_HASHLIMIT_HASH_DIP &&
((family == NFPROTO_IPV4 && ndst != 32) ||
(family == NFPROTO_IPV6 && ndst != 128)))
hashlimit_print_subnet_xlate(xl, ndst, family);
else if (mask == XT_HASHLIMIT_HASH_SIP &&
((family == NFPROTO_IPV4 && nsrc != 32) ||
(family == NFPROTO_IPV6 && nsrc != 128)))
hashlimit_print_subnet_xlate(xl, nsrc, family);
mode &= ~mask;
}
return prevopt;
}
static int hashlimit_mt_xlate(struct xt_xlate *xl, const char *name,
const struct hashlimit_cfg3 *cfg,
int revision, int family)
{
int ret = 1;
xt_xlate_add(xl, "meter %s {", name);
ret = hashlimit_mode_xlate(xl, cfg->mode, family,
cfg->srcmask, cfg->dstmask);
if (cfg->expire != 1000)
xt_xlate_add(xl, " timeout %us", cfg->expire / 1000);
xt_xlate_add(xl, " limit rate");
if (cfg->mode & XT_HASHLIMIT_INVERT)
xt_xlate_add(xl, " over");
if (cfg->mode & XT_HASHLIMIT_BYTES)
print_bytes_rate_xlate(xl, cfg);
else {
print_packets_rate_xlate(xl, cfg->avg, revision);
if (cfg->burst != XT_HASHLIMIT_BURST)
xt_xlate_add(xl, "burst %lu packets", cfg->burst);
}
xt_xlate_add(xl, "}");
return ret;
}
static int hashlimit_xlate(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_info *info = (const void *)params->match->data;
int ret = 1;
xt_xlate_add(xl, "meter %s {", info->name);
ret = hashlimit_mode_xlate(xl, info->cfg.mode, NFPROTO_IPV4, 32, 32);
xt_xlate_add(xl, " timeout %us limit rate", info->cfg.expire / 1000);
print_packets_rate_xlate(xl, info->cfg.avg, 1);
xt_xlate_add(xl, " burst %lu packets", info->cfg.burst);
xt_xlate_add(xl, "}");
return ret;
}
static int hashlimit_mt4_xlate_v1(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_mtinfo1 *info =
(const void *)params->match->data;
struct hashlimit_cfg3 cfg;
if (cfg_copy(&cfg, (const void *)&info->cfg, 1))
xtables_error(OTHER_PROBLEM, "unknown revision");
return hashlimit_mt_xlate(xl, info->name, &cfg, 1, NFPROTO_IPV4);
}
static int hashlimit_mt6_xlate_v1(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_mtinfo1 *info =
(const void *)params->match->data;
struct hashlimit_cfg3 cfg;
if (cfg_copy(&cfg, (const void *)&info->cfg, 1))
xtables_error(OTHER_PROBLEM, "unknown revision");
return hashlimit_mt_xlate(xl, info->name, &cfg, 1, NFPROTO_IPV6);
}
static int hashlimit_mt4_xlate_v2(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_mtinfo2 *info =
(const void *)params->match->data;
struct hashlimit_cfg3 cfg;
if (cfg_copy(&cfg, (const void *)&info->cfg, 2))
xtables_error(OTHER_PROBLEM, "unknown revision");
return hashlimit_mt_xlate(xl, info->name, &cfg, 2, NFPROTO_IPV4);
}
static int hashlimit_mt6_xlate_v2(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_mtinfo2 *info =
(const void *)params->match->data;
struct hashlimit_cfg3 cfg;
if (cfg_copy(&cfg, (const void *)&info->cfg, 2))
xtables_error(OTHER_PROBLEM, "unknown revision");
return hashlimit_mt_xlate(xl, info->name, &cfg, 2, NFPROTO_IPV6);
}
static int hashlimit_mt4_xlate(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_mtinfo3 *info =
(const void *)params->match->data;
return hashlimit_mt_xlate(xl, info->name, &info->cfg, 3, NFPROTO_IPV4);
}
static int hashlimit_mt6_xlate(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
const struct xt_hashlimit_mtinfo3 *info =
(const void *)params->match->data;
return hashlimit_mt_xlate(xl, info->name, &info->cfg, 3, NFPROTO_IPV6);
}
static struct xtables_match hashlimit_mt_reg[] = {
......@@ -932,6 +1463,7 @@ static struct xtables_match hashlimit_mt_reg[] = {
.save = hashlimit_save,
.x6_options = hashlimit_opts,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_xlate,
},
{
.version = XTABLES_VERSION,
......@@ -948,6 +1480,7 @@ static struct xtables_match hashlimit_mt_reg[] = {
.save = hashlimit_mt4_save_v1,
.x6_options = hashlimit_mt_opts_v1,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_mt4_xlate_v1,
},
{
.version = XTABLES_VERSION,
......@@ -964,6 +1497,7 @@ static struct xtables_match hashlimit_mt_reg[] = {
.save = hashlimit_mt6_save_v1,
.x6_options = hashlimit_mt_opts_v1,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_mt6_xlate_v1,
},
{
.version = XTABLES_VERSION,
......@@ -973,6 +1507,40 @@ static struct xtables_match hashlimit_mt_reg[] = {
.size = XT_ALIGN(sizeof(struct xt_hashlimit_mtinfo2)),
.userspacesize = offsetof(struct xt_hashlimit_mtinfo2, hinfo),
.help = hashlimit_mt_help,
.init = hashlimit_mt4_init_v2,
.x6_parse = hashlimit_mt_parse_v2,
.x6_fcheck = hashlimit_mt_check_v2,
.print = hashlimit_mt4_print_v2,
.save = hashlimit_mt4_save_v2,
.x6_options = hashlimit_mt_opts_v2,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_mt4_xlate_v2,
},
{
.version = XTABLES_VERSION,
.name = "hashlimit",
.revision = 2,
.family = NFPROTO_IPV6,
.size = XT_ALIGN(sizeof(struct xt_hashlimit_mtinfo2)),
.userspacesize = offsetof(struct xt_hashlimit_mtinfo2, hinfo),
.help = hashlimit_mt_help,
.init = hashlimit_mt6_init_v2,
.x6_parse = hashlimit_mt_parse_v2,
.x6_fcheck = hashlimit_mt_check_v2,
.print = hashlimit_mt6_print_v2,
.save = hashlimit_mt6_save_v2,
.x6_options = hashlimit_mt_opts_v2,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_mt6_xlate_v2,
},
{
.version = XTABLES_VERSION,
.name = "hashlimit",
.revision = 3,
.family = NFPROTO_IPV4,
.size = XT_ALIGN(sizeof(struct xt_hashlimit_mtinfo3)),
.userspacesize = offsetof(struct xt_hashlimit_mtinfo3, hinfo),
.help = hashlimit_mt_help_v3,
.init = hashlimit_mt4_init,
.x6_parse = hashlimit_mt_parse,
.x6_fcheck = hashlimit_mt_check,
......@@ -980,15 +1548,16 @@ static struct xtables_match hashlimit_mt_reg[] = {
.save = hashlimit_mt4_save,
.x6_options = hashlimit_mt_opts,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_mt4_xlate,
},
{
.version = XTABLES_VERSION,
.name = "hashlimit",
.revision = 2,
.revision = 3,
.family = NFPROTO_IPV6,
.size = XT_ALIGN(sizeof(struct xt_hashlimit_mtinfo2)),
.userspacesize = offsetof(struct xt_hashlimit_mtinfo2, hinfo),
.help = hashlimit_mt_help,
.size = XT_ALIGN(sizeof(struct xt_hashlimit_mtinfo3)),
.userspacesize = offsetof(struct xt_hashlimit_mtinfo3, hinfo),
.help = hashlimit_mt_help_v3,
.init = hashlimit_mt6_init,
.x6_parse = hashlimit_mt_parse,
.x6_fcheck = hashlimit_mt_check,
......@@ -996,6 +1565,7 @@ static struct xtables_match hashlimit_mt_reg[] = {
.save = hashlimit_mt6_save,
.x6_options = hashlimit_mt_opts,
.udata_size = sizeof(struct hashlimit_mt_udata),
.xlate = hashlimit_mt6_xlate,
},
};
......
......@@ -51,6 +51,14 @@ After how many milliseconds do hash entries expire.
.TP
\fB\-\-hashlimit\-htable\-gcinterval\fP \fImsec\fP
How many milliseconds between garbage collection intervals.
.TP
\fB\-\-hashlimit\-rate\-match\fP
Classify the flow instead of rate-limiting it. This acts like a
true/flase match on whether the rate is above/below a certain number
.TP
\fB\-\-hashlimit\-rate\-interval\fP \fIsec\fP
Can be used with \-\-hashlimit\-rate\-match to specify the interval
at which the rate should be sampled
.PP
Examples:
.TP
......
iptables-translate -A OUTPUT -m tcp -p tcp --dport 443 -m hashlimit --hashlimit-above 20kb/s --hashlimit-burst 1mb --hashlimit-mode dstip --hashlimit-name https --hashlimit-dstmask 24 -m state --state NEW -j DROP
nft add rule ip filter OUTPUT tcp dport 443 meter https { ip daddr and 255.255.255.0 timeout 60s limit rate over 20 kbytes/second burst 1 mbytes} ct state new counter drop
iptables-translate -A OUTPUT -m tcp -p tcp --dport 443 -m hashlimit --hashlimit-upto 300 --hashlimit-burst 15 --hashlimit-mode srcip,dstip --hashlimit-name https --hashlimit-htable-expire 300000 -m state --state NEW -j DROP
nft add rule ip filter OUTPUT tcp dport 443 meter https { ip daddr . ip saddr timeout 300s limit rate 300/second burst 15 packets} ct state new counter drop
iptables-translate -A FORWARD -m helper --helper sip
nft add rule ip filter FORWARD ct helper \"sip\" counter
iptables-translate -A FORWARD -m helper ! --helper ftp
nft add rule ip filter FORWARD ct helper != \"ftp\" counter
iptables-translate -t filter -A INPUT -m ipcomp --ipcompspi 0x12 -j ACCEPT
nft add rule ip filter INPUT comp cpi 18 counter accept
iptables-translate -t filter -A INPUT -m ipcomp ! --ipcompspi 0x12 -j ACCEPT
nft add rule ip filter INPUT comp cpi != 18 counter accept
iptables-translate -A INPUT -m iprange --src-range 192.168.25.149-192.168.25.151 -j ACCEPT
nft add rule ip filter INPUT ip saddr 192.168.25.149-192.168.25.151 counter accept
iptables-translate -A INPUT -m iprange --dst-range 192.168.25.149-192.168.25.151 -j ACCEPT
nft add rule ip filter INPUT ip daddr 192.168.25.149-192.168.25.151 counter accept
iptables-translate -A INPUT -m iprange --dst-range 3.3.3.3-6.6.6.6 --src-range 4.4.4.4-7.7.7.7 -j ACCEPT
nft add rule ip filter INPUT ip saddr 4.4.4.4-7.7.7.7 ip daddr 3.3.3.3-6.6.6.6 counter accept
ip6tables-translate -A INPUT -m iprange ! --dst-range ::2d01-::2d03 -j ACCEPT
nft add rule ip6 filter INPUT ip6 daddr != ::2d01-::2d03 counter accept
ip6tables-translate -A INPUT -m iprange ! --dst-range ::2d01-::2d03 --src-range ::2d01-::2d03 -j ACCEPT
nft add rule ip6 filter INPUT ip6 saddr ::2d01-::2d03 ip6 daddr != ::2d01-::2d03 counter accept
iptables-translate -A INPUT -p icmp -m length --length 86:0xffff -j DROP
nft add rule ip filter INPUT ip protocol icmp meta length 86-65535 counter drop
iptables-translate -A INPUT -p udp -m length --length :400
nft add rule ip filter INPUT ip protocol udp meta length 0-400 counter
iptables-translate -A INPUT -p udp -m length --length 40
nft add rule ip filter INPUT ip protocol udp meta length 40 counter
iptables-translate -A INPUT -p udp -m length ! --length 40
nft add rule ip filter INPUT ip protocol udp meta length != 40 counter
......@@ -4,6 +4,7 @@
* Hervé Eychenne <rv@wallfire.org>
*/
#define _BSD_SOURCE 1
#define _DEFAULT_SOURCE 1
#define _ISOC99_SOURCE 1
#include <math.h>
#include <stdio.h>
......
iptables-translate -A INPUT -m limit --limit 3/m --limit-burst 3
nft add rule ip filter INPUT limit rate 3/minute burst 3 packets counter
iptables-translate -A INPUT -m limit --limit 10/s --limit-burst 5
nft add rule ip filter INPUT limit rate 10/second burst 5 packets counter
iptables-translate -A INPUT -m limit --limit 10/s --limit-burst 0
nft add rule ip filter INPUT limit rate 10/second counter
iptables-translate -A INPUT -m mac --mac-source 0a:12:3e:4f:b2:c6 -j DROP
nft add rule ip filter INPUT ether saddr 0a:12:3e:4f:b2:c6 counter drop
iptables-translate -A INPUT -p tcp --dport 80 -m mac --mac-source 0a:12:3e:4f:b2:c6 -j ACCEPT
nft add rule ip filter INPUT tcp dport 80 ether saddr 0a:12:3e:4f:b2:c6 counter accept
iptables-translate -I INPUT -p tcp -m mark ! --mark 0xa/0xa
nft insert rule ip filter INPUT ip protocol tcp mark and 0xa != 0xa counter
iptables-translate -I INPUT -p tcp -m mark ! --mark 0x1
nft insert rule ip filter INPUT ip protocol tcp mark != 0x1 counter
iptables-translate -t filter -A INPUT -p tcp -m multiport --dports 80,81 -j ACCEPT
nft add rule ip filter INPUT ip protocol tcp tcp dport { 80,81} counter accept
iptables-translate -t filter -A INPUT -p tcp -m multiport --dports 80:88 -j ACCEPT
nft add rule ip filter INPUT ip protocol tcp tcp dport 80-88 counter accept
iptables-translate -t filter -A INPUT -p tcp -m multiport ! --dports 80:88 -j ACCEPT
nft add rule ip filter INPUT ip protocol tcp tcp dport != 80-88 counter accept
iptables-translate -t filter -A INPUT -p tcp -m multiport --sports 50 -j ACCEPT
nft add rule ip filter INPUT ip protocol tcp tcp sport 50 counter accept
iptables-translate -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner root -j ACCEPT
nft add rule ip nat OUTPUT tcp dport 80 skuid 0 counter accept
iptables-translate -t nat -A OUTPUT -p tcp --dport 80 -m owner --gid-owner 0-10 -j ACCEPT
nft add rule ip nat OUTPUT tcp dport 80 skgid 0-10 counter accept
iptables-translate -t nat -A OUTPUT -p tcp --dport 80 -m owner ! --uid-owner 1000 -j ACCEPT
nft add rule ip nat OUTPUT tcp dport 80 skuid != 1000 counter accept
iptables-translate -A INPUT -m pkttype --pkt-type broadcast -j DROP
nft add rule ip filter INPUT pkttype broadcast counter drop
iptables-translate -A INPUT -m pkttype ! --pkt-type unicast -j DROP
nft add rule ip filter INPUT pkttype != unicast counter drop
iptables-translate -A INPUT -m pkttype --pkt-type multicast -j ACCEPT
nft add rule ip filter INPUT pkttype multicast counter accept
......@@ -376,6 +376,31 @@ static void policy6_save(const void *ip, const struct xt_entry_match *match)
}
}
static int policy_xlate(struct xt_xlate *xl,
const struct xt_xlate_mt_params *params)
{
static const unsigned int allowed = XT_POLICY_MATCH_STRICT |
XT_POLICY_MATCH_NONE |
XT_POLICY_MATCH_IN;
static const struct xt_policy_elem empty;
const struct xt_policy_info *info = (const void *)params->match->data;
if ((info->flags & ~allowed) || info->len > 1)
return 0;
if (memcmp(&info->pol[0], &empty, sizeof(empty)))
return 0;
xt_xlate_add(xl, "meta secpath ");
if (info->flags & XT_POLICY_MATCH_NONE)
xt_xlate_add(xl, "missing");
else
xt_xlate_add(xl, "exists");
return 1;
}
static struct xtables_match policy_mt_reg[] = {
{
.name = "policy",
......@@ -389,6 +414,7 @@ static struct xtables_match policy_mt_reg[] = {
.print = policy4_print,
.save = policy4_save,
.x6_options = policy_opts,
.xlate = policy_xlate,
},
{
.name = "policy",
......@@ -402,6 +428,7 @@ static struct xtables_match policy_mt_reg[] = {
.print = policy6_print,
.save = policy6_save,
.x6_options = policy_opts,
.xlate = policy_xlate,
},
};
......
iptables-translate -A INPUT -m policy --pol ipsec --dir in
nft add rule ip filter INPUT meta secpath exists counter
iptables-translate -A INPUT -m policy --pol none --dir in
nft add rule ip filter INPUT meta secpath missing counter
iptables-translate -A OUTPUT -m quota --quota 111
nft add rule ip filter OUTPUT quota 111 bytes counter
iptables-translate -A OUTPUT -m quota ! --quota 111
nft add rule ip filter OUTPUT quota over 111 bytes counter
......@@ -199,7 +199,7 @@ static void recent_print(const void *ip, const struct xt_entry_match *match,
if(info->hit_count) printf(" hit_count: %d", info->hit_count);
if (info->check_set & XT_RECENT_TTL)
printf(" TTL-Match");
if(info->name) printf(" name: %s", info->name);
printf(" name: %s", info->name);
if (info->side == XT_RECENT_SOURCE)
printf(" side: source");
if (info->side == XT_RECENT_DEST)
......@@ -239,7 +239,7 @@ static void recent_save(const void *ip, const struct xt_entry_match *match,
if(info->hit_count) printf(" --hitcount %d", info->hit_count);
if (info->check_set & XT_RECENT_TTL)
printf(" --rttl");
if(info->name) printf(" --name %s",info->name);
printf(" --name %s",info->name);
switch(family) {
case NFPROTO_IPV4:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment