]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
make IPv4 and IPv6 LOG target save() the log-level as string, instead of the
authorMichael Schwendt <mschwendt@yahoo.com>
Sat, 7 Sep 2002 14:31:01 +0000 (14:31 +0000)
committerHarald Welte <laforge@gnumonks.org>
Sat, 7 Sep 2002 14:31:01 +0000 (14:31 +0000)
numeric value.  (Michael Schwendt)

extensions/libip6t_LOG.c
extensions/libipt_LOG.c

index f4d87aac1f3d8b75ab6100a25a3995e971f18c16..843ff7e88d46eba608c6222edf9c450ffd7790d6 100644 (file)
@@ -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 ");
index 66028a6461ccec95b9165deac5fd932e4868e859..290ccf013cd4621faacf4dcf2bae3e640e60a158 100644 (file)
@@ -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 ");