mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 21:25:12 +02:00
condition: remove casts, add const qualifiers
This commit is contained in:
@@ -21,8 +21,7 @@ static const struct option condition_opts[] = {
|
|||||||
static int condition_parse(int c, char **argv, int invert, unsigned int *flags,
|
static int condition_parse(int c, char **argv, int invert, unsigned int *flags,
|
||||||
const void *entry, struct xt_entry_match **match)
|
const void *entry, struct xt_entry_match **match)
|
||||||
{
|
{
|
||||||
struct condition_info *info =
|
struct condition_info *info = (void *)(*match)->data;
|
||||||
(struct condition_info *) (*match)->data;
|
|
||||||
|
|
||||||
if (c == 'X') {
|
if (c == 'X') {
|
||||||
if (*flags)
|
if (*flags)
|
||||||
@@ -55,8 +54,7 @@ static void condition_check(unsigned int flags)
|
|||||||
static void condition_print(const void *ip, const struct xt_entry_match *match,
|
static void condition_print(const void *ip, const struct xt_entry_match *match,
|
||||||
int numeric)
|
int numeric)
|
||||||
{
|
{
|
||||||
const struct condition_info *info =
|
const struct condition_info *info = (const void *)match->data;
|
||||||
(const struct condition_info *) match->data;
|
|
||||||
|
|
||||||
printf("condition %s%s ", (info->invert) ? "!" : "", info->name);
|
printf("condition %s%s ", (info->invert) ? "!" : "", info->name);
|
||||||
}
|
}
|
||||||
@@ -64,8 +62,7 @@ static void condition_print(const void *ip, const struct xt_entry_match *match,
|
|||||||
|
|
||||||
static void condition_save(const void *ip, const struct xt_entry_match *match)
|
static void condition_save(const void *ip, const struct xt_entry_match *match)
|
||||||
{
|
{
|
||||||
const struct condition_info *info =
|
const struct condition_info *info = (const void *)match->data;
|
||||||
(const struct condition_info *) match->data;
|
|
||||||
|
|
||||||
printf("--condition %s\"%s\" ", (info->invert) ? "! " : "", info->name);
|
printf("--condition %s\"%s\" ", (info->invert) ? "! " : "", info->name);
|
||||||
}
|
}
|
||||||
@@ -83,8 +80,7 @@ static struct xtables_match condition_match = {
|
|||||||
.extra_opts = condition_opts,
|
.extra_opts = condition_opts,
|
||||||
};
|
};
|
||||||
|
|
||||||
void _init(void);
|
static void _init(void)
|
||||||
void _init(void)
|
|
||||||
{
|
{
|
||||||
xtables_register_match(&condition_match);
|
xtables_register_match(&condition_match);
|
||||||
}
|
}
|
||||||
|
@@ -77,8 +77,7 @@ static int
|
|||||||
xt_condition_read_info(char __user *buffer, char **start, off_t offset,
|
xt_condition_read_info(char __user *buffer, char **start, off_t offset,
|
||||||
int length, int *eof, void *data)
|
int length, int *eof, void *data)
|
||||||
{
|
{
|
||||||
struct condition_variable *var =
|
const struct condition_variable *var = data;
|
||||||
(struct condition_variable *) data;
|
|
||||||
|
|
||||||
buffer[0] = (var->enabled) ? '1' : '0';
|
buffer[0] = (var->enabled) ? '1' : '0';
|
||||||
buffer[1] = '\n';
|
buffer[1] = '\n';
|
||||||
@@ -93,8 +92,7 @@ static int
|
|||||||
xt_condition_write_info(struct file *file, const char __user *buffer,
|
xt_condition_write_info(struct file *file, const char __user *buffer,
|
||||||
unsigned long length, void *data)
|
unsigned long length, void *data)
|
||||||
{
|
{
|
||||||
struct condition_variable *var =
|
struct condition_variable *var = data;
|
||||||
(struct condition_variable *) data;
|
|
||||||
char newval;
|
char newval;
|
||||||
|
|
||||||
if (length>0) {
|
if (length>0) {
|
||||||
@@ -111,7 +109,7 @@ xt_condition_write_info(struct file *file, const char __user *buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -120,8 +118,7 @@ condition_mt(const struct sk_buff *skb, const struct net_device *in,
|
|||||||
const void *matchinfo, int offset, unsigned int protoff,
|
const void *matchinfo, int offset, unsigned int protoff,
|
||||||
bool *hotdrop)
|
bool *hotdrop)
|
||||||
{
|
{
|
||||||
const struct condition_info *info =
|
const struct condition_info *info = matchinfo;
|
||||||
(const struct condition_info *) matchinfo;
|
|
||||||
struct condition_variable *var;
|
struct condition_variable *var;
|
||||||
int condition_status = 0;
|
int condition_status = 0;
|
||||||
|
|
||||||
@@ -143,7 +140,7 @@ condition_mt_check(const char *tablename, const void *entry,
|
|||||||
unsigned int hook_mask)
|
unsigned int hook_mask)
|
||||||
{
|
{
|
||||||
static const char * const forbidden_names[]={ "", ".", ".." };
|
static const char * const forbidden_names[]={ "", ".", ".." };
|
||||||
struct condition_info *info = (struct condition_info *) matchinfo;
|
const struct condition_info *info = matchinfo;
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
struct condition_variable *var, *newvar;
|
struct condition_variable *var, *newvar;
|
||||||
|
|
||||||
@@ -214,7 +211,7 @@ condition_mt_check(const char *tablename, const void *entry,
|
|||||||
|
|
||||||
static void condition_mt_destroy(const struct xt_match *match, void *matchinfo)
|
static void condition_mt_destroy(const struct xt_match *match, void *matchinfo)
|
||||||
{
|
{
|
||||||
struct condition_info *info = (struct condition_info *) matchinfo;
|
const struct condition_info *info = matchinfo;
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
struct condition_variable *var;
|
struct condition_variable *var;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user