summaryrefslogtreecommitdiffstats
path: root/ipset_ipporthash.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>2008-07-19 20:48:19 +0000
committer/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>2008-07-19 20:48:19 +0000
commit6a0ae483145159b0c903690c0313dbc03745c412 (patch)
treec76f14af1d80295c94eeba826bdec75cda73ad55 /ipset_ipporthash.c
parent87c406c4962ea52f467b9807daf66e3652bd0e9b (diff)
Compatibility cleanup release: kernels >= 2.6.16 and 2.4.36.x are supported.
Diffstat (limited to 'ipset_ipporthash.c')
-rw-r--r--ipset_ipporthash.c48
1 files changed, 29 insertions, 19 deletions
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"