[En-Nut-Discussion] Syslogserver
Ralf Spettel
r.spettel at raumcomputer.com
Tue Jan 25 17:01:03 CET 2005
Hello, I had problems with the Syslog Server
If I start syslog with
setlogserver(ip_syslogserver, 0);
with ip_syslogserver is a _local network_ IP from a nonexisting or switched
off PC the NutOS
will be very slow. I debug this and found that every send SyslogMsg (via
vsyslog)
to this IP sents a ARP Request. I check some funktions and install this
workaround:
// I give the error from NutUdpSendTo back to the highlevel app
//old: void vsyslog(int pri, CONST char *fmt, va_list ap)
//new:
int vsyslog(int pri, CONST char *fmt, va_list ap)
{
...
if (syslog_server)
{
//old: NutUdpSendTo(syslog_sock, syslog_server, syslog_port,
syslog_buf, cnt);
//new: if wrong IP and ARP fails, return -1
return NutUdpSendTo(syslog_sock, syslog_server, syslog_port,
syslog_buf, cnt);
}
...
}
and
//old: void syslog(int pri, CONST char *fmt, ...)
int syslog(int pri, CONST char *fmt, ...)
{
//ralf:
int result;
va_list ap;
va_start(ap, fmt);
//ralf
result = vsyslog(pri, (char *) fmt, ap);
va_end(ap);
//ralf
return result;
}
// if I get a error I switch off my SyslogMSGs
// simple, but it works well
if ( vsyslog(pri, rp, ap) == -1 ) //Error, maybe wrong IP
{
SysLogActiv=OFF;
}
Ralf
More information about the En-Nut-Discussion
mailing list