From 2bcb16047e048afd1457642fa7bc2aefc8d06d9d Mon Sep 17 00:00:00 2001 From: Yasuyuki KOZAKAI Date: Tue, 24 Jul 2007 07:03:59 +0000 Subject: [PATCH] Add IPv6 support to quota match --- extensions/{.quota-test => .quota-testx} | 0 extensions/{libipt_quota.c => libxt_quota.c} | 28 +++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) rename extensions/{.quota-test => .quota-testx} (100%) mode change 100755 => 100644 rename extensions/{libipt_quota.c => libxt_quota.c} (80%) diff --git a/extensions/.quota-test b/extensions/.quota-testx old mode 100755 new mode 100644 similarity index 100% rename from extensions/.quota-test rename to extensions/.quota-testx diff --git a/extensions/libipt_quota.c b/extensions/libxt_quota.c similarity index 80% rename from extensions/libipt_quota.c rename to extensions/libxt_quota.c index 89e5168c..a273b290 100644 --- a/extensions/libipt_quota.c +++ b/extensions/libxt_quota.c @@ -7,10 +7,9 @@ #include #include #include -#include +#include #include -#include static struct option opts[] = { {"quota", 1, 0, '1'}, @@ -47,7 +46,7 @@ parse_quota(const char *s, u_int64_t * quota) { *quota = strtoull(s, (char **) NULL, 10); -#ifdef DEBUG_IPT_QUOTA +#ifdef DEBUG_XT_QUOTA printf("Quota: %llu\n", *quota); #endif @@ -86,11 +85,27 @@ final_check(unsigned int flags) { } -struct iptables_match quota = { +struct xtables_match quota = { .next = NULL, + .family = AF_INET, .name = "quota", .version = IPTABLES_VERSION, - .size = IPT_ALIGN(sizeof (struct xt_quota_info)), + .size = XT_ALIGN(sizeof (struct xt_quota_info)), + .userspacesize = offsetof(struct xt_quota_info, quota), + .help = &help, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts +}; + +struct xtables_match quota6 = { + .next = NULL, + .family = AF_INET6, + .name = "quota", + .version = IPTABLES_VERSION, + .size = XT_ALIGN(sizeof (struct xt_quota_info)), .userspacesize = offsetof(struct xt_quota_info, quota), .help = &help, .parse = &parse, @@ -103,5 +118,6 @@ struct iptables_match quota = { void _init(void) { - register_match("a); + xtables_register_match("a); + xtables_register_match("a6); } -- 2.47.2