mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-20 11:34:57 +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_NETMASK 0x08U
|
||||
|
||||
/* Initialize the create. */
|
||||
void create_init(void *data)
|
||||
static void create_init(void *data)
|
||||
{
|
||||
struct ip_set_req_iphash_create *mydata =
|
||||
(struct ip_set_req_iphash_create *) data;
|
||||
@@ -57,7 +57,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_iphash_create *mydata =
|
||||
(struct ip_set_req_iphash_create *) data;
|
||||
@@ -125,7 +125,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)
|
||||
{
|
||||
#ifdef IPSET_DEBUG
|
||||
struct ip_set_req_iphash_create *mydata =
|
||||
@@ -137,24 +137,24 @@ 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'},
|
||||
{"netmask", 1, 0, '4'},
|
||||
{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_iphash *mydata =
|
||||
(struct ip_set_req_iphash *) data;
|
||||
|
||||
parse_ip(optarg, &mydata->ip);
|
||||
parse_ip(arg, &mydata->ip);
|
||||
if (!mydata->ip)
|
||||
exit_error(PARAMETER_PROBLEM,
|
||||
"Zero valued IP address `%s' specified", optarg);
|
||||
"Zero valued IP address `%s' specified", arg);
|
||||
|
||||
return mydata->ip;
|
||||
};
|
||||
@@ -163,7 +163,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_iphash_create *header =
|
||||
(struct ip_set_req_iphash_create *) data;
|
||||
@@ -177,7 +177,7 @@ void initheader(struct set *set, const void *data)
|
||||
map->netmask = header->netmask;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
static unsigned int
|
||||
mask_to_bits(ip_set_ip_t mask)
|
||||
{
|
||||
unsigned int bits = 32;
|
||||
@@ -193,7 +193,7 @@ mask_to_bits(ip_set_ip_t mask)
|
||||
return bits;
|
||||
}
|
||||
|
||||
void printheader(struct set *set, unsigned options)
|
||||
static void printheader(struct set *set, unsigned int options)
|
||||
{
|
||||
struct ip_set_iphash *mysetdata =
|
||||
(struct ip_set_iphash *) set->settype->header;
|
||||
@@ -207,7 +207,8 @@ void printheader(struct set *set, unsigned options)
|
||||
printf(" netmask: %d\n", mask_to_bits(mysetdata->netmask));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
size_t offset = 0;
|
||||
ip_set_ip_t *ip;
|
||||
@@ -220,7 +221,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_iphash *mysetdata =
|
||||
(struct ip_set_iphash *) set->settype->header;
|
||||
@@ -235,7 +236,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)
|
||||
{
|
||||
size_t offset = 0;
|
||||
ip_set_ip_t *ip;
|
||||
@@ -249,7 +251,7 @@ void saveips(struct set *set, void *data, size_t len, unsigned options)
|
||||
}
|
||||
}
|
||||
|
||||
void usage(void)
|
||||
static void usage(void)
|
||||
{
|
||||
printf
|
||||
("-N set iphash [--hashsize hashsize] [--probes probes ]\n"
|
||||
@@ -290,7 +292,7 @@ static struct settype settype_iphash = {
|
||||
.usage = &usage,
|
||||
};
|
||||
|
||||
static __attribute__((constructor)) iphash_init(void)
|
||||
static __attribute__((constructor)) void iphash_init(void)
|
||||
{
|
||||
settype_register(&settype_iphash);
|
||||
|
||||
|
Reference in New Issue
Block a user