summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schwendt <mschwendt@yahoo.com>2002-09-07 14:31:01 +0000
committerHarald Welte <laforge@gnumonks.org>2002-09-07 14:31:01 +0000
commite95bd7a204bd19bc526e599730bc86657d07f57b (patch)
treeafc8cb5836ee4e2307388bcad81fa7af6a91447b
parenta713ce0dba73e45d569bf62fdb5248bc1d4694e9 (diff)
make IPv4 and IPv6 LOG target save() the log-level as string, instead of the
numeric value. (Michael Schwendt)
-rw-r--r--extensions/libip6t_LOG.c13
-rw-r--r--extensions/libipt_LOG.c13
2 files changed, 22 insertions, 4 deletions
diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c
index f4d87aac..843ff7e8 100644
--- a/extensions/libip6t_LOG.c
+++ b/extensions/libip6t_LOG.c
@@ -225,12 +225,21 @@ save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)
{
const struct ip6t_log_info *loginfo
= (const struct ip6t_log_info *)target->data;
+ unsigned int i = 0;
if (strcmp(loginfo->prefix, "") != 0)
printf("--log-prefix \"%s\" ", loginfo->prefix);
- if (loginfo->level != LOG_DEFAULT_LEVEL)
- printf("--log-level %u ", loginfo->level);
+ if (loginfo->level != LOG_DEFAULT_LEVEL) {
+ for (i = 0;
+ i < sizeof(ip6t_log_names) / sizeof(struct ip6t_log_names);
+ i++) {
+ if (loginfo->level == ip6t_log_names[i].level) {
+ printf("--log-level %s ", ip6t_log_names[i].name);
+ break;
+ }
+ }
+ }
if (loginfo->logflags & IP6T_LOG_TCPSEQ)
printf("--log-tcp-sequence ");
diff --git a/extensions/libipt_LOG.c b/extensions/libipt_LOG.c
index 66028a64..290ccf01 100644
--- a/extensions/libipt_LOG.c
+++ b/extensions/libipt_LOG.c
@@ -225,12 +225,21 @@ save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
{
const struct ipt_log_info *loginfo
= (const struct ipt_log_info *)target->data;
+ unsigned int i = 0;
if (strcmp(loginfo->prefix, "") != 0)
printf("--log-prefix \"%s\" ", loginfo->prefix);
- if (loginfo->level != LOG_DEFAULT_LEVEL)
- printf("--log-level %u ", loginfo->level);
+ if (loginfo->level != LOG_DEFAULT_LEVEL) {
+ for (i = 0;
+ i < sizeof(ipt_log_names) / sizeof(struct ipt_log_names);
+ i++) {
+ if (loginfo->level == ipt_log_names[i].level) {
+ printf("--log-level %s ", ipt_log_names[i].name);
+ break;
+ }
+ }
+ }
if (loginfo->logflags & IPT_LOG_TCPSEQ)
printf("--log-tcp-sequence ");