X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=extensions%2Flibipt_helper.c;h=7c9f3e3c6400943f56f59b8222a4a69dfae33cfa;hb=6afea0b41dfbc3824956d11d960ad80097218feb;hp=4b16e0210dc3f3517c4452b896b652ce111bf6ff;hpb=f7b70cf9e00324b89b02de213bcd0dde7044d035;p=iptables.git diff --git a/extensions/libipt_helper.c b/extensions/libipt_helper.c index 4b16e02..7c9f3e3 100644 --- a/extensions/libipt_helper.c +++ b/extensions/libipt_helper.c @@ -24,14 +24,6 @@ static struct option opts[] = { {0} }; -/* Initialize the match. */ -static void -init(struct ipt_entry_match *m, unsigned int *nfcache) -{ - /* Can't cache this. */ - *nfcache |= NFC_UNKNOWN; -} - /* Function which parses command options; returns true if it ate an option */ static int @@ -44,8 +36,12 @@ parse(int c, char **argv, int invert, unsigned int *flags, switch (c) { case '1': + if (*flags) + exit_error(PARAMETER_PROBLEM, + "helper match: Only use --helper ONCE!"); check_inverse(optarg, &invert, &invert, 0); strncpy(info->name, optarg, 29); + info->name[29] = '\0'; if (invert) info->invert = 1; *flags = 1; @@ -86,20 +82,17 @@ save(const struct ipt_ip *ip, const struct ipt_entry_match *match) printf("%s--helper \"%s\" ",info->invert ? "! " : "", info->name); } -static -struct iptables_match helper -= { NULL, - "helper", - IPTABLES_VERSION, - IPT_ALIGN(sizeof(struct ipt_helper_info)), - IPT_ALIGN(sizeof(struct ipt_helper_info)), - &help, - &init, - &parse, - &final_check, - &print, - &save, - opts +static struct iptables_match helper = { + .next = NULL, + .name = "helper", + .version = IPTABLES_VERSION, + .size = IPT_ALIGN(sizeof(struct ipt_helper_info)), + .help = &help, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts }; void _init(void)