summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/libipt_ULOG.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/extensions/libipt_ULOG.c b/extensions/libipt_ULOG.c
index a22b9ec..9d4bad8 100644
--- a/extensions/libipt_ULOG.c
+++ b/extensions/libipt_ULOG.c
@@ -1,10 +1,13 @@
/* Shared library add-on to iptables to add ULOG support.
*
- * (C) 2000 by Harald Welte <laforge@sunbeam.franken.de>
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
+ *
+ * multipart netlink support based on ideas by Sebastian Zander
+ * <zander@fokus.gmd.de>
*
* This software is released under the terms of GNU GPL
*
- * libipt_ULOG.c,v 1.3 2000/07/31 11:51:50 laforge Exp
+ * libipt_ULOG.c,v 1.7 2001/01/30 11:55:02 laforge Exp
*/
#include <stdio.h>
#include <netdb.h>
@@ -17,6 +20,7 @@
#include <linux/netfilter_ipv4/ipt_ULOG.h>
#define ULOG_DEFAULT_NLGROUP 1
+#define ULOG_DEFAULT_QTHRESHOLD 1
void print_groups(unsigned int gmask)
@@ -37,6 +41,7 @@ static void help(void)
printf("ULOG v%s options:\n"
" --ulog-nlgroup nlgroup NETLINK group used for logging\n"
" --ulog-cprange size Bytes of each packet to be passed\n"
+ " --ulog-qthreshold Threshold of in-kernel queue\n"
" --ulog-prefix prefix Prefix log messages with this prefix.\n\n",
NETFILTER_VERSION);
}
@@ -45,6 +50,7 @@ static struct option opts[] = {
{"ulog-nlgroup", 1, 0, '!'},
{"ulog-prefix", 1, 0, '#'},
{"ulog-cprange", 1, 0, 'A'},
+ {"ulog-qthreshold", 1, 0, 'B'},
{0}
};
@@ -54,6 +60,7 @@ static void init(struct ipt_entry_target *t, unsigned int *nfcache)
struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) t->data;
loginfo->nl_group = ULOG_DEFAULT_NLGROUP;
+ loginfo->qthreshold = ULOG_DEFAULT_QTHRESHOLD;
/* Can't cache this */
*nfcache |= NFC_UNKNOWN;
@@ -62,6 +69,7 @@ static void init(struct ipt_entry_target *t, unsigned int *nfcache)
#define IPT_LOG_OPT_NLGROUP 0x01
#define IPT_LOG_OPT_PREFIX 0x02
#define IPT_LOG_OPT_CPRANGE 0x04
+#define IPT_LOG_OPT_QTHRESHOLD 0x08
/* Function which parses command options; returns true if it
ate an option */
@@ -119,6 +127,19 @@ static int parse(int c, char **argv, int invert, unsigned int *flags,
loginfo->copy_range = atoi(optarg);
*flags |= IPT_LOG_OPT_CPRANGE;
break;
+ case 'B':
+ if (*flags & IPT_LOG_OPT_QTHRESHOLD)
+ exit_error(PARAMETER_PROBLEM,
+ "Can't specify --ulog-qthreshold twice");
+ if (atoi(optarg) < 1)
+ exit_error(PARAMETER_PROBLEM,
+ "Negative or zero queue threshold ?");
+ if (atoi(optarg) > ULOG_MAX_QLEN)
+ exit_error(PARAMETER_PROBLEM,
+ "Maximum queue length exceeded");
+ loginfo->qthreshold = atoi(optarg);
+ *flags |= IPT_LOG_OPT_QTHRESHOLD;
+ break;
}
return 1;
}
@@ -136,7 +157,7 @@ static void save(const struct ipt_ip *ip,
= (const struct ipt_ulog_info *) target->data;
if (strcmp(loginfo->prefix, "") != 0)
- printf("--ulog-prefix \"%s\" ", loginfo->prefix);
+ printf("--ulog-prefix %s ", loginfo->prefix);
if (loginfo->nl_group != ULOG_DEFAULT_NLGROUP) {
printf("--ulog-nlgroup ");
@@ -144,7 +165,10 @@ static void save(const struct ipt_ip *ip,
printf("\n");
}
if (loginfo->copy_range)
- printf("--ulog-cprange %d", loginfo->copy_range);
+ printf("--ulog-cprange %d ", loginfo->copy_range);
+
+ if (loginfo->qthreshold != ULOG_DEFAULT_QTHRESHOLD)
+ printf("--ulog-qthreshold %d ", loginfo->qthreshold);
}
/* Prints out the targinfo. */
@@ -160,6 +184,7 @@ print(const struct ipt_ip *ip,
print_groups(loginfo->nl_group);
if (strcmp(loginfo->prefix, "") != 0)
printf("prefix `%s' ", loginfo->prefix);
+ printf("queue_threshold %d ", loginfo->qthreshold);
}
struct iptables_target ulog = { NULL,