X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=extensions%2Flibipt_tos.c;h=7a10a5022f260e31fbfb331ada3f4fd1054c7981;hb=6afea0b41dfbc3824956d11d960ad80097218feb;hp=6786911d7688c78bc0b46846aa779750f97fa90a;hpb=f7b70cf9e00324b89b02de213bcd0dde7044d035;p=iptables.git diff --git a/extensions/libipt_tos.c b/extensions/libipt_tos.c index 6786911..7a10a50 100644 --- a/extensions/libipt_tos.c +++ b/extensions/libipt_tos.c @@ -47,13 +47,6 @@ static struct option opts[] = { {0} }; -/* Initialize the match. */ -static void -init(struct ipt_entry_match *m, unsigned int *nfcache) -{ - *nfcache |= NFC_IP_TOS; -} - static void parse_tos(const unsigned char *s, struct ipt_tos_info *info) { @@ -91,6 +84,11 @@ parse(int c, char **argv, int invert, unsigned int *flags, switch (c) { case '1': + /* Ensure that `--tos' haven't been used yet. */ + if (*flags == 1) + exit_error(PARAMETER_PROBLEM, + "tos match: only use --tos once!"); + check_inverse(optarg, &invert, &optind, 0); parse_tos(argv[optind-1], tosinfo); if (invert) @@ -154,20 +152,18 @@ save(const struct ipt_ip *ip, const struct ipt_entry_match *match) print_tos(info->tos, 0); } -static -struct iptables_match tos -= { NULL, - "tos", - IPTABLES_VERSION, - IPT_ALIGN(sizeof(struct ipt_tos_info)), - IPT_ALIGN(sizeof(struct ipt_tos_info)), - &help, - &init, - &parse, - &final_check, - &print, - &save, - opts +static struct iptables_match tos = { + .next = NULL, + .name = "tos", + .version = IPTABLES_VERSION, + .size = IPT_ALIGN(sizeof(struct ipt_tos_info)), + .userspacesize = IPT_ALIGN(sizeof(struct ipt_tos_info)), + .help = &help, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts }; void _init(void)