condition: use new structure type

Use __u8 for the invert flag instead of int. Reduce CONDITION_NAME_LEN
from 32 to 31 so that the entire structure can fit into a cacheline.
This commit is contained in:
Jan Engelhardt
2008-04-02 04:42:37 +02:00
parent 7d0efafdb3
commit 24dad368dd
3 changed files with 15 additions and 13 deletions

View File

@@ -21,7 +21,7 @@ static const struct option condition_opts[] = {
static int condition_parse(int c, char **argv, int invert, unsigned int *flags,
const void *entry, struct xt_entry_match **match)
{
struct condition_info *info = (void *)(*match)->data;
struct xt_condition_mtinfo *info = (void *)(*match)->data;
if (c == 'X') {
if (*flags)
@@ -54,7 +54,7 @@ static void condition_check(unsigned int flags)
static void condition_print(const void *ip, const struct xt_entry_match *match,
int numeric)
{
const struct condition_info *info = (const void *)match->data;
const struct xt_condition_mtinfo *info = (const void *)match->data;
printf("condition %s%s ", (info->invert) ? "!" : "", info->name);
}
@@ -62,7 +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)
{
const struct condition_info *info = (const void *)match->data;
const struct xt_condition_mtinfo *info = (const void *)match->data;
printf("--condition %s\"%s\" ", (info->invert) ? "! " : "", info->name);
}
@@ -70,8 +70,8 @@ static void condition_save(const void *ip, const struct xt_entry_match *match)
static struct xtables_match condition_match = {
.name = "condition",
.version = XTABLES_VERSION,
.size = XT_ALIGN(sizeof(struct condition_info)),
.userspacesize = XT_ALIGN(sizeof(struct condition_info)),
.size = XT_ALIGN(sizeof(struct xt_condition_mtinfo)),
.userspacesize = XT_ALIGN(sizeof(struct xt_condition_mtinfo)),
.help = condition_help,
.parse = condition_parse,
.final_check = condition_check,