mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-21 03:54:59 +02:00
ipset: fixup compile warnings
And add a few const here and there.
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
#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 +55,7 @@ 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 int *flags)
|
||||
{
|
||||
struct ip_set_req_ipporthash_create *mydata =
|
||||
(struct ip_set_req_ipporthash_create *) data;
|
||||
@@ -146,7 +146,7 @@ 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,25 +187,25 @@ void create_final(void *data, unsigned int flags)
|
||||
}
|
||||
|
||||
/* Create commandline options */
|
||||
static struct option create_opts[] = {
|
||||
static const 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}
|
||||
{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 int cmd, const char *arg, void *data)
|
||||
{
|
||||
struct ip_set_req_ipporthash *mydata =
|
||||
(struct ip_set_req_ipporthash *) data;
|
||||
char *saved = ipset_strdup(optarg);
|
||||
char *saved = ipset_strdup(arg);
|
||||
char *ptr, *tmp = saved;
|
||||
|
||||
DP("ipporthash: %p %p", optarg, data);
|
||||
DP("ipporthash: %p %p", arg, data);
|
||||
|
||||
ptr = strsep(&tmp, ":%");
|
||||
parse_ip(ptr, &mydata->ip);
|
||||
@@ -223,7 +223,7 @@ 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 +238,7 @@ 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 int options)
|
||||
{
|
||||
struct ip_set_ipporthash *mysetdata =
|
||||
(struct ip_set_ipporthash *) set->settype->header;
|
||||
@@ -250,7 +250,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 int options)
|
||||
{
|
||||
struct ip_set_ipporthash *mysetdata =
|
||||
(struct ip_set_ipporthash *) set->settype->header;
|
||||
@@ -271,7 +272,7 @@ 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 int options)
|
||||
{
|
||||
struct ip_set_ipporthash *mysetdata =
|
||||
(struct ip_set_ipporthash *) set->settype->header;
|
||||
@@ -286,7 +287,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 int options)
|
||||
{
|
||||
struct ip_set_ipporthash *mysetdata =
|
||||
(struct ip_set_ipporthash *) set->settype->header;
|
||||
@@ -323,7 +325,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"
|
||||
|
Reference in New Issue
Block a user