Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Oct 2002 22:46:46 +0800
From:      Eugene Grosbein <eugen@grosbein.pp.ru>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: increasing MAXLINE for syslog
Message-ID:  <20021026224646.A362@grosbein.pp.ru>
In-Reply-To: <200210261120.g9QBKOXL025814@lurza.secnetix.de>; from olli@secnetix.de on Sat, Oct 26, 2002 at 01:20:24PM %2B0200
References:  <3DBA4189.2629E3DC@grosbein.pp.ru> <200210261120.g9QBKOXL025814@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 26, 2002 at 01:20:24PM +0200, Oliver Fromme wrote:

>  > > > I've rebuilt and reinstalled libc, syslogd and logger using 10Kb as limit,
                                      ^^^^
>  > > > then killed and restarted syslogd. logger still cannot log a message
>  > > > longer than 1Kb. What else should be done?
>  > > Did you also resize the 1K buffer in logger.c?
>  > Yes, I did.
> 
> Did you inrease the sizes of fmt_cpy[] _and_ tbuf[]
> in src/lib/libc/gen/syslog.c:vsyslog() accordingly?

Yes, I did that too. I see it's time to show my patches.

Against libc:

--- Makefile.inc.orig	Sun Sep 15 08:30:45 2002
+++ Makefile.inc	Fri Oct 25 22:14:47 2002
@@ -4,6 +4,10 @@
 # machine-independent gen sources
 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/gen ${.CURDIR}/../libc/gen
 
+.if defined(SYSLOG_MAXLINE)
+CFLAGS+=-DMAXLINE=${SYSLOG_MAXLINE}
+.endif
+
 SRCS+=  _rand48.c _spinlock_stub.c alarm.c arc4random.c assert.c \
 	basename.c \
 	clock.c closedir.c confstr.c \
--- syslog.c.orig	Thu Apr 11 05:35:50 2002
+++ syslog.c	Fri Oct 25 22:15:46 2002
@@ -131,6 +131,10 @@
 	va_end(ap);
 }
 
+#ifndef MAXLINE
+#define MAXLINE	2048
+#endif
+
 void
 vsyslog(pri, fmt, ap)
 	int pri;
@@ -141,7 +145,7 @@
 	register char ch, *p;
 	time_t now;
 	int fd, saved_errno;
-	char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26];
+	char *stdp, tbuf[MAXLINE], fmt_cpy[MAXLINE], timbuf[26];
 	FILE *fp, *fmt_fp;
 	struct bufcookie tbuf_cookie;
 	struct bufcookie fmt_cookie;

Against syslogd:

--- Makefile.orig	Fri Oct 25 22:07:27 2002
+++ Makefile	Fri Oct 25 22:08:16 2002
@@ -10,4 +10,8 @@
 CFLAGS+=-DINET6 -I${.CURDIR}/../../usr.bin/wall
 WARNS?=	1
 
+.if defined(SYSLOG_MAXLINE)
+CFLAGS+=-DMAXLINE=${SYSLOG_MAXLINE}
+.endif
+
 .include <bsd.prog.mk>
--- syslogd.c.orig	Fri Oct 25 22:07:19 2002
+++ syslogd.c	Fri Oct 25 22:08:38 2002
@@ -71,7 +71,10 @@
  * Priority comparison code by Harlan Stenn.
  */
 
+#ifndef MAXLINE
 #define	MAXLINE		1024		/* maximum line length */
+#endif
+
 #define	MAXSVLINE	120		/* maximum saved line length */
 #define DEFUPRI		(LOG_USER|LOG_NOTICE)
 #define DEFSPRI		(LOG_KERN|LOG_CRIT)


And against logger:

--- Makefile.orig	Sat Oct 26 11:23:32 2002
+++ Makefile	Sat Oct 26 11:24:11 2002
@@ -4,4 +4,8 @@
 PROG=	logger
 CFLAGS+=-DINET6
 
+.ifdef SYSLOG_MAXLINE
+CFLAGS+=-DMAXLINE=${SYSLOG_MAXLINE}
+.endif
+
 .include <bsd.prog.mk>
--- logger.c.orig	Sat Oct 26 11:20:58 2002
+++ logger.c	Sat Oct 26 11:22:10 2002
@@ -78,6 +78,9 @@
 #endif
 int	send_to_all = 0;	/* send message to all IPv4/IPv6 addresses */
 
+#ifndef MAXLINE
+#define MAXLINE 1024
+#endif
 /*
  * logger -- read and log utility
  *
@@ -90,7 +93,7 @@
 	char *argv[];
 {
 	int ch, logflags, pri;
-	char *tag, *host, buf[1024];
+	char *tag, *host, buf[MAXLINE];
 
 	tag = NULL;
 	host = NULL;


I've put SYSLOG_MAXLINE=10240 into my /etc/make.conf and saw -DMAXLINE=10240
was here while rebuilding libc, syslogd and logger. I still cannot get
more than 1K written to the log. Here is my test script:

#!/bin/sh
#
# write line of dashes, length is passed as $1
#
perl -e "print '-' x $1;" | logger -t logger 
#
# See what's written actually
sed -E -e '/logger:/!d' -e 's/^.*logger: -(.*)$/\1/' /var/log/messages | \
	tail -1
#EOF

I run ./test.sh number | wc -c to see. It shows it can write upto 996 dashes,
with date and prefix it gives upto 1Kb. No more. What's a trick?

Eugene Grosbein

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021026224646.A362>