From 32b8e61e4e5bd405d9ad07bf9468498dfbb19f9e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 23 Jul 2010 21:16:14 +0200 Subject: all: consistent syntax use in struct option Try to inhibit copypasting old stuff. Signed-off-by: Jan Engelhardt --- extensions/libip6t_HL.c | 9 +++++---- extensions/libip6t_LOG.c | 17 +++++++++-------- extensions/libip6t_REJECT.c | 5 +++-- extensions/libip6t_ah.c | 9 +++++---- extensions/libip6t_dst.c | 9 +++++---- extensions/libip6t_frag.c | 15 ++++++++------- extensions/libip6t_hbh.c | 8 ++++---- extensions/libip6t_hl.c | 12 ++++++------ extensions/libip6t_icmp6.c | 5 +++-- extensions/libip6t_ipv6header.c | 7 ++++--- extensions/libip6t_mh.c | 5 +++-- extensions/libip6t_rt.c | 15 ++++++++------- extensions/libipt_CLUSTERIP.c | 15 ++++++++------- extensions/libipt_DNAT.c | 9 +++++---- extensions/libipt_ECN.c | 11 ++++++----- extensions/libipt_LOG.c | 17 +++++++++-------- extensions/libipt_MASQUERADE.c | 7 ++++--- extensions/libipt_NETMAP.c | 6 +++--- extensions/libipt_REDIRECT.c | 7 ++++--- extensions/libipt_REJECT.c | 5 +++-- extensions/libipt_SAME.c | 9 +++++---- extensions/libipt_SNAT.c | 9 +++++---- extensions/libipt_TTL.c | 9 +++++---- extensions/libipt_ULOG.c | 11 ++++++----- extensions/libipt_addrtype.c | 24 ++++++++++++------------ extensions/libipt_ah.c | 5 +++-- extensions/libipt_ecn.c | 9 +++++---- extensions/libipt_icmp.c | 5 +++-- extensions/libipt_realm.c | 5 +++-- extensions/libipt_ttl.c | 12 ++++++------ extensions/libxt_CHECKSUM.c | 5 +++-- extensions/libxt_CLASSIFY.c | 5 +++-- extensions/libxt_CONNMARK.c | 13 +++++++------ extensions/libxt_CONNSECMARK.c | 7 ++++--- extensions/libxt_CT.c | 13 +++++++------ extensions/libxt_DSCP.c | 7 ++++--- extensions/libxt_IDLETIMER.c | 8 ++++---- extensions/libxt_LED.c | 4 ++-- extensions/libxt_MARK.c | 10 +++++----- extensions/libxt_NFLOG.c | 11 ++++++----- extensions/libxt_NFQUEUE.c | 7 ++++--- extensions/libxt_RATEEST.c | 9 +++++---- extensions/libxt_SECMARK.c | 5 +++-- extensions/libxt_SET.c | 7 ++++--- extensions/libxt_TCPMSS.c | 7 ++++--- extensions/libxt_TCPOPTSTRIP.c | 4 ++-- extensions/libxt_TOS.c | 5 +++-- extensions/libxt_TPROXY.c | 8 ++++---- extensions/libxt_cluster.c | 11 ++++++----- extensions/libxt_comment.c | 5 +++-- extensions/libxt_connbytes.c | 9 +++++---- extensions/libxt_connlimit.c | 7 ++++--- extensions/libxt_connmark.c | 3 ++- extensions/libxt_conntrack.c | 2 +- extensions/libxt_cpu.c | 5 +++-- extensions/libxt_dccp.c | 15 ++++++++------- extensions/libxt_dscp.c | 7 ++++--- extensions/libxt_esp.c | 5 +++-- extensions/libxt_hashlimit.c | 20 ++++++++++---------- extensions/libxt_helper.c | 5 +++-- extensions/libxt_iprange.c | 3 ++- extensions/libxt_ipvs.c | 3 ++- extensions/libxt_length.c | 5 +++-- extensions/libxt_limit.c | 8 ++++---- extensions/libxt_mac.c | 5 +++-- extensions/libxt_mark.c | 2 +- extensions/libxt_multiport.c | 13 +++++++------ extensions/libxt_osf.c | 10 +++++----- extensions/libxt_owner.c | 6 +++--- extensions/libxt_physdev.c | 13 +++++++------ extensions/libxt_pkttype.c | 5 +++-- extensions/libxt_policy.c | 21 ++++++++++++--------- extensions/libxt_quota.c | 5 +++-- extensions/libxt_rateest.c | 31 ++++++++++++++++--------------- extensions/libxt_recent.c | 23 ++++++++++++----------- extensions/libxt_sctp.c | 13 +++++++------ extensions/libxt_set.c | 7 ++++--- extensions/libxt_state.c | 5 +++-- extensions/libxt_statistic.c | 11 ++++++----- extensions/libxt_string.c | 15 ++++++++------- extensions/libxt_tcp.c | 17 +++++++++-------- extensions/libxt_tcpmss.c | 5 +++-- extensions/libxt_time.c | 18 +++++++++--------- extensions/libxt_tos.c | 2 +- extensions/libxt_u32.c | 5 +++-- extensions/libxt_udp.c | 11 ++++++----- extensions/tos_values.c | 2 +- include/xtables.h.in | 2 ++ 88 files changed, 429 insertions(+), 357 deletions(-) diff --git a/extensions/libip6t_HL.c b/extensions/libip6t_HL.c index bff06111..eeab0c93 100644 --- a/extensions/libip6t_HL.c +++ b/extensions/libip6t_HL.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -131,10 +132,10 @@ static void HL_print(const void *ip, const struct xt_entry_target *target, } static const struct option HL_opts[] = { - { "hl-set", 1, NULL, '1' }, - { "hl-dec", 1, NULL, '2' }, - { "hl-inc", 1, NULL, '3' }, - { .name = NULL } + {.name = "hl-set", .has_arg = true, .val = '1'}, + {.name = "hl-dec", .has_arg = true, .val = '2'}, + {.name = "hl-inc", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static struct xtables_target hl_tg6_reg = { diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c index ff9edc68..727ce6a3 100644 --- a/extensions/libip6t_LOG.c +++ b/extensions/libip6t_LOG.c @@ -1,4 +1,5 @@ /* Shared library add-on to ip6tables to add LOG support. */ +#include #include #include #include @@ -30,14 +31,14 @@ static void LOG_help(void) } static const struct option LOG_opts[] = { - { .name = "log-level", .has_arg = 1, .val = '!' }, - { .name = "log-prefix", .has_arg = 1, .val = '#' }, - { .name = "log-tcp-sequence", .has_arg = 0, .val = '1' }, - { .name = "log-tcp-options", .has_arg = 0, .val = '2' }, - { .name = "log-ip-options", .has_arg = 0, .val = '3' }, - { .name = "log-uid", .has_arg = 0, .val = '4' }, - { .name = "log-macdecode", .has_arg = 0, .val = '5' }, - { .name = NULL } + {.name = "log-level", .has_arg = true, .val = '!'}, + {.name = "log-prefix", .has_arg = true, .val = '#'}, + {.name = "log-tcp-sequence", .has_arg = false, .val = '1'}, + {.name = "log-tcp-options", .has_arg = false, .val = '2'}, + {.name = "log-ip-options", .has_arg = false, .val = '3'}, + {.name = "log-uid", .has_arg = false, .val = '4'}, + {.name = "log-macdecode", .has_arg = false, .val = '5'}, + XT_GETOPT_TABLEEND, }; static void LOG_init(struct xt_entry_target *t) diff --git a/extensions/libip6t_REJECT.c b/extensions/libip6t_REJECT.c index b8195d7f..94d26942 100644 --- a/extensions/libip6t_REJECT.c +++ b/extensions/libip6t_REJECT.c @@ -5,6 +5,7 @@ * ported to IPv6 by Harald Welte * */ +#include #include #include #include @@ -61,8 +62,8 @@ static void REJECT_help(void) } static const struct option REJECT_opts[] = { - { "reject-with", 1, NULL, '1' }, - { .name = NULL } + {.name = "reject-with", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void REJECT_init(struct xt_entry_target *t) diff --git a/extensions/libip6t_ah.c b/extensions/libip6t_ah.c index 285704c0..41c53853 100644 --- a/extensions/libip6t_ah.c +++ b/extensions/libip6t_ah.c @@ -1,4 +1,5 @@ /* Shared library add-on to ip6tables to add AH support. */ +#include #include #include #include @@ -18,10 +19,10 @@ static void ah_help(void) } static const struct option ah_opts[] = { - { .name = "ahspi", .has_arg = 1, .val = '1' }, - { .name = "ahlen", .has_arg = 1, .val = '2' }, - { .name = "ahres", .has_arg = 0, .val = '3' }, - { .name = NULL } + {.name = "ahspi", .has_arg = true, .val = '1'}, + {.name = "ahlen", .has_arg = true, .val = '2'}, + {.name = "ahres", .has_arg = false, .val = '3'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libip6t_dst.c b/extensions/libip6t_dst.c index 72df6ad0..9e4875ee 100644 --- a/extensions/libip6t_dst.c +++ b/extensions/libip6t_dst.c @@ -1,4 +1,5 @@ /* Shared library add-on to ip6tables to add Dst header support. */ +#include #include #include #include @@ -22,10 +23,10 @@ IP6T_OPTS_OPTSNR); } static const struct option dst_opts[] = { - { .name = "dst-len", .has_arg = 1, .val = '1' }, - { .name = "dst-opts", .has_arg = 1, .val = '2' }, - { .name = "dst-not-strict", .has_arg = 1, .val = '3' }, - { .name = NULL } + {.name = "dst-len", .has_arg = true, .val = '1'}, + {.name = "dst-opts", .has_arg = true, .val = '2'}, + {.name = "dst-not-strict", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libip6t_frag.c b/extensions/libip6t_frag.c index 5a280cc1..dd23cda6 100644 --- a/extensions/libip6t_frag.c +++ b/extensions/libip6t_frag.c @@ -1,4 +1,5 @@ /* Shared library add-on to ip6tables to add Fragmentation header support. */ +#include #include #include #include @@ -21,13 +22,13 @@ static void frag_help(void) } static const struct option frag_opts[] = { - { .name = "fragid", .has_arg = 1, .val = '1' }, - { .name = "fraglen", .has_arg = 1, .val = '2' }, - { .name = "fragres", .has_arg = 0, .val = '3' }, - { .name = "fragfirst", .has_arg = 0, .val = '4' }, - { .name = "fragmore", .has_arg = 0, .val = '5' }, - { .name = "fraglast", .has_arg = 0, .val = '6' }, - { .name = NULL } + {.name = "fragid", .has_arg = true, .val = '1'}, + {.name = "fraglen", .has_arg = true, .val = '2'}, + {.name = "fragres", .has_arg = false, .val = '3'}, + {.name = "fragfirst", .has_arg = false, .val = '4'}, + {.name = "fragmore", .has_arg = false, .val = '5'}, + {.name = "fraglast", .has_arg = false, .val = '6'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libip6t_hbh.c b/extensions/libip6t_hbh.c index 520ec9ed..cddd615f 100644 --- a/extensions/libip6t_hbh.c +++ b/extensions/libip6t_hbh.c @@ -25,10 +25,10 @@ IP6T_OPTS_OPTSNR); } static const struct option hbh_opts[] = { - { "hbh-len", 1, NULL, '1' }, - { "hbh-opts", 1, NULL, '2' }, - { "hbh-not-strict", 1, NULL, '3' }, - { .name = NULL } + {.name = "hbh-len", .has_arg = true, .val = '1'}, + {.name = "hbh-opts", .has_arg = true, .val = '2'}, + {.name = "hbh-not-strict", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libip6t_hl.c b/extensions/libip6t_hl.c index 09589b19..6e58250c 100644 --- a/extensions/libip6t_hl.c +++ b/extensions/libip6t_hl.c @@ -5,7 +5,7 @@ * This program is released under the terms of GNU GPL * Cleanups by Stephane Ouellette */ - +#include #include #include #include @@ -116,11 +116,11 @@ static void hl_save(const void *ip, const struct xt_entry_match *match) } static const struct option hl_opts[] = { - { .name = "hl", .has_arg = 1, .val = '2' }, - { .name = "hl-eq", .has_arg = 1, .val = '2' }, - { .name = "hl-lt", .has_arg = 1, .val = '3' }, - { .name = "hl-gt", .has_arg = 1, .val = '4' }, - { .name = NULL } + {.name = "hl", .has_arg = true, .val = '2'}, + {.name = "hl-eq", .has_arg = true, .val = '2'}, + {.name = "hl-lt", .has_arg = true, .val = '3'}, + {.name = "hl-gt", .has_arg = true, .val = '4'}, + XT_GETOPT_TABLEEND, }; static struct xtables_match hl_mt6_reg = { diff --git a/extensions/libip6t_icmp6.c b/extensions/libip6t_icmp6.c index fb321b3b..b8a6ec92 100644 --- a/extensions/libip6t_icmp6.c +++ b/extensions/libip6t_icmp6.c @@ -1,4 +1,5 @@ /* Shared library add-on to ip6tables to add ICMP support. */ +#include #include #include #include @@ -84,8 +85,8 @@ static void icmp6_help(void) } static const struct option icmp6_opts[] = { - { "icmpv6-type", 1, NULL, '1' }, - { .name = NULL } + {.name = "icmpv6-type", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libip6t_ipv6header.c b/extensions/libip6t_ipv6header.c index af1f5ef6..d6ce248c 100644 --- a/extensions/libip6t_ipv6header.c +++ b/extensions/libip6t_ipv6header.c @@ -6,6 +6,7 @@ on whether they contain certain headers */ #include #include +#include #include #include #include @@ -140,9 +141,9 @@ static void ipv6header_help(void) } static const struct option ipv6header_opts[] = { - { "header", 1, NULL, '1' }, - { "soft", 0, NULL, '2' }, - { .name = NULL } + {.name = "header", .has_arg = true, .val = '1'}, + {.name = "soft", .has_arg = false, .val = '2'}, + XT_GETOPT_TABLEEND, }; static void ipv6header_init(struct xt_entry_match *m) diff --git a/extensions/libip6t_mh.c b/extensions/libip6t_mh.c index 95cd65d1..54dd8c68 100644 --- a/extensions/libip6t_mh.c +++ b/extensions/libip6t_mh.c @@ -11,6 +11,7 @@ * * Based on libip6t_{icmpv6,udp}.c */ +#include #include #include #include @@ -216,8 +217,8 @@ static void mh_save(const void *ip, const struct xt_entry_match *match) } static const struct option mh_opts[] = { - { "mh-type", 1, NULL, '1' }, - { .name = NULL } + {.name = "mh-type", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static struct xtables_match mh_mt6_reg = { diff --git a/extensions/libip6t_rt.c b/extensions/libip6t_rt.c index a04023df..f1a50eb8 100644 --- a/extensions/libip6t_rt.c +++ b/extensions/libip6t_rt.c @@ -1,4 +1,5 @@ /* Shared library add-on to ip6tables to add Routing header support. */ +#include #include #include #include @@ -28,13 +29,13 @@ IP6T_RT_HOPS); } static const struct option rt_opts[] = { - { "rt-type", 1, NULL, '1' }, - { "rt-segsleft", 1, NULL, '2' }, - { "rt-len", 1, NULL, '3' }, - { "rt-0-res", 0, NULL, '4' }, - { "rt-0-addrs", 1, NULL, '5' }, - { "rt-0-not-strict", 0, NULL, '6' }, - { .name = NULL } + {.name = "rt-type", .has_arg = true, .val = '1'}, + {.name = "rt-segsleft", .has_arg = true, .val = '2'}, + {.name = "rt-len", .has_arg = true, .val = '3'}, + {.name = "rt-0-res", .has_arg = false, .val = '4'}, + {.name = "rt-0-addrs", .has_arg = true, .val = '5'}, + {.name = "rt-0-not-strict", .has_arg = false, .val = '6'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libipt_CLUSTERIP.c b/extensions/libipt_CLUSTERIP.c index 279aacff..492eefc3 100644 --- a/extensions/libipt_CLUSTERIP.c +++ b/extensions/libipt_CLUSTERIP.c @@ -3,6 +3,7 @@ * * Development of this code was funded by SuSE AG, http://www.suse.com/ */ +#include #include #include #include @@ -41,13 +42,13 @@ static void CLUSTERIP_help(void) #define PARAM_HASHINIT 0x0020 static const struct option CLUSTERIP_opts[] = { - { "new", 0, NULL, '1' }, - { "hashmode", 1, NULL, '2' }, - { "clustermac", 1, NULL, '3' }, - { "total-nodes", 1, NULL, '4' }, - { "local-node", 1, NULL, '5' }, - { "hash-init", 1, NULL, '6' }, - { .name = NULL } + {.name = "new", .has_arg = false, .val = '1'}, + {.name = "hashmode", .has_arg = true, .val = '2'}, + {.name = "clustermac", .has_arg = true, .val = '3'}, + {.name = "total-nodes", .has_arg = true, .val = '4'}, + {.name = "local-node", .has_arg = true, .val = '5'}, + {.name = "hash-init", .has_arg = true, .val = '6'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libipt_DNAT.c b/extensions/libipt_DNAT.c index 57c5888b..7afe241a 100644 --- a/extensions/libipt_DNAT.c +++ b/extensions/libipt_DNAT.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add destination-NAT support. */ +#include #include #include #include @@ -31,10 +32,10 @@ static void DNAT_help(void) } static const struct option DNAT_opts[] = { - { "to-destination", 1, NULL, '1' }, - { "random", 0, NULL, '2' }, - { "persistent", 0, NULL, '3' }, - { .name = NULL } + {.name = "to-destination", .has_arg = true, .val = '1'}, + {.name = "random", .has_arg = false, .val = '2'}, + {.name = "persistent", .has_arg = false, .val = '3'}, + XT_GETOPT_TABLEEND, }; static struct ipt_natinfo * diff --git a/extensions/libipt_ECN.c b/extensions/libipt_ECN.c index bf1f8a5a..75ea0114 100644 --- a/extensions/libipt_ECN.c +++ b/extensions/libipt_ECN.c @@ -8,6 +8,7 @@ * * $Id$ */ +#include #include #include #include @@ -32,11 +33,11 @@ static void ECN_help(void) static const struct option ECN_opts[] = { - { "ecn-tcp-remove", 0, NULL, 'F' }, - { "ecn-tcp-cwr", 1, NULL, 'G' }, - { "ecn-tcp-ece", 1, NULL, 'H' }, - { "ecn-ip-ect", 1, NULL, '9' }, - { .name = NULL } + {.name = "ecn-tcp-remove", .has_arg = false, .val = 'F'}, + {.name = "ecn-tcp-cwr", .has_arg = true, .val = 'G'}, + {.name = "ecn-tcp-ece", .has_arg = true, .val = 'H'}, + {.name = "ecn-ip-ect", .has_arg = true, .val = '9'}, + XT_GETOPT_TABLEEND, }; static int ECN_parse(int c, char **argv, int invert, unsigned int *flags, diff --git a/extensions/libipt_LOG.c b/extensions/libipt_LOG.c index 73c8f32d..0c412717 100644 --- a/extensions/libipt_LOG.c +++ b/extensions/libipt_LOG.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add LOG support. */ +#include #include #include #include @@ -30,14 +31,14 @@ static void LOG_help(void) } static const struct option LOG_opts[] = { - { .name = "log-level", .has_arg = 1, .val = '!' }, - { .name = "log-prefix", .has_arg = 1, .val = '#' }, - { .name = "log-tcp-sequence", .has_arg = 0, .val = '1' }, - { .name = "log-tcp-options", .has_arg = 0, .val = '2' }, - { .name = "log-ip-options", .has_arg = 0, .val = '3' }, - { .name = "log-uid", .has_arg = 0, .val = '4' }, - { .name = "log-macdecode", .has_arg = 0, .val = '5' }, - { .name = NULL } + {.name = "log-level", .has_arg = true, .val = '!'}, + {.name = "log-prefix", .has_arg = true, .val = '#'}, + {.name = "log-tcp-sequence", .has_arg = false, .val = '1'}, + {.name = "log-tcp-options", .has_arg = false, .val = '2'}, + {.name = "log-ip-options", .has_arg = false, .val = '3'}, + {.name = "log-uid", .has_arg = false, .val = '4'}, + {.name = "log-macdecode", .has_arg = false, .val = '5'}, + XT_GETOPT_TABLEEND, }; static void LOG_init(struct xt_entry_target *t) diff --git a/extensions/libipt_MASQUERADE.c b/extensions/libipt_MASQUERADE.c index 3386ff34..b6bbd605 100644 --- a/extensions/libipt_MASQUERADE.c +++ b/extensions/libipt_MASQUERADE.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add masquerade support. */ +#include #include #include #include @@ -20,9 +21,9 @@ static void MASQUERADE_help(void) } static const struct option MASQUERADE_opts[] = { - { "to-ports", 1, NULL, '1' }, - { "random", 0, NULL, '2' }, - { .name = NULL } + {.name = "to-ports", .has_arg = true, .val = '1'}, + {.name = "random", .has_arg = false, .val = '2'}, + XT_GETOPT_TABLEEND, }; static void MASQUERADE_init(struct xt_entry_target *t) diff --git a/extensions/libipt_NETMAP.c b/extensions/libipt_NETMAP.c index b05022b0..09262baa 100644 --- a/extensions/libipt_NETMAP.c +++ b/extensions/libipt_NETMAP.c @@ -1,7 +1,7 @@ /* Shared library add-on to iptables to add static NAT support. Author: Svenning Soerensen */ - +#include #include #include #include @@ -13,8 +13,8 @@ #define MODULENAME "NETMAP" static const struct option NETMAP_opts[] = { - { "to", 1, NULL, '1' }, - { .name = NULL } + {.name = "to", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void NETMAP_help(void) diff --git a/extensions/libipt_REDIRECT.c b/extensions/libipt_REDIRECT.c index 324d0ebf..940603a9 100644 --- a/extensions/libipt_REDIRECT.c +++ b/extensions/libipt_REDIRECT.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add redirect support. */ +#include #include #include #include @@ -22,9 +23,9 @@ static void REDIRECT_help(void) } static const struct option REDIRECT_opts[] = { - { "to-ports", 1, NULL, '1' }, - { "random", 0, NULL, '2' }, - { .name = NULL } + {.name = "to-ports", .has_arg = true, .val = '1'}, + {.name = "random", .has_arg = false, .val = '2'}, + XT_GETOPT_TABLEEND, }; static void REDIRECT_init(struct xt_entry_target *t) diff --git a/extensions/libipt_REJECT.c b/extensions/libipt_REJECT.c index 85d9e53f..8c08dd0c 100644 --- a/extensions/libipt_REJECT.c +++ b/extensions/libipt_REJECT.c @@ -2,6 +2,7 @@ * * (C) 2000 Jozsef Kadlecsik */ +#include #include #include #include @@ -76,8 +77,8 @@ static void REJECT_help(void) } static const struct option REJECT_opts[] = { - { "reject-with", 1, NULL, '1' }, - { .name = NULL } + {.name = "reject-with", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void REJECT_init(struct xt_entry_target *t) diff --git a/extensions/libipt_SAME.c b/extensions/libipt_SAME.c index ed02ef95..5fb1b5b2 100644 --- a/extensions/libipt_SAME.c +++ b/extensions/libipt_SAME.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add simple non load-balancing SNAT support. */ +#include #include #include #include @@ -25,10 +26,10 @@ static void SAME_help(void) } static const struct option SAME_opts[] = { - { "to", 1, NULL, '1' }, - { "nodst", 0, NULL, '2'}, - { "random", 0, NULL, '3' }, - { .name = NULL } + {.name = "to", .has_arg = true, .val = '1'}, + {.name = "nodst", .has_arg = false, .val = '2'}, + {.name = "random", .has_arg = false, .val = '3'}, + XT_GETOPT_TABLEEND, }; static void SAME_init(struct xt_entry_target *t) diff --git a/extensions/libipt_SNAT.c b/extensions/libipt_SNAT.c index f7c93d81..1075c793 100644 --- a/extensions/libipt_SNAT.c +++ b/extensions/libipt_SNAT.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add source-NAT support. */ +#include #include #include #include @@ -31,10 +32,10 @@ static void SNAT_help(void) } static const struct option SNAT_opts[] = { - { "to-source", 1, NULL, '1' }, - { "random", 0, NULL, '2' }, - { "persistent", 0, NULL, '3' }, - { .name = NULL } + {.name = "to-source", .has_arg = true, .val = '1'}, + {.name = "random", .has_arg = false, .val = '2'}, + {.name = "persistent", .has_arg = false, .val = '3'}, + XT_GETOPT_TABLEEND, }; static struct ipt_natinfo * diff --git a/extensions/libipt_TTL.c b/extensions/libipt_TTL.c index 4db9bbe9..2e0c2338 100644 --- a/extensions/libipt_TTL.c +++ b/extensions/libipt_TTL.c @@ -5,6 +5,7 @@ * * This program is distributed under the terms of GNU GPL */ +#include #include #include #include @@ -131,10 +132,10 @@ static void TTL_print(const void *ip, const struct xt_entry_target *target, } static const struct option TTL_opts[] = { - { "ttl-set", 1, NULL, '1' }, - { "ttl-dec", 1, NULL, '2' }, - { "ttl-inc", 1, NULL, '3' }, - { .name = NULL } + {.name = "ttl-set", .has_arg = true, .val = '1'}, + {.name = "ttl-dec", .has_arg = true, .val = '2'}, + {.name = "ttl-inc", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static struct xtables_target ttl_tg_reg = { diff --git a/extensions/libipt_ULOG.c b/extensions/libipt_ULOG.c index 4d009b75..46928c34 100644 --- a/extensions/libipt_ULOG.c +++ b/extensions/libipt_ULOG.c @@ -9,6 +9,7 @@ * * libipt_ULOG.c,v 1.7 2001/01/30 11:55:02 laforge Exp */ +#include #include #include #include @@ -42,11 +43,11 @@ static void ULOG_help(void) } static const struct option ULOG_opts[] = { - {"ulog-nlgroup", 1, NULL, '!'}, - {"ulog-prefix", 1, NULL, '#'}, - {"ulog-cprange", 1, NULL, 'A'}, - {"ulog-qthreshold", 1, NULL, 'B'}, - { .name = NULL } + {.name = "ulog-nlgroup", .has_arg = true, .val = '!'}, + {.name = "ulog-prefix", .has_arg = true, .val = '#'}, + {.name = "ulog-cprange", .has_arg = true, .val = 'A'}, + {.name = "ulog-qthreshold", .has_arg = true, .val = 'B'}, + XT_GETOPT_TABLEEND, }; static void ULOG_init(struct xt_entry_target *t) diff --git a/extensions/libipt_addrtype.c b/extensions/libipt_addrtype.c index ad63dcf7..9391b4e6 100644 --- a/extensions/libipt_addrtype.c +++ b/extensions/libipt_addrtype.c @@ -1,7 +1,7 @@ /* Shared library add-on to iptables to add addrtype matching support * * This program is released under the terms of GNU GPL */ - +#include #include #include #include @@ -304,23 +304,23 @@ static void addrtype_save_v1(const void *ip, const struct xt_entry_match *match) } static const struct option addrtype_opts[] = { - { "src-type", 1, NULL, '1' }, - { "dst-type", 1, NULL, '2' }, - { .name = NULL } + {.name = "src-type", .has_arg = true, .val = '1'}, + {.name = "dst-type", .has_arg = true, .val = '2'}, + XT_GETOPT_TABLEEND, }; static const struct option addrtype_opts_v0[] = { - { "src-type", 1, NULL, '1' }, - { "dst-type", 1, NULL, '2' }, - { .name = NULL } + {.name = "src-type", .has_arg = true, .val = '1'}, + {.name = "dst-type", .has_arg = true, .val = '2'}, + XT_GETOPT_TABLEEND, }; static const struct option addrtype_opts_v1[] = { - { "src-type", 1, NULL, '1' }, - { "dst-type", 1, NULL, '2' }, - { "limit-iface-in", 0, NULL, '3' }, - { "limit-iface-out", 0, NULL, '4' }, - { .name = NULL } + {.name = "src-type", .has_arg = true, .val = '1'}, + {.name = "dst-type", .has_arg = true, .val = '2'}, + {.name = "limit-iface-in", .has_arg = false, .val = '3'}, + {.name = "limit-iface-out", .has_arg = false, .val = '4'}, + XT_GETOPT_TABLEEND, }; static struct xtables_match addrtype_mt_reg[] = { diff --git a/extensions/libipt_ah.c b/extensions/libipt_ah.c index 170cd8b9..58ed6d15 100644 --- a/extensions/libipt_ah.c +++ b/extensions/libipt_ah.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add AH support. */ +#include #include #include #include @@ -17,8 +18,8 @@ static void ah_help(void) } static const struct option ah_opts[] = { - { "ahspi", 1, NULL, '1' }, - { .name = NULL } + {.name = "ahspi", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libipt_ecn.c b/extensions/libipt_ecn.c index ec3ff2da..3f1fc3bd 100644 --- a/extensions/libipt_ecn.c +++ b/extensions/libipt_ecn.c @@ -7,6 +7,7 @@ * libipt_ecn.c borrowed heavily from libipt_dscp.c * */ +#include #include #include #include @@ -25,10 +26,10 @@ static void ecn_help(void) } static const struct option ecn_opts[] = { - { .name = "ecn-tcp-cwr", .has_arg = 0, .val = 'F' }, - { .name = "ecn-tcp-ece", .has_arg = 0, .val = 'G' }, - { .name = "ecn-ip-ect", .has_arg = 1, .val = 'H' }, - { .name = NULL } + {.name = "ecn-tcp-cwr", .has_arg = false, .val = 'F'}, + {.name = "ecn-tcp-ece", .has_arg = false, .val = 'G'}, + {.name = "ecn-ip-ect", .has_arg = true, .val = 'H'}, + XT_GETOPT_TABLEEND, }; static int ecn_parse(int c, char **argv, int invert, unsigned int *flags, diff --git a/extensions/libipt_icmp.c b/extensions/libipt_icmp.c index 37b2fdcd..28985b94 100644 --- a/extensions/libipt_icmp.c +++ b/extensions/libipt_icmp.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add ICMP support. */ +#include #include #include #include @@ -108,8 +109,8 @@ static void icmp_help(void) } static const struct option icmp_opts[] = { - { "icmp-type", 1, NULL, '1' }, - { .name = NULL } + {.name = "icmp-type", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libipt_realm.c b/extensions/libipt_realm.c index cd4b324b..1d485464 100644 --- a/extensions/libipt_realm.c +++ b/extensions/libipt_realm.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add realm matching support. */ +#include #include #include #include @@ -23,8 +24,8 @@ static void realm_help(void) } static const struct option realm_opts[] = { - { "realm", 1, NULL, '1' }, - { .name = NULL } + {.name = "realm", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; struct realmname { diff --git a/extensions/libipt_ttl.c b/extensions/libipt_ttl.c index e2fbcd5b..34d0f235 100644 --- a/extensions/libipt_ttl.c +++ b/extensions/libipt_ttl.c @@ -4,7 +4,7 @@ * $Id$ * * This program is released under the terms of GNU GPL */ - +#include #include #include #include @@ -139,11 +139,11 @@ static void ttl_save(const void *ip, const struct xt_entry_match *match) } static const struct option ttl_opts[] = { - { "ttl", 1, NULL, '2' }, - { "ttl-eq", 1, NULL, '2'}, - { "ttl-lt", 1, NULL, '3'}, - { "ttl-gt", 1, NULL, '4'}, - { .name = NULL } + {.name = "ttl", .has_arg = true, .val = '2'}, + {.name = "ttl-eq", .has_arg = true, .val = '2'}, + {.name = "ttl-lt", .has_arg = true, .val = '3'}, + {.name = "ttl-gt", .has_arg = true, .val = '4'}, + XT_GETOPT_TABLEEND, }; static struct xtables_match ttl_mt_reg = { diff --git a/extensions/libxt_CHECKSUM.c b/extensions/libxt_CHECKSUM.c index 9a24443b..101a54ca 100644 --- a/extensions/libxt_CHECKSUM.c +++ b/extensions/libxt_CHECKSUM.c @@ -8,6 +8,7 @@ * * libxt_CHECKSUM.c borrowed some bits from libipt_ECN.c */ +#include #include #include #include @@ -24,8 +25,8 @@ static void CHECKSUM_help(void) } static const struct option CHECKSUM_opts[] = { - { "checksum-fill", 0, NULL, 'F' }, - { .name = NULL } + {.name = "checksum-fill", .has_arg = false, .val = 'F'}, + XT_GETOPT_TABLEEND, }; static int CHECKSUM_parse(int c, char **argv, int invert, unsigned int *flags, diff --git a/extensions/libxt_CLASSIFY.c b/extensions/libxt_CLASSIFY.c index 82b8f4e0..ab5127c3 100644 --- a/extensions/libxt_CLASSIFY.c +++ b/extensions/libxt_CLASSIFY.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add CLASSIFY target support. */ +#include #include #include #include @@ -19,8 +20,8 @@ CLASSIFY_help(void) } static const struct option CLASSIFY_opts[] = { - { "set-class", 1, NULL, '1' }, - { .name = NULL } + {.name = "set-class", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static int CLASSIFY_string_to_priority(const char *s, unsigned int *p) diff --git a/extensions/libxt_CONNMARK.c b/extensions/libxt_CONNMARK.c index 6aba5f3c..67728775 100644 --- a/extensions/libxt_CONNMARK.c +++ b/extensions/libxt_CONNMARK.c @@ -19,6 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include @@ -49,11 +50,11 @@ static void CONNMARK_help(void) } static const struct option CONNMARK_opts[] = { - { "set-mark", 1, NULL, '1' }, - { "save-mark", 0, NULL, '2' }, - { "restore-mark", 0, NULL, '3' }, - { "mask", 1, NULL, '4' }, - { .name = NULL } + {.name = "set-mark", .has_arg = true, .val = '1'}, + {.name = "save-mark", .has_arg = false, .val = '2'}, + {.name = "restore-mark", .has_arg = false, .val = '3'}, + {.name = "mask", .has_arg = true, .val = '4'}, + XT_GETOPT_TABLEEND, }; static const struct option connmark_tg_opts[] = { @@ -67,7 +68,7 @@ static const struct option connmark_tg_opts[] = { {.name = "ctmask", .has_arg = true, .val = 'c'}, {.name = "nfmask", .has_arg = true, .val = 'n'}, {.name = "mask", .has_arg = true, .val = 'm'}, - {.name = NULL}, + XT_GETOPT_TABLEEND, }; static void connmark_tg_help(void) diff --git a/extensions/libxt_CONNSECMARK.c b/extensions/libxt_CONNSECMARK.c index d95339f3..8df23639 100644 --- a/extensions/libxt_CONNSECMARK.c +++ b/extensions/libxt_CONNSECMARK.c @@ -5,6 +5,7 @@ * * Copyright (C) 2006 Red Hat, Inc., James Morris */ +#include #include #include #include @@ -23,9 +24,9 @@ static void CONNSECMARK_help(void) } static const struct option CONNSECMARK_opts[] = { - { "save", 0, NULL, '1' }, - { "restore", 0, NULL, '2' }, - { .name = NULL } + {.name = "save", .has_arg = false, .val = '1'}, + {.name = "restore", .has_arg = false, .val = '2'}, + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_CT.c b/extensions/libxt_CT.c index 6be6ea05..8952b757 100644 --- a/extensions/libxt_CT.c +++ b/extensions/libxt_CT.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -28,12 +29,12 @@ enum ct_options { }; static const struct option ct_opts[] = { - { "notrack", 0, NULL, CT_OPT_NOTRACK }, - { "helper", 1, NULL, CT_OPT_HELPER }, - { "ctevents", 1, NULL, CT_OPT_CTEVENTS }, - { "expevents", 1, NULL, CT_OPT_EXPEVENTS }, - { "zone", 1, NULL, CT_OPT_ZONE }, - { .name = NULL }, + {.name = "notrack", .has_arg = false, .val = CT_OPT_NOTRACK}, + {.name = "helper", .has_arg = true, .val = CT_OPT_HELPER}, + {.name = "ctevents", .has_arg = true, .val = CT_OPT_CTEVENTS}, + {.name = "expevents", .has_arg = true, .val = CT_OPT_EXPEVENTS}, + {.name = "zone", .has_arg = true, .val = CT_OPT_ZONE}, + XT_GETOPT_TABLEEND, }; struct event_tbl { diff --git a/extensions/libxt_DSCP.c b/extensions/libxt_DSCP.c index 82ac10c3..9a698248 100644 --- a/extensions/libxt_DSCP.c +++ b/extensions/libxt_DSCP.c @@ -9,6 +9,7 @@ * * --set-class added by Iain Barnes */ +#include #include #include #include @@ -38,9 +39,9 @@ static void DSCP_help(void) } static const struct option DSCP_opts[] = { - { "set-dscp", 1, NULL, 'F' }, - { "set-dscp-class", 1, NULL, 'G' }, - { .name = NULL } + {.name = "set-dscp", .has_arg = true, .val = 'F'}, + {.name = "set-dscp-class", .has_arg = true, .val = 'G'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_IDLETIMER.c b/extensions/libxt_IDLETIMER.c index c931d0ee..12573a4f 100644 --- a/extensions/libxt_IDLETIMER.c +++ b/extensions/libxt_IDLETIMER.c @@ -20,7 +20,7 @@ * 02110-1301 USA * */ - +#include #include #include #include @@ -36,9 +36,9 @@ enum { }; static const struct option idletimer_tg_opts[] = { - { .name = "timeout", .has_arg = true, .flag = 0, .val = 't' }, - { .name = "label", .has_arg = true, .flag = 0, .val = 'l' }, - { .name = NULL } + {.name = "timeout", .has_arg = true, .val = 't'}, + {.name = "label", .has_arg = true, .val = 'l'}, + XT_GETOPT_TABLEEND, }; static void idletimer_tg_help(void) diff --git a/extensions/libxt_LED.c b/extensions/libxt_LED.c index af0e091e..ca1b6ed4 100644 --- a/extensions/libxt_LED.c +++ b/extensions/libxt_LED.c @@ -9,7 +9,7 @@ * published by the Free Software Foundation. * */ - +#include #include #include #include @@ -24,7 +24,7 @@ static const struct option LED_opts[] = { {.name = "led-trigger-id", .has_arg = true, .val = 'i'}, {.name = "led-delay", .has_arg = true, .val = 'd'}, {.name = "led-always-blink", .has_arg = false, .val = 'a'}, - {.name = NULL}, + XT_GETOPT_TABLEEND, }; static void LED_help(void) diff --git a/extensions/libxt_MARK.c b/extensions/libxt_MARK.c index dbfc7c0c..39996d0a 100644 --- a/extensions/libxt_MARK.c +++ b/extensions/libxt_MARK.c @@ -40,10 +40,10 @@ static void MARK_help(void) } static const struct option MARK_opts[] = { - { "set-mark", 1, NULL, '1' }, - { "and-mark", 1, NULL, '2' }, - { "or-mark", 1, NULL, '3' }, - { .name = NULL } + {.name = "set-mark", .has_arg = true, .val = '1'}, + {.name = "and-mark", .has_arg = true, .val = '2'}, + {.name = "or-mark", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static const struct option mark_tg_opts[] = { @@ -52,7 +52,7 @@ static const struct option mark_tg_opts[] = { {.name = "and-mark", .has_arg = true, .val = '&'}, {.name = "or-mark", .has_arg = true, .val = '|'}, {.name = "xor-mark", .has_arg = true, .val = '^'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static void mark_tg_help(void) diff --git a/extensions/libxt_NFLOG.c b/extensions/libxt_NFLOG.c index e2185d5a..2cf279ad 100644 --- a/extensions/libxt_NFLOG.c +++ b/extensions/libxt_NFLOG.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -15,11 +16,11 @@ enum { }; static const struct option NFLOG_opts[] = { - { "nflog-group", 1, NULL, NFLOG_GROUP }, - { "nflog-prefix", 1, NULL, NFLOG_PREFIX }, - { "nflog-range", 1, NULL, NFLOG_RANGE }, - { "nflog-threshold", 1, NULL, NFLOG_THRESHOLD }, - { .name = NULL } + {.name = "nflog-group", .has_arg = true, .val = NFLOG_GROUP}, + {.name = "nflog-prefix", .has_arg = true, .val = NFLOG_PREFIX}, + {.name = "nflog-range", .has_arg = true, .val = NFLOG_RANGE}, + {.name = "nflog-threshold", .has_arg = true, .val = NFLOG_THRESHOLD}, + XT_GETOPT_TABLEEND, }; static void NFLOG_help(void) diff --git a/extensions/libxt_NFQUEUE.c b/extensions/libxt_NFQUEUE.c index 2d9d98ab..e412153a 100644 --- a/extensions/libxt_NFQUEUE.c +++ b/extensions/libxt_NFQUEUE.c @@ -5,6 +5,7 @@ * This program is distributed under the terms of GNU GPL v2, 1991 * */ +#include #include #include #include @@ -31,9 +32,9 @@ static void NFQUEUE_help_v1(void) } static const struct option NFQUEUE_opts[] = { - { "queue-num", 1, NULL, 'F' }, - { "queue-balance", 1, NULL, 'B' }, - { .name = NULL } + {.name = "queue-num", .has_arg = true, .val = 'F'}, + {.name = "queue-balance", .has_arg = true, .val = 'B'}, + XT_GETOPT_TABLEEND, }; static void exit_badqueue(const char *s) diff --git a/extensions/libxt_RATEEST.c b/extensions/libxt_RATEEST.c index 4b7831ff..d89f8184 100644 --- a/extensions/libxt_RATEEST.c +++ b/extensions/libxt_RATEEST.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -31,10 +32,10 @@ enum RATEEST_options { }; static const struct option RATEEST_opts[] = { - { "rateest-name", 1, NULL, RATEEST_OPT_NAME }, - { "rateest-interval", 1, NULL, RATEEST_OPT_INTERVAL }, - { "rateest-ewmalog", 1, NULL, RATEEST_OPT_EWMALOG }, - { .name = NULL }, + {.name = "rateest-name", .has_arg = true, .val = RATEEST_OPT_NAME}, + {.name = "rateest-interval", .has_arg = true, .val = RATEEST_OPT_INTERVAL}, + {.name = "rateest-ewmalog", .has_arg = true, .val = RATEEST_OPT_EWMALOG}, + XT_GETOPT_TABLEEND, }; /* Copied from iproute */ diff --git a/extensions/libxt_SECMARK.c b/extensions/libxt_SECMARK.c index 2152b6fc..9e231eee 100644 --- a/extensions/libxt_SECMARK.c +++ b/extensions/libxt_SECMARK.c @@ -5,6 +5,7 @@ * * Copyright (C) 2006 Red Hat, Inc., James Morris */ +#include #include #include #include @@ -22,8 +23,8 @@ static void SECMARK_help(void) } static const struct option SECMARK_opts[] = { - { "selctx", 1, NULL, '1' }, - { .name = NULL } + {.name = "selctx", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static int SECMARK_parse(int c, char **argv, int invert, unsigned int *flags, diff --git a/extensions/libxt_SET.c b/extensions/libxt_SET.c index f6386a9e..c05811e6 100644 --- a/extensions/libxt_SET.c +++ b/extensions/libxt_SET.c @@ -9,6 +9,7 @@ */ /* Shared library add-on to iptables to add IP set mangling target. */ +#include #include #include #include @@ -32,9 +33,9 @@ set_target_help(void) } static const struct option set_target_opts[] = { - { .name = "add-set", .has_arg = true, .val = '1'}, - { .name = "del-set", .has_arg = true, .val = '2'}, - { .name = NULL } + {.name = "add-set", .has_arg = true, .val = '1'}, + {.name = "del-set", .has_arg = true, .val = '2'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_TCPMSS.c b/extensions/libxt_TCPMSS.c index ac9e2d0d..b24789a2 100644 --- a/extensions/libxt_TCPMSS.c +++ b/extensions/libxt_TCPMSS.c @@ -2,6 +2,7 @@ * * Copyright (c) 2000 Marc Boucher */ +#include #include #include #include @@ -36,9 +37,9 @@ static void TCPMSS_help6(void) } static const struct option TCPMSS_opts[] = { - { "set-mss", 1, NULL, '1' }, - { "clamp-mss-to-pmtu", 0, NULL, '2' }, - { .name = NULL } + {.name = "set-mss", .has_arg = true, .val = '1'}, + {.name = "clamp-mss-to-pmtu", .has_arg = false, .val = '2'}, + XT_GETOPT_TABLEEND, }; static int __TCPMSS_parse(int c, char **argv, int invert, unsigned int *flags, diff --git a/extensions/libxt_TCPOPTSTRIP.c b/extensions/libxt_TCPOPTSTRIP.c index a063d0d9..66ab46d2 100644 --- a/extensions/libxt_TCPOPTSTRIP.c +++ b/extensions/libxt_TCPOPTSTRIP.c @@ -28,7 +28,7 @@ struct tcp_optionmap { static const struct option tcpoptstrip_tg_opts[] = { {.name = "strip-options", .has_arg = true, .val = 's'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static const struct tcp_optionmap tcp_optionmap[] = { @@ -38,7 +38,7 @@ static const struct tcp_optionmap tcp_optionmap[] = { {"sack", "Selective ACK", TCPOPT_SACK}, {"timestamp", "Timestamp", TCPOPT_TIMESTAMP}, {"md5", "MD5 signature", TCPOPT_MD5SIG}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static void tcpoptstrip_tg_help(void) diff --git a/extensions/libxt_TOS.c b/extensions/libxt_TOS.c index dc60cc08..9575c050 100644 --- a/extensions/libxt_TOS.c +++ b/extensions/libxt_TOS.c @@ -5,6 +5,7 @@ * Contact: Jan Engelhardt */ #include +#include #include #include #include @@ -24,7 +25,7 @@ enum { static const struct option tos_tg_opts_v0[] = { {.name = "set-tos", .has_arg = true, .val = '='}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static const struct option tos_tg_opts[] = { @@ -32,7 +33,7 @@ static const struct option tos_tg_opts[] = { {.name = "and-tos", .has_arg = true, .val = '&'}, {.name = "or-tos", .has_arg = true, .val = '|'}, {.name = "xor-tos", .has_arg = true, .val = '^'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static void tos_tg_help_v0(void) diff --git a/extensions/libxt_TPROXY.c b/extensions/libxt_TPROXY.c index d410c52b..cd0b50a6 100644 --- a/extensions/libxt_TPROXY.c +++ b/extensions/libxt_TPROXY.c @@ -15,10 +15,10 @@ #include static const struct option tproxy_tg_opts[] = { - { .name = "on-port", .has_arg = 1, .val = '1'}, - { .name = "on-ip", .has_arg = 1, .val = '2'}, - { .name = "tproxy-mark", .has_arg = 1, .val = '3'}, - {NULL}, + {.name = "on-port", .has_arg = true, .val = '1'}, + {.name = "on-ip", .has_arg = true, .val = '2'}, + {.name = "tproxy-mark", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; enum { diff --git a/extensions/libxt_cluster.c b/extensions/libxt_cluster.c index ea5d9fb4..15910455 100644 --- a/extensions/libxt_cluster.c +++ b/extensions/libxt_cluster.c @@ -5,6 +5,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include @@ -38,11 +39,11 @@ enum { }; static const struct option cluster_opts[] = { - { "cluster-total-nodes", 1, NULL, CLUSTER_OPT_TOTAL_NODES }, - { "cluster-local-node", 1, NULL, CLUSTER_OPT_LOCAL_NODE }, - { "cluster-local-nodemask", 1, NULL, CLUSTER_OPT_NODE_MASK }, - { "cluster-hash-seed", 1, NULL, CLUSTER_OPT_HASH_SEED }, - { .name = NULL } + {.name = "cluster-total-nodes", .has_arg = true, .val = CLUSTER_OPT_TOTAL_NODES}, + {.name = "cluster-local-node", .has_arg = true, .val = CLUSTER_OPT_LOCAL_NODE}, + {.name = "cluster-local-nodemask", .has_arg = true, .val = CLUSTER_OPT_NODE_MASK}, + {.name = "cluster-hash-seed", .has_arg = true, .val = CLUSTER_OPT_HASH_SEED}, + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_comment.c b/extensions/libxt_comment.c index 0068a6e4..a9325a5d 100644 --- a/extensions/libxt_comment.c +++ b/extensions/libxt_comment.c @@ -6,6 +6,7 @@ * 2004-05-12: Brad Fisher * Port to patch-o-matic-ng */ +#include #include #include #include @@ -22,8 +23,8 @@ static void comment_help(void) } static const struct option comment_opts[] = { - { "comment", 1, NULL, '1' }, - { .name = NULL } + {.name = "comment", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_connbytes.c b/extensions/libxt_connbytes.c index 5ebdd340..2e20862d 100644 --- a/extensions/libxt_connbytes.c +++ b/extensions/libxt_connbytes.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add byte tracking support. */ +#include #include #include #include @@ -18,10 +19,10 @@ static void connbytes_help(void) } static const struct option connbytes_opts[] = { - { "connbytes", 1, NULL, '1' }, - { "connbytes-dir", 1, NULL, '2' }, - { "connbytes-mode", 1, NULL, '3' }, - { .name = NULL } + {.name = "connbytes", .has_arg = true, .val = '1'}, + {.name = "connbytes-dir", .has_arg = true, .val = '2'}, + {.name = "connbytes-mode", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_connlimit.c b/extensions/libxt_connlimit.c index a2159158..b01d3012 100644 --- a/extensions/libxt_connlimit.c +++ b/extensions/libxt_connlimit.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add connection limit support. */ +#include #include #include #include @@ -18,9 +19,9 @@ static void connlimit_help(void) } static const struct option connlimit_opts[] = { - {"connlimit-above", 1, NULL, 'A'}, - {"connlimit-mask", 1, NULL, 'M'}, - { .name = NULL } + {.name = "connlimit-above", .has_arg = true, .val = 'A'}, + {.name = "connlimit-mask", .has_arg = true, .val = 'M'}, + XT_GETOPT_TABLEEND, }; static void connlimit_init(struct xt_entry_match *match) diff --git a/extensions/libxt_connmark.c b/extensions/libxt_connmark.c index 38aa5630..6bb26894 100644 --- a/extensions/libxt_connmark.c +++ b/extensions/libxt_connmark.c @@ -19,6 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include @@ -46,7 +47,7 @@ static void connmark_mt_help(void) static const struct option connmark_mt_opts[] = { {.name = "mark", .has_arg = true, .val = '1'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_conntrack.c b/extensions/libxt_conntrack.c index 5557d3ea..6c4a9cd1 100644 --- a/extensions/libxt_conntrack.c +++ b/extensions/libxt_conntrack.c @@ -88,7 +88,7 @@ static const struct option conntrack_mt_opts_v0[] = { {.name = "ctrepldst", .has_arg = true, .val = '6'}, {.name = "ctstatus", .has_arg = true, .val = '7'}, {.name = "ctexpire", .has_arg = true, .val = '8'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static const struct option conntrack_mt_opts[] = { diff --git a/extensions/libxt_cpu.c b/extensions/libxt_cpu.c index 66b9d831..ee029960 100644 --- a/extensions/libxt_cpu.c +++ b/extensions/libxt_cpu.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add CPU match support. */ +#include #include #include #include @@ -15,8 +16,8 @@ static void cpu_help(void) } static const struct option cpu_opts[] = { - { "cpu", 1, NULL, '1' }, - { .name = NULL } + {.name = "cpu", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_dccp.c b/extensions/libxt_dccp.c index 8d0b13a2..104f46fa 100644 --- a/extensions/libxt_dccp.c +++ b/extensions/libxt_dccp.c @@ -5,6 +5,7 @@ * This program is distributed under the terms of GNU GPL v2, 1991 * */ +#include #include #include #include @@ -43,13 +44,13 @@ static void dccp_help(void) } static const struct option dccp_opts[] = { - { .name = "source-port", .has_arg = 1, .val = '1' }, - { .name = "sport", .has_arg = 1, .val = '1' }, - { .name = "destination-port", .has_arg = 1, .val = '2' }, - { .name = "dport", .has_arg = 1, .val = '2' }, - { .name = "dccp-types", .has_arg = 1, .val = '3' }, - { .name = "dccp-option", .has_arg = 1, .val = '4' }, - { .name = NULL } + {.name = "source-port", .has_arg = true, .val = '1'}, + {.name = "sport", .has_arg = true, .val = '1'}, + {.name = "destination-port", .has_arg = true, .val = '2'}, + {.name = "dport", .has_arg = true, .val = '2'}, + {.name = "dccp-types", .has_arg = true, .val = '3'}, + {.name = "dccp-option", .has_arg = true, .val = '4'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_dscp.c b/extensions/libxt_dscp.c index 1569f7d4..4f81f2f1 100644 --- a/extensions/libxt_dscp.c +++ b/extensions/libxt_dscp.c @@ -12,6 +12,7 @@ * http://www.iana.org/assignments/dscp-registry * */ +#include #include #include #include @@ -38,9 +39,9 @@ static void dscp_help(void) } static const struct option dscp_opts[] = { - { "dscp", 1, NULL, 'F' }, - { "dscp-class", 1, NULL, 'G' }, - { .name = NULL } + {.name = "dscp", .has_arg = true, .val = 'F'}, + {.name = "dscp-class", .has_arg = true, .val = 'G'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_esp.c b/extensions/libxt_esp.c index 18218f47..070a6a45 100644 --- a/extensions/libxt_esp.c +++ b/extensions/libxt_esp.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add ESP support. */ +#include #include #include #include @@ -19,8 +20,8 @@ static void esp_help(void) } static const struct option esp_opts[] = { - { "espspi", 1, NULL, '1' }, - { .name = NULL } + {.name = "espspi", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static u_int32_t diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index 7442dfcf..fbf19d2b 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -67,15 +67,15 @@ static void hashlimit_mt_help(void) } static const struct option hashlimit_opts[] = { - { "hashlimit", 1, NULL, '%' }, - { "hashlimit-burst", 1, NULL, '$' }, - { "hashlimit-htable-size", 1, NULL, '&' }, - { "hashlimit-htable-max", 1, NULL, '*' }, - { "hashlimit-htable-gcinterval", 1, NULL, '(' }, - { "hashlimit-htable-expire", 1, NULL, ')' }, - { "hashlimit-mode", 1, NULL, '_' }, - { "hashlimit-name", 1, NULL, '"' }, - { .name = NULL } + {.name = "hashlimit", .has_arg = true, .val = '%'}, + {.name = "hashlimit-burst", .has_arg = true, .val = '$'}, + {.name = "hashlimit-htable-size", .has_arg = true, .val = '&'}, + {.name = "hashlimit-htable-max", .has_arg = true, .val = '*'}, + {.name = "hashlimit-htable-gcinterval", .has_arg = true, .val = '('}, + {.name = "hashlimit-htable-expire", .has_arg = true, .val = ')'}, + {.name = "hashlimit-mode", .has_arg = true, .val = '_'}, + {.name = "hashlimit-name", .has_arg = true, .val = '"'}, + XT_GETOPT_TABLEEND, }; static const struct option hashlimit_mt_opts[] = { @@ -91,7 +91,7 @@ static const struct option hashlimit_mt_opts[] = { {.name = "hashlimit-htable-expire", .has_arg = true, .val = ')'}, {.name = "hashlimit-mode", .has_arg = true, .val = '_'}, {.name = "hashlimit-name", .has_arg = true, .val = '"'}, - {}, + XT_GETOPT_TABLEEND, }; static diff --git a/extensions/libxt_helper.c b/extensions/libxt_helper.c index 35b5f152..e9551bc7 100644 --- a/extensions/libxt_helper.c +++ b/extensions/libxt_helper.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add related packet matching support. */ +#include #include #include #include @@ -16,8 +17,8 @@ static void helper_help(void) } static const struct option helper_opts[] = { - { "helper", 1, NULL, '1' }, - { .name = NULL } + {.name = "helper", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_iprange.c b/extensions/libxt_iprange.c index 55a2f84b..6b511b56 100644 --- a/extensions/libxt_iprange.c +++ b/extensions/libxt_iprange.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add IP range matching support. */ +#include #include #include #include @@ -39,7 +40,7 @@ static void iprange_mt_help(void) static const struct option iprange_mt_opts[] = { {.name = "src-range", .has_arg = true, .val = '1'}, {.name = "dst-range", .has_arg = true, .val = '2'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_ipvs.c b/extensions/libxt_ipvs.c index 6843551c..493d975a 100644 --- a/extensions/libxt_ipvs.c +++ b/extensions/libxt_ipvs.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,7 @@ static const struct option ipvs_mt_opts[] = { { .name = "vdir", .has_arg = true, .val = '4' }, { .name = "vmethod", .has_arg = true, .val = '5' }, { .name = "vportctl", .has_arg = true, .val = '6' }, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static void ipvs_mt_help(void) diff --git a/extensions/libxt_length.c b/extensions/libxt_length.c index 96e8b6cd..aeba52f9 100644 --- a/extensions/libxt_length.c +++ b/extensions/libxt_length.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add packet length matching support. */ +#include #include #include #include @@ -17,8 +18,8 @@ static void length_help(void) } static const struct option length_opts[] = { - { "length", 1, NULL, '1' }, - { .name = NULL } + {.name = "length", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static u_int16_t diff --git a/extensions/libxt_limit.c b/extensions/libxt_limit.c index c836303c..3f94e216 100644 --- a/extensions/libxt_limit.c +++ b/extensions/libxt_limit.c @@ -3,7 +3,7 @@ * Jérôme de Vivie * Hervé Eychenne */ - +#include #include #include #include @@ -29,9 +29,9 @@ XT_LIMIT_BURST); } static const struct option limit_opts[] = { - { "limit", 1, NULL, '%' }, - { "limit-burst", 1, NULL, '$' }, - { .name = NULL } + {.name = "limit", .has_arg = true, .val = '%'}, + {.name = "limit-burst", .has_arg = true, .val = '$'}, + XT_GETOPT_TABLEEND, }; static diff --git a/extensions/libxt_mac.c b/extensions/libxt_mac.c index 00996a0c..eb074676 100644 --- a/extensions/libxt_mac.c +++ b/extensions/libxt_mac.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add MAC address support. */ +#include #include #include #include @@ -21,8 +22,8 @@ static void mac_help(void) } static const struct option mac_opts[] = { - { "mac-source", 1, NULL, '1' }, - { .name = NULL } + {.name = "mac-source", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_mark.c b/extensions/libxt_mark.c index 8013c9a1..a2bc4f89 100644 --- a/extensions/libxt_mark.c +++ b/extensions/libxt_mark.c @@ -27,7 +27,7 @@ static void mark_mt_help(void) static const struct option mark_mt_opts[] = { {.name = "mark", .has_arg = true, .val = '1'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static int mark_mt_parse(int c, char **argv, int invert, unsigned int *flags, diff --git a/extensions/libxt_multiport.c b/extensions/libxt_multiport.c index e8a0dab5..5b823b62 100644 --- a/extensions/libxt_multiport.c +++ b/extensions/libxt_multiport.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add multiple TCP port support. */ +#include #include #include #include @@ -44,12 +45,12 @@ static void multiport_help_v1(void) } static const struct option multiport_opts[] = { - { "source-ports", 1, NULL, '1' }, - { "sports", 1, NULL, '1' }, /* synonym */ - { "destination-ports", 1, NULL, '2' }, - { "dports", 1, NULL, '2' }, /* synonym */ - { "ports", 1, NULL, '3' }, - { .name = NULL } + {.name = "source-ports", .has_arg = true, .val = '1'}, + {.name = "sports", .has_arg = true, .val = '1'}, /* synonym */ + {.name = "destination-ports", .has_arg = true, .val = '2'}, + {.name = "dports", .has_arg = true, .val = '2'}, /* synonym */ + {.name = "ports", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static char * diff --git a/extensions/libxt_osf.c b/extensions/libxt_osf.c index 07b86e40..66c23b4d 100644 --- a/extensions/libxt_osf.c +++ b/extensions/libxt_osf.c @@ -20,7 +20,7 @@ /* * xtables interface for OS fingerprint matching module. */ - +#include #include #include #include @@ -54,10 +54,10 @@ static void osf_help(void) static const struct option osf_opts[] = { - { .name = "genre", .has_arg = true, .val = '1' }, - { .name = "ttl", .has_arg = true, .val = '2' }, - { .name = "log", .has_arg = true, .val = '3' }, - { .name = NULL } + {.name = "genre", .has_arg = true, .val = '1'}, + {.name = "ttl", .has_arg = true, .val = '2'}, + {.name = "log", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; diff --git a/extensions/libxt_owner.c b/extensions/libxt_owner.c index b595d972..4015f137 100644 --- a/extensions/libxt_owner.c +++ b/extensions/libxt_owner.c @@ -113,7 +113,7 @@ static const struct option owner_mt_opts_v0[] = { #ifdef IPT_OWNER_COMM {.name = "cmd-owner", .has_arg = true, .val = 'c'}, #endif - { .name = NULL } + XT_GETOPT_TABLEEND, }; static const struct option owner_mt6_opts_v0[] = { @@ -121,14 +121,14 @@ static const struct option owner_mt6_opts_v0[] = { {.name = "gid-owner", .has_arg = true, .val = 'g'}, {.name = "pid-owner", .has_arg = true, .val = 'p'}, {.name = "sid-owner", .has_arg = true, .val = 's'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static const struct option owner_mt_opts[] = { {.name = "uid-owner", .has_arg = true, .val = 'u'}, {.name = "gid-owner", .has_arg = true, .val = 'g'}, {.name = "socket-exists", .has_arg = false, .val = 'k'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_physdev.c b/extensions/libxt_physdev.c index 5382ab60..d92df9e0 100644 --- a/extensions/libxt_physdev.c +++ b/extensions/libxt_physdev.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add bridge port matching support. */ +#include #include #include #include @@ -24,12 +25,12 @@ static void physdev_help(void) } static const struct option physdev_opts[] = { - { "physdev-in", 1, NULL, '1' }, - { "physdev-out", 1, NULL, '2' }, - { "physdev-is-in", 0, NULL, '3' }, - { "physdev-is-out", 0, NULL, '4' }, - { "physdev-is-bridged", 0, NULL, '5' }, - { .name = NULL } + {.name = "physdev-in", .has_arg = true, .val = '1'}, + {.name = "physdev-out", .has_arg = true, .val = '2'}, + {.name = "physdev-is-in", .has_arg = false, .val = '3'}, + {.name = "physdev-is-out", .has_arg = false, .val = '4'}, + {.name = "physdev-is-bridged", .has_arg = false, .val = '5'}, + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_pkttype.c b/extensions/libxt_pkttype.c index cd83e730..d4025913 100644 --- a/extensions/libxt_pkttype.c +++ b/extensions/libxt_pkttype.c @@ -4,6 +4,7 @@ * * Michal Ludvig */ +#include #include #include #include @@ -61,8 +62,8 @@ static void pkttype_help(void) } static const struct option pkttype_opts[] = { - {"pkt-type", 1, NULL, '1'}, - { .name = NULL } + {.name = "pkt-type", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void parse_pkttype(const char *pkttype, struct xt_pkttype_info *info) diff --git a/extensions/libxt_policy.c b/extensions/libxt_policy.c index a87ddd89..3ddb3ec7 100644 --- a/extensions/libxt_policy.c +++ b/extensions/libxt_policy.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add policy support. */ +#include #include #include #include @@ -42,53 +43,55 @@ static const struct option policy_opts[] = { { .name = "dir", - .has_arg = 1, + .has_arg = true, .val = '1', }, { .name = "pol", - .has_arg = 1, + .has_arg = true, .val = '2', }, { .name = "strict", + .has_arg = false, .val = '3' }, { .name = "reqid", - .has_arg = 1, + .has_arg = true, .val = '4', }, { .name = "spi", - .has_arg = 1, + .has_arg = true, .val = '5' }, { .name = "tunnel-src", - .has_arg = 1, + .has_arg = true, .val = '6' }, { .name = "tunnel-dst", - .has_arg = 1, + .has_arg = true, .val = '7' }, { .name = "proto", - .has_arg = 1, + .has_arg = true, .val = '8' }, { .name = "mode", - .has_arg = 1, + .has_arg = true, .val = '9' }, { .name = "next", + .has_arg = false, .val = 'a' }, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static int parse_direction(char *s) diff --git a/extensions/libxt_quota.c b/extensions/libxt_quota.c index ac7c686e..b6bab93a 100644 --- a/extensions/libxt_quota.c +++ b/extensions/libxt_quota.c @@ -3,6 +3,7 @@ * * Sam Johnston */ +#include #include #include #include @@ -12,8 +13,8 @@ #include static const struct option quota_opts[] = { - {"quota", 1, NULL, '1'}, - { .name = NULL } + {.name = "quota", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static void quota_help(void) diff --git a/extensions/libxt_rateest.c b/extensions/libxt_rateest.c index ad0884e7..6aefb5c3 100644 --- a/extensions/libxt_rateest.c +++ b/extensions/libxt_rateest.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -40,20 +41,20 @@ enum rateest_options { }; static const struct option rateest_opts[] = { - { "rateest1", 1, NULL, OPT_RATEEST1 }, - { "rateest", 1, NULL, OPT_RATEEST1 }, /* alias for absolute mode */ - { "rateest2", 1, NULL, OPT_RATEEST2 }, - { "rateest-bps1", 0, NULL, OPT_RATEEST_BPS1 }, - { "rateest-pps1", 0, NULL, OPT_RATEEST_PPS1 }, - { "rateest-bps2", 0, NULL, OPT_RATEEST_BPS2 }, - { "rateest-pps2", 0, NULL, OPT_RATEEST_PPS2 }, - { "rateest-bps", 0, NULL, OPT_RATEEST_BPS2 }, /* alias for absolute mode */ - { "rateest-pps", 0, NULL, OPT_RATEEST_PPS2 }, /* alias for absolute mode */ - { "rateest-delta", 0, NULL, OPT_RATEEST_DELTA }, - { "rateest-lt", 0, NULL, OPT_RATEEST_LT }, - { "rateest-gt", 0, NULL, OPT_RATEEST_GT }, - { "rateest-eq", 0, NULL, OPT_RATEEST_EQ }, - { .name = NULL } + {.name = "rateest1", .has_arg = true, .val = OPT_RATEEST1}, + {.name = "rateest", .has_arg = true, .val = OPT_RATEEST1}, /* alias for absolute mode */ + {.name = "rateest2", .has_arg = true, .val = OPT_RATEEST2}, + {.name = "rateest-bps1", .has_arg = false, .val = OPT_RATEEST_BPS1}, + {.name = "rateest-pps1", .has_arg = false, .val = OPT_RATEEST_PPS1}, + {.name = "rateest-bps2", .has_arg = false, .val = OPT_RATEEST_BPS2}, + {.name = "rateest-pps2", .has_arg = false, .val = OPT_RATEEST_PPS2}, + {.name = "rateest-bps", .has_arg = false, .val = OPT_RATEEST_BPS2}, /* alias for absolute mode */ + {.name = "rateest-pps", .has_arg = false, .val = OPT_RATEEST_PPS2}, /* alias for absolute mode */ + {.name = "rateest-delta", .has_arg = false, .val = OPT_RATEEST_DELTA}, + {.name = "rateest-lt", .has_arg = false, .val = OPT_RATEEST_LT}, + {.name = "rateest-gt", .has_arg = false, .val = OPT_RATEEST_GT}, + {.name = "rateest-eq", .has_arg = false, .val = OPT_RATEEST_EQ}, + XT_GETOPT_TABLEEND, }; /* Copied from iproute. See http://physics.nist.gov/cuu/Units/binary.html */ @@ -79,7 +80,7 @@ static const struct rate_suffix { { "GBps", 8000000000. }, { "TiBps", 8.*1024.*1024.*1024.*1024. }, { "TBps", 8000000000000. }, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_recent.c b/extensions/libxt_recent.c index ecc17ad4..41faeb61 100644 --- a/extensions/libxt_recent.c +++ b/extensions/libxt_recent.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add recent matching support. */ +#include #include #include #include @@ -9,17 +10,17 @@ #include static const struct option recent_opts[] = { - { .name = "set", .has_arg = 0, .val = 201 }, - { .name = "rcheck", .has_arg = 0, .val = 202 }, - { .name = "update", .has_arg = 0, .val = 203 }, - { .name = "seconds", .has_arg = 1, .val = 204 }, - { .name = "hitcount", .has_arg = 1, .val = 205 }, - { .name = "remove", .has_arg = 0, .val = 206 }, - { .name = "rttl", .has_arg = 0, .val = 207 }, - { .name = "name", .has_arg = 1, .val = 208 }, - { .name = "rsource", .has_arg = 0, .val = 209 }, - { .name = "rdest", .has_arg = 0, .val = 210 }, - { .name = NULL } + {.name = "set", .has_arg = false, .val = 201}, + {.name = "rcheck", .has_arg = false, .val = 202}, + {.name = "update", .has_arg = false, .val = 203}, + {.name = "seconds", .has_arg = true, .val = 204}, + {.name = "hitcount", .has_arg = true, .val = 205}, + {.name = "remove", .has_arg = false, .val = 206}, + {.name = "rttl", .has_arg = false, .val = 207}, + {.name = "name", .has_arg = true, .val = 208}, + {.name = "rsource", .has_arg = false, .val = 209}, + {.name = "rdest", .has_arg = false, .val = 210}, + XT_GETOPT_TABLEEND, }; static void recent_help(void) diff --git a/extensions/libxt_sctp.c b/extensions/libxt_sctp.c index d321fb8a..80406f76 100644 --- a/extensions/libxt_sctp.c +++ b/extensions/libxt_sctp.c @@ -7,6 +7,7 @@ * libipt_ecn.c borrowed heavily from libipt_dscp.c * */ +#include #include #include #include @@ -55,12 +56,12 @@ static void sctp_help(void) } static const struct option sctp_opts[] = { - { .name = "source-port", .has_arg = 1, .val = '1' }, - { .name = "sport", .has_arg = 1, .val = '1' }, - { .name = "destination-port", .has_arg = 1, .val = '2' }, - { .name = "dport", .has_arg = 1, .val = '2' }, - { .name = "chunk-types", .has_arg = 1, .val = '3' }, - { .name = NULL } + {.name = "source-port", .has_arg = true, .val = '1'}, + {.name = "sport", .has_arg = true, .val = '1'}, + {.name = "destination-port", .has_arg = true, .val = '2'}, + {.name = "dport", .has_arg = true, .val = '2'}, + {.name = "chunk-types", .has_arg = true, .val = '3'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_set.c b/extensions/libxt_set.c index 75fa3c27..594e2d4f 100644 --- a/extensions/libxt_set.c +++ b/extensions/libxt_set.c @@ -9,6 +9,7 @@ */ /* Shared library add-on to iptables to add IP set matching. */ +#include #include #include #include @@ -32,9 +33,9 @@ set_help(void) } static const struct option set_opts[] = { - { .name = "match-set", .has_arg = true, .val = '1'}, - { .name = "set", .has_arg = true, .val = '2'}, - { .name = NULL } + {.name = "match-set", .has_arg = true, .val = '1'}, + {.name = "set", .has_arg = true, .val = '2'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_state.c b/extensions/libxt_state.c index d8159e57..40643335 100644 --- a/extensions/libxt_state.c +++ b/extensions/libxt_state.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add state tracking support. */ +#include #include #include #include @@ -22,8 +23,8 @@ state_help(void) } static const struct option state_opts[] = { - { "state", 1, NULL, '1' }, - { .name = NULL } + {.name = "state", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static int diff --git a/extensions/libxt_statistic.c b/extensions/libxt_statistic.c index 913aa2c7..94f29134 100644 --- a/extensions/libxt_statistic.c +++ b/extensions/libxt_statistic.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -21,11 +22,11 @@ static void statistic_help(void) } static const struct option statistic_opts[] = { - { "mode", 1, NULL, '1' }, - { "probability", 1, NULL, '2' }, - { "every", 1, NULL, '3' }, - { "packet", 1, NULL, '4' }, - { .name = NULL } + {.name = "mode", .has_arg = true, .val = '1'}, + {.name = "probability", .has_arg = true, .val = '2'}, + {.name = "every", .has_arg = true, .val = '3'}, + {.name = "packet", .has_arg = true, .val = '4'}, + XT_GETOPT_TABLEEND, }; static struct xt_statistic_info *global_info; diff --git a/extensions/libxt_string.c b/extensions/libxt_string.c index df6302e8..a6c58813 100644 --- a/extensions/libxt_string.c +++ b/extensions/libxt_string.c @@ -21,6 +21,7 @@ * ipt_string_info. */ #define _GNU_SOURCE 1 +#include #include #include #include @@ -44,13 +45,13 @@ static void string_help(void) } static const struct option string_opts[] = { - { "from", 1, NULL, '1' }, - { "to", 1, NULL, '2' }, - { "algo", 1, NULL, '3' }, - { "string", 1, NULL, '4' }, - { "hex-string", 1, NULL, '5' }, - { "icase", 0, NULL, '6' }, - { .name = NULL } + {.name = "from", .has_arg = true, .val = '1'}, + {.name = "to", .has_arg = true, .val = '2'}, + {.name = "algo", .has_arg = true, .val = '3'}, + {.name = "string", .has_arg = true, .val = '4'}, + {.name = "hex-string", .has_arg = true, .val = '5'}, + {.name = "icase", .has_arg = false, .val = '6'}, + XT_GETOPT_TABLEEND, }; static void string_init(struct xt_entry_match *m) diff --git a/extensions/libxt_tcp.c b/extensions/libxt_tcp.c index 75551d79..26e533c0 100644 --- a/extensions/libxt_tcp.c +++ b/extensions/libxt_tcp.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add TCP support. */ +#include #include #include #include @@ -26,14 +27,14 @@ static void tcp_help(void) } static const struct option tcp_opts[] = { - { "source-port", 1, NULL, '1' }, - { "sport", 1, NULL, '1' }, /* synonym */ - { "destination-port", 1, NULL, '2' }, - { "dport", 1, NULL, '2' }, /* synonym */ - { "syn", 0, NULL, '3' }, - { "tcp-flags", 1, NULL, '4' }, - { "tcp-option", 1, NULL, '5' }, - { .name = NULL } + {.name = "source-port", .has_arg = true, .val = '1'}, + {.name = "sport", .has_arg = true, .val = '1'}, /* synonym */ + {.name = "destination-port", .has_arg = true, .val = '2'}, + {.name = "dport", .has_arg = true, .val = '2'}, /* synonym */ + {.name = "syn", .has_arg = false, .val = '3'}, + {.name = "tcp-flags", .has_arg = true, .val = '4'}, + {.name = "tcp-option", .has_arg = true, .val = '5'}, + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/libxt_tcpmss.c b/extensions/libxt_tcpmss.c index b54a890e..110c60da 100644 --- a/extensions/libxt_tcpmss.c +++ b/extensions/libxt_tcpmss.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add tcp MSS matching support. */ +#include #include #include #include @@ -17,8 +18,8 @@ static void tcpmss_help(void) } static const struct option tcpmss_opts[] = { - { "mss", 1, NULL, '1' }, - { .name = NULL } + {.name = "mss", .has_arg = true, .val = '1'}, + XT_GETOPT_TABLEEND, }; static u_int16_t diff --git a/extensions/libxt_time.c b/extensions/libxt_time.c index 098fc9c9..9f12266b 100644 --- a/extensions/libxt_time.c +++ b/extensions/libxt_time.c @@ -38,15 +38,15 @@ static const char *const week_days[] = { }; static const struct option time_opts[] = { - {"datestart", true, NULL, 'D'}, - {"datestop", true, NULL, 'E'}, - {"timestart", true, NULL, 'X'}, - {"timestop", true, NULL, 'Y'}, - {"weekdays", true, NULL, 'w'}, - {"monthdays", true, NULL, 'm'}, - {"localtz", false, NULL, 'l'}, - {"utc", false, NULL, 'u'}, - { .name = NULL } + {.name = "datestart", .has_arg = true, .val = 'D'}, + {.name = "datestop", .has_arg = true, .val = 'E'}, + {.name = "timestart", .has_arg = true, .val = 'X'}, + {.name = "timestop", .has_arg = true, .val = 'Y'}, + {.name = "weekdays", .has_arg = true, .val = 'w'}, + {.name = "monthdays", .has_arg = true, .val = 'm'}, + {.name = "localtz", .has_arg = false, .val = 'l'}, + {.name = "utc", .has_arg = false, .val = 'u'}, + XT_GETOPT_TABLEEND, }; static void time_help(void) diff --git a/extensions/libxt_tos.c b/extensions/libxt_tos.c index 6b8cd89f..f78594ac 100644 --- a/extensions/libxt_tos.c +++ b/extensions/libxt_tos.c @@ -26,7 +26,7 @@ enum { static const struct option tos_mt_opts[] = { {.name = "tos", .has_arg = true, .val = 't'}, - { .name = NULL } + XT_GETOPT_TABLEEND, }; static void tos_mt_help(void) diff --git a/extensions/libxt_u32.c b/extensions/libxt_u32.c index 9a61c8a5..67e60683 100644 --- a/extensions/libxt_u32.c +++ b/extensions/libxt_u32.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -23,8 +24,8 @@ #include static const struct option u32_opts[] = { - {"u32", 1, NULL, 'u'}, - { .name = NULL } + {.name = "u32", .has_arg = true, .val = 'u'}, + XT_GETOPT_TABLEEND, }; static void u32_help(void) diff --git a/extensions/libxt_udp.c b/extensions/libxt_udp.c index 135e7af7..3006c04e 100644 --- a/extensions/libxt_udp.c +++ b/extensions/libxt_udp.c @@ -1,4 +1,5 @@ /* Shared library add-on to iptables to add UDP support. */ +#include #include #include #include @@ -21,11 +22,11 @@ static void udp_help(void) } static const struct option udp_opts[] = { - { "source-port", 1, NULL, '1' }, - { "sport", 1, NULL, '1' }, /* synonym */ - { "destination-port", 1, NULL, '2' }, - { "dport", 1, NULL, '2' }, /* synonym */ - { .name = NULL } + {.name = "source-port", .has_arg = true, .val = '1'}, + {.name = "sport", .has_arg = true, .val = '1'}, /* synonym */ + {.name = "destination-port", .has_arg = true, .val = '2'}, + {.name = "dport", .has_arg = true, .val = '2'}, /* synonym */ + XT_GETOPT_TABLEEND, }; static void diff --git a/extensions/tos_values.c b/extensions/tos_values.c index e8f1563c..10add198 100644 --- a/extensions/tos_values.c +++ b/extensions/tos_values.c @@ -20,7 +20,7 @@ static const struct tos_symbol_info { {IPTOS_RELIABILITY, "Maximize-Reliability"}, {IPTOS_MINCOST, "Minimize-Cost"}, {IPTOS_NORMALSVC, "Normal-Service"}, - { .name = NULL } + {}, }; /* diff --git a/include/xtables.h.in b/include/xtables.h.in index 2d7df322..9e47c2d2 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -199,6 +199,8 @@ struct xtables_globals void (*exit_err)(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3))); }; +#define XT_GETOPT_TABLEEND {NULL} + #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3