summaryrefslogtreecommitdiffstats
path: root/ulogd/ulogd.c
diff options
context:
space:
mode:
authorlaforge <laforge>2002-07-30 07:15:54 +0000
committerlaforge <laforge>2002-07-30 07:15:54 +0000
commit04004d5b08a271cee71da169fdc2b8a376c2cb0a (patch)
treebda6f207a5bd33d3d2e42b524864b157230e6182 /ulogd/ulogd.c
parent57434b6c4ff88c1810532acc57a2b0876ed2fc52 (diff)
make MYBUFSIZ constant a configuration parameter (bogdan dobrota)
Diffstat (limited to 'ulogd/ulogd.c')
-rw-r--r--ulogd/ulogd.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/ulogd/ulogd.c b/ulogd/ulogd.c
index 55ec461..e2564bf 100644
--- a/ulogd/ulogd.c
+++ b/ulogd/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 =