From 6a0ae483145159b0c903690c0313dbc03745c412 Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu" Date: Sat, 19 Jul 2008 20:48:19 +0000 Subject: Compatibility cleanup release: kernels >= 2.6.16 and 2.4.36.x are supported. --- ipset_ipmap.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'ipset_ipmap.c') diff --git a/ipset_ipmap.c b/ipset_ipmap.c index df8efbf..d628767 100644 --- a/ipset_ipmap.c +++ b/ipset_ipmap.c @@ -37,7 +37,8 @@ #define OPT_ADDDEL_IP 0x01U /* Initialize the create. */ -void create_init(void *data) +static void +create_init(void *data) { struct ip_set_req_ipmap_create *mydata = (struct ip_set_req_ipmap_create *) data; @@ -47,7 +48,8 @@ void create_init(void *data) } /* Function which parses command options; returns true if it ate an option */ -int create_parse(int c, char *argv[], void *data, unsigned *flags) +static int +create_parse(int c, char *argv[], void *data, unsigned *flags) { struct ip_set_req_ipmap_create *mydata = (struct ip_set_req_ipmap_create *) data; @@ -119,7 +121,8 @@ int create_parse(int c, char *argv[], void *data, unsigned *flags) #define ERRSTRLEN 256 /* Final check; exit if not ok. */ -void create_final(void *data, unsigned int flags) +static void +create_final(void *data, unsigned int flags) { struct ip_set_req_ipmap_create *mydata = (struct ip_set_req_ipmap_create *) data; @@ -196,16 +199,17 @@ void create_final(void *data, unsigned int flags) } /* Create commandline options */ -static struct option create_opts[] = { - {"from", 1, 0, '1'}, - {"to", 1, 0, '2'}, - {"network", 1, 0, '3'}, - {"netmask", 1, 0, '4'}, - {0} +static const struct option create_opts[] = { + {.name = "from", .has_arg = required_argument, .val = '1'}, + {.name = "to", .has_arg = required_argument, .val = '2'}, + {.name = "network", .has_arg = required_argument, .val = '3'}, + {.name = "netmask", .has_arg = required_argument, .val = '4'}, + {NULL}, }; /* Add, del, test parser */ -ip_set_ip_t adt_parser(unsigned cmd, const char *optarg, void *data) +static ip_set_ip_t +adt_parser(unsigned cmd, const char *optarg, void *data) { struct ip_set_req_ipmap *mydata = (struct ip_set_req_ipmap *) data; @@ -222,7 +226,8 @@ ip_set_ip_t adt_parser(unsigned cmd, const char *optarg, void *data) * Print and save */ -void initheader(struct set *set, const void *data) +static void +initheader(struct set *set, const void *data) { struct ip_set_req_ipmap_create *header = (struct ip_set_req_ipmap_create *) data; @@ -252,7 +257,8 @@ void initheader(struct set *set, const void *data) DP("%i %i", map->hosts, map->sizeid ); } -void printheader(struct set *set, unsigned options) +static void +printheader(struct set *set, unsigned options) { struct ip_set_ipmap *mysetdata = (struct ip_set_ipmap *) set->settype->header; @@ -265,7 +271,8 @@ void printheader(struct set *set, unsigned options) printf(" netmask: %d\n", mask_to_bits(mysetdata->netmask)); } -void printips_sorted(struct set *set, void *data, size_t len, unsigned options) +static void +printips_sorted(struct set *set, void *data, size_t len, unsigned options) { struct ip_set_ipmap *mysetdata = (struct ip_set_ipmap *) set->settype->header; @@ -279,7 +286,8 @@ void printips_sorted(struct set *set, void *data, size_t len, unsigned options) options)); } -void saveheader(struct set *set, unsigned options) +static void +saveheader(struct set *set, unsigned options) { struct ip_set_ipmap *mysetdata = (struct ip_set_ipmap *) set->settype->header; @@ -296,7 +304,8 @@ void saveheader(struct set *set, unsigned options) mask_to_bits(mysetdata->netmask)); } -void saveips(struct set *set, void *data, size_t len, unsigned options) +static void +saveips(struct set *set, void *data, size_t len, unsigned options) { struct ip_set_ipmap *mysetdata = (struct ip_set_ipmap *) set->settype->header; @@ -312,7 +321,7 @@ void saveips(struct set *set, void *data, size_t len, unsigned options) options)); } -void usage(void) +static void usage(void) { printf ("-N set ipmap --from IP --to IP [--netmask CIDR-netmask]\n" -- cgit v1.2.3