Re: How to make svlogd send logs via UDP

From: Nicolas de Bari Embriz Garcia Rojas <nbari_at_dalmp.com>
Date: Sun, 13 Mar 2016 15:02:58 +0100

Hi, the patch worked, any chance to apply it to the main distribution ?

regards.

On Sat, Feb 6, 2016 at 1:52 AM, Guillermo <gdiazhartusch_at_gmail.com> wrote:

> Hi,
>
> 2016-02-04 11:11 GMT-03:00 Nicolas de Bari Embriz Garcia Rojas:
> >
> > 4909 svlogd CALL sendto(0x7,0x609580,0x3c,0,0x609c3c,0x10)
> > 4909 svlogd STRU struct sockaddr { AF_UNSPEC, unknown address
> family }
> > 4909 svlogd RET sendto -1 errno 47 Address family not supported by
> protocol family
> > [...]
> > Any ideas ?
>
> Looking at svlogd.c, it seems the logdir_open() function, which among
> other things parses the 'config' file in the log directory, doesn't
> set the udpaddr.sin_family field in the struct logdir it is given. On
> my GNU/Linux system, strace shows sendto() is indeed given a struct
> sockaddr_in argument with an AF_UNSPEC address family, but the call
> succeeds regardless. My guess is that since it is passed an AF_INET
> socket, the implementation just assumes the struct sockaddr * argument
> points to a struct sockaddr_in, and doesn't check the sa_family field.
> Your system's implementation seems stricter, is that a BSD?
>
> Anyway, you may want to see if the attached patch makes your system
> happy. Linux strace says it should work...
> G.
>
> --- old/src/svlogd.c 2014-08-10 15:22:34.000000000 -0300
> +++ new/src/svlogd.c 2016-02-04 22:53:52.910965361 -0300
> _at__at_ -430,6 +430,7 @@
> ld->name =(char*)fn;
> ld->ppid =0;
> ld->match ='+';
> + ld->udpaddr.sin_family =AF_INET;
> ld->udpaddr.sin_port =0;
> ld->udponly =0;
> while (! stralloc_copys(&ld->prefix, "")) pause_nomem();
>
Received on Sun Mar 13 2016 - 14:02:58 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC