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_ipporthash.c | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'ipset_ipporthash.c') diff --git a/ipset_ipporthash.c b/ipset_ipporthash.c index d81dab6..c090744 100644 --- a/ipset_ipporthash.c +++ b/ipset_ipporthash.c @@ -41,7 +41,8 @@ #define OPT_CREATE_TO 0x20U /* Initialize the create. */ -void create_init(void *data) +static void +create_init(void *data) { struct ip_set_req_ipporthash_create *mydata = (struct ip_set_req_ipporthash_create *) data; @@ -55,7 +56,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_ipporthash_create *mydata = (struct ip_set_req_ipporthash_create *) data; @@ -146,7 +148,8 @@ int create_parse(int c, char *argv[], void *data, unsigned *flags) } /* 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_ipporthash_create *mydata = (struct ip_set_req_ipporthash_create *) data; @@ -187,18 +190,19 @@ void create_final(void *data, unsigned int flags) } /* Create commandline options */ -static struct option create_opts[] = { - {"hashsize", 1, 0, '1'}, - {"probes", 1, 0, '2'}, - {"resize", 1, 0, '3'}, - {"from", 1, 0, '4'}, - {"to", 1, 0, '5'}, - {"network", 1, 0, '6'}, - {0} +static const struct option create_opts[] = { + {.name = "hashsize", .has_arg = required_argument, .val = '1'}, + {.name = "probes", .has_arg = required_argument, .val = '2'}, + {.name = "resize", .has_arg = required_argument, .val = '3'}, + {.name = "from", .has_arg = required_argument, .val = '4'}, + {.name = "to", .has_arg = required_argument, .val = '5'}, + {.name = "network", .has_arg = required_argument, .val = '6'}, + {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_ipporthash *mydata = (struct ip_set_req_ipporthash *) data; @@ -223,7 +227,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_ipporthash_create *header = (struct ip_set_req_ipporthash_create *) data; @@ -238,7 +243,8 @@ void initheader(struct set *set, const void *data) map->last_ip = header->to; } -void printheader(struct set *set, unsigned options) +static void +printheader(struct set *set, unsigned options) { struct ip_set_ipporthash *mysetdata = (struct ip_set_ipporthash *) set->settype->header; @@ -250,7 +256,8 @@ void printheader(struct set *set, unsigned options) printf(" resize: %u\n", mysetdata->resize); } -void printips(struct set *set, void *data, size_t len, unsigned options) +static void +printips(struct set *set, void *data, size_t len, unsigned options) { struct ip_set_ipporthash *mysetdata = (struct ip_set_ipporthash *) set->settype->header; @@ -271,7 +278,8 @@ void printips(struct set *set, void *data, size_t len, unsigned options) } } -void saveheader(struct set *set, unsigned options) +static void +saveheader(struct set *set, unsigned options) { struct ip_set_ipporthash *mysetdata = (struct ip_set_ipporthash *) set->settype->header; @@ -286,7 +294,8 @@ void saveheader(struct set *set, unsigned options) } /* Print save for an IP */ -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_ipporthash *mysetdata = (struct ip_set_ipporthash *) set->settype->header; @@ -309,7 +318,8 @@ void saveips(struct set *set, void *data, size_t len, unsigned options) static char buffer[22]; -static char * unpack_ipport_tostring(struct set *set, ip_set_ip_t bip, unsigned options) +static char * +unpack_ipport_tostring(struct set *set, ip_set_ip_t bip, unsigned options) { struct ip_set_ipporthash *mysetdata = (struct ip_set_ipporthash *) set->settype->header; @@ -323,7 +333,7 @@ static char * unpack_ipport_tostring(struct set *set, ip_set_ip_t bip, unsigned return buffer; } -void usage(void) +static void usage(void) { printf ("-N set ipporthash --from IP --to IP\n" -- cgit v1.2.3