]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
make MYBUFSIZ constant a configuration parameter (bogdan dobrota)
authorlaforge <laforge>
Tue, 30 Jul 2002 07:15:54 +0000 (07:15 +0000)
committerlaforge <laforge>
Tue, 30 Jul 2002 07:15:54 +0000 (07:15 +0000)
ulogd.c
ulogd.conf

diff --git a/ulogd.c b/ulogd.c
index 55ec461d18cd7d8529eb528f70646c8159aaf6f9..e2564bf0f70d5a0f8c1d0356163142e572f7af06 100644 (file)
--- a/ulogd.c
+++ b/ulogd.c
@@ -1,6 +1,6 @@
-/* ulogd, Version $Revision: 1.25 $
+/* ulogd, Version $Revision: 1.26 $
  *
- * $Id: ulogd.c,v 1.25 2002/06/13 12:57:25 laforge Exp $
+ * $Id: ulogd.c,v 1.26 2002/07/30 07:04:12 laforge Exp $
  *
  * userspace logging daemon for the netfilter ULOG target
  * of the linux 2.4 netfilter subsystem.
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd.c,v 1.25 2002/06/13 12:57:25 laforge Exp $
+ * $Id: ulogd.c,v 1.26 2002/07/30 07:04:12 laforge Exp $
  *
  * Modifications:
  *     14 Jun 2001 Martin Josefsson <gandalf@wlug.westbo.se>
@@ -51,7 +51,7 @@
 /* Size of the netlink receive buffer. If you have _big_ in-kernel
  * queues, you may have to increase this number. 
  * ( --qthreshold 100 * 1500 bytes/packet = 150kB */
-#define MYBUFSIZ 65535
+#define ULOGD_BUFSIZE_DEFAULT 65535
 
 #ifdef DEBUG
 #define DEBUGP(format, args...) fprintf(stderr, format, ## args)
@@ -506,7 +506,11 @@ static config_entry_t logf_ce = { NULL, "logfile", CONFIG_TYPE_STRING,
                                  CONFIG_OPT_NONE, 0, 
                                  { string: ULOGD_LOGFILE_DEFAULT } };
 
-static config_entry_t plugin_ce = { &logf_ce, "plugin", CONFIG_TYPE_CALLBACK,
+static config_entry_t bufsiz_ce = { &logf_ce, "bufsize", CONFIG_TYPE_INT,       
+                                  CONFIG_OPT_NONE, 0,
+                                  { value: ULOGD_BUFSIZE_DEFAULT } }; 
+
+static config_entry_t plugin_ce = { &bufsiz_ce, "plugin", CONFIG_TYPE_CALLBACK,
                                    CONFIG_OPT_MULTI, 0, 
                                    { parser: &load_plugin } };
 
@@ -626,7 +630,14 @@ int main(int argc, char* argv[])
 #endif
 
        /* allocate a receive buffer */
-       libulog_buf = (unsigned char *) malloc(MYBUFSIZ);
+       libulog_buf = (unsigned char *) malloc(bufsiz_ce.u.value);
+
+       if (!libulog_buf) {
+               ulogd_log(ULOGD_FATAL, "unable to allocate receive buffer"
+                         "of %d bytes\n", bufsiz_ce.u.value);
+               ipulog_perror(NULL);
+               exit(1);
+       }
        
        /* create ipulog handle */
        libulog_h = 
index a3a998a84a152d884ebd0999a1ca5aa04f070b9c..e06a3aef8206a8362df7db9f7fafb28061a21664 100644 (file)
@@ -1,5 +1,5 @@
 # Example configuration for ulogd
-# $Id: ulogd.conf,v 1.6 2001/10/02 16:39:17 laforge Exp $
+# $Id: ulogd.conf,v 1.7 2002/07/30 07:04:12 laforge Exp $
 #
 
 ######################################################################
@@ -15,6 +15,10 @@ logfile /var/log/ulogd.log
 # loglevel: debug(1), info(3), notice(5), error(7) or fatal(8)
 loglevel 5
 
+# libipulog receive buffer size (should be at least the size of the
+# in-kernel buffer (ipt_ULOG.o 'nlbufsiz' parameter)
+bufsize 65535
+
 ######################################################################
 # PLUGIN OPTIONS
 ######################################################################