[BusyBox] sysklogd should use sendto for remote logging

Michael Stiller ms at 2scale.net
Wed Feb 19 18:02:06 UTC 2003


Hi,

> 
> Joshua Jackson's patch for the writev part of the problem was committed to CVS.
> I had overlooked the connect part.

Yes.

> > As syslog uses udp busybox should use sendto instead of connect/writev. 
> 
> No. connect/writev is more efficient, especially given that we are sending multiple
> buffers.

Maybe. I really can't tell at the moment, and so i assume that you are
right.

> As submitted, I see two problems with this patch
> 
> 1. It defines a buffer that could be smaller than the incoming string. Data could be lost here.
>    Of course, the original code could lose data too, by trying to stuff more than 512 bytes into the UDP
>    packet. That may need fixing.

Yes.

>    In general, I think it is perverse to copy data into a temporary buffer just so we can use sendto.

Yes right. But i needed a partially working version fast and did't spend
much time on it.

> 2. Whereas the original code provides some indication of a connection failure, the patch would simply
>    loop forever. It clearly needs to write error messages to the console. Probably the thing to do is to print
>    an error message (and the log entry if local logging is off) to the console, and only die on errors that we know
>    to be fatal. 
> 
> I'll send a patch unless someone beats me to it.

The Problem with the "die on errors" is, the receiving syslogd could be
down on startup causing the busybox to log nothing at all. This is not
good. This issue really should be corrected. 

I guess the right solution would be to retry the connect if it didn't
succeed the first time and there is some data to send. 

-Michael

 




More information about the busybox mailing list