summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_tos.c
diff options
context:
space:
mode:
authorlaforge <laforge>2002-12-05 19:39:10 +0000
committerlaforge <laforge>2002-12-05 19:39:10 +0000
commit3516040b9d6eef53a129befd7122a1d0886b93de (patch)
tree846c5a3c7f670e3c7b6daf05e8e868d5f9b2e104 /extensions/libipt_tos.c
parent3c398b35ae0dd3d4bd9249c450ce2442b409f0d9 (diff)
fix save function of libipt_tos
Diffstat (limited to 'extensions/libipt_tos.c')
-rw-r--r--extensions/libipt_tos.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/extensions/libipt_tos.c b/extensions/libipt_tos.c
index b0cd2e0..6786911 100644
--- a/extensions/libipt_tos.c
+++ b/extensions/libipt_tos.c
@@ -105,13 +105,10 @@ parse(int c, char **argv, int invert, unsigned int *flags,
}
static void
-print_tos(u_int8_t tos, int invert, int numeric)
+print_tos(u_int8_t tos, int numeric)
{
unsigned int i;
- if (invert)
- fputc('!', stdout);
-
if (!numeric) {
for (i = 0; i<sizeof(TOS_values)/sizeof(struct TOS_value); i++)
if (TOS_values[i].TOS == tos) {
@@ -137,18 +134,24 @@ print(const struct ipt_ip *ip,
const struct ipt_entry_match *match,
int numeric)
{
+ const struct ipt_tos_info *info = (const struct ipt_tos_info *)match->data;
+
printf("TOS match ");
- print_tos(((struct ipt_tos_info *)match->data)->tos,
- ((struct ipt_tos_info *)match->data)->invert, numeric);
+ if (info->invert)
+ printf("!");
+ print_tos(info->tos, numeric);
}
/* Saves the union ipt_matchinfo in parsable form to stdout. */
static void
save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
{
+ const struct ipt_tos_info *info = (const struct ipt_tos_info *)match->data;
+
+ if (info->invert)
+ printf("! ");
printf("--tos ");
- print_tos(((struct ipt_tos_info *)match->data)->tos,
- ((struct ipt_tos_info *)match->data)->invert, 0);
+ print_tos(info->tos, 0);
}
static