From ae35309923339354b48adac4fa703bd3f5e6dd2b Mon Sep 17 00:00:00 2001 From: Phil Oester Date: Tue, 8 Aug 2006 09:59:59 +0000 Subject: update quota match for xtables + fix -D bug (Phil Oester ) --- extensions/.quota-test | 2 +- extensions/libipt_quota.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/extensions/.quota-test b/extensions/.quota-test index 761bf143..b21058c5 100755 --- a/extensions/.quota-test +++ b/extensions/.quota-test @@ -1,3 +1,3 @@ #!/bin/sh -[ -f $KERNEL_DIR/include/linux/netfilter_ipv4/ipt_quota.h ] && echo quota +[ -f $KERNEL_DIR/include/linux/netfilter/xt_quota.h ] && echo quota diff --git a/extensions/libipt_quota.c b/extensions/libipt_quota.c index a9c138c5..83807541 100644 --- a/extensions/libipt_quota.c +++ b/extensions/libipt_quota.c @@ -3,12 +3,13 @@ * * Sam Johnston */ +#include #include #include #include #include -#include +#include #include static struct option opts[] = { @@ -28,7 +29,7 @@ help(void) static void print(const struct ipt_ip *ip, const struct ipt_entry_match *match, int numeric) { - struct ipt_quota_info *q = (struct ipt_quota_info *) match->data; + struct xt_quota_info *q = (struct xt_quota_info *) match->data; printf("quota: %llu bytes", (unsigned long long) q->quota); } @@ -36,7 +37,7 @@ print(const struct ipt_ip *ip, const struct ipt_entry_match *match, int numeric) static void save(const struct ipt_ip *ip, const struct ipt_entry_match *match) { - struct ipt_quota_info *q = (struct ipt_quota_info *) match->data; + struct xt_quota_info *q = (struct xt_quota_info *) match->data; printf("--quota %llu ", (unsigned long long) q->quota); } @@ -62,7 +63,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, const struct ipt_entry *entry, unsigned int *nfcache, struct ipt_entry_match **match) { - struct ipt_quota_info *info = (struct ipt_quota_info *) (*match)->data; + struct xt_quota_info *info = (struct xt_quota_info *) (*match)->data; switch (c) { case '1': @@ -89,8 +90,8 @@ struct iptables_match quota = { .next = NULL, .name = "quota", .version = IPTABLES_VERSION, - .size = IPT_ALIGN(sizeof (struct ipt_quota_info)), - .userspacesize = IPT_ALIGN(sizeof (struct ipt_quota_info)), + .size = IPT_ALIGN(sizeof (struct xt_quota_info)), + .userspacesize = offsetof(struct xt_quota_info, quota), .help = &help, .parse = &parse, .final_check = &final_check, -- cgit v1.2.3