On Sun, Sep 15, 2002 at 06:33:51PM -0700, Nate Campi wrote:
On Sun, Sep 15, 2002 at 08:16:13PM -0400, Robert D. Beal wrote:
I'm trying to get syslog-ng (1.5.20) to use 514 as its source port when using the udp destination driver as follows:
destination d_syslog { udp("192.168.0.2" destport(514) localport(514)); };
I had no idea you could set the local port, I just checked the source of 1.5.20 and found this example:
doc/sgml/syslog-ng.sgml: destination d_tcp { tcp("10.1.2.3" port(1999); localport(999)); };
Looks like you need this:
destination d_syslog { udp("192.168.0.2" port(514); localport(514)); };
As it seems the docs is buggy, Robert is right. The bug lies in libol, it only binds the local socket if the local address is defined. So there are two solutions: * supply localip as well as localport * apply this patch to libol, and recompile diff -u -r1.26 -r1.28 --- io.c 11 Oct 2001 18:25:14 -0000 1.26 +++ io.c 16 Sep 2002 08:23:22 -0000 1.28 @@ -829,9 +834,9 @@ memcpy(sa, &a->sa, sizeof(a->sa)); return 1; } - if (a->ip && !tcp_addr(in, - a->ip->length, a->ip->data, - a->port)) + if (tcp_addr(in, + a ? a->ip->length : 7, a ? a->ip->data : "0.0.0.0", + a->port)) return 0; else if (!a->ip && !tcp_addr(in, 0, NULL, a->port)) -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1