From edf14cf4b5edb148d7473f067d95e7bd1316900b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 19 Apr 2000 11:26:44 +0000 Subject: Changes to allow matching (for delete) on part of a rule, for rules which change in the kernel (eg. ipt_limit). --- extensions/libipt_tcp.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'extensions/libipt_tcp.c') diff --git a/extensions/libipt_tcp.c b/extensions/libipt_tcp.c index 2febc28c..276d0e2a 100644 --- a/extensions/libipt_tcp.c +++ b/extensions/libipt_tcp.c @@ -308,21 +308,23 @@ print_option(u_int8_t option, int invert, int numeric) static void print_tcpf(u_int8_t flags) { - int sole_flag = 1; + int have_flag = 0; - do { + while (flags) { unsigned int i; - /* Terminates because last flag is 0 */ - for (i = 0; !(flags & tcp_flag_names[i].flag); i++); + for (i = 0; (flags & tcp_flag_names[i].flag) == 0; i++); - if (!sole_flag) + if (have_flag) printf(","); printf("%s", tcp_flag_names[i].name); - sole_flag = 0; + have_flag = 1; flags &= ~tcp_flag_names[i].flag; - } while (flags); + } + + if (!have_flag) + printf("NONE"); } static void @@ -424,6 +426,7 @@ struct iptables_match tcp "tcp", NETFILTER_VERSION, sizeof(struct ipt_tcp), + sizeof(struct ipt_tcp), &help, &init, &parse, -- cgit v1.2.3