[bazsi@balabit.hu: Re: [syslog-ng] Re: bug?]

Balazs Scheidler bazsi@balabit.hu
Mon, 19 Jul 1999 23:48:01 +0200


--9jxsPFA5p3P2qPhR
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

This mail contains two patches you may be interested in. (especially under
*BSD)

----- Forwarded message from Balazs Scheidler <bazsi@balabit.hu> -----

Date: Mon, 19 Jul 1999 23:42:49 +0200
From: Balazs Scheidler <bazsi@balabit.hu>
To: joeym@inficad.com
Subject: Re: [syslog-ng] Re: bug?

>=20
> Sometimes when I SIGHUP syslog-ng (client or server), I will get this
> too:
>=20
> SIGHUP received, restarting syslog-ng
> new configuration initialized
> io_iter(): no waiting fds and no callouts! exiting...
>=20
> However, every once in a while, it will say 'new configuration
> initilized' and keep right on going.  But most of the time, it gives the
> io_iter() err and exits.

Please try this patch against libol:

--- libol-0.2.0/src/io.c        Sat Jul 10 15:23:09 1999
+++ libol/src/io.c      Mon Jul 19 23:04:46 1999
@@ -268,9 +268,7 @@
                                ol_queue_remove(&n->header);
                                ol_space_free(n);
                        }
-                       else {
-                               nco++;
-                       }
+                       nco++;
                }
        }
        if (!nfds && !nco) {

The other problem should be BSD specific. (or my solution is Linux specific
some way. I assumed that recvfrom() on connected sockets return the source
address of the connection, but as it seems under BSD this is not the case.)
Try the following somewhat (ugly) patch, to see if this is the problem:

--- syslog-ng-1.1.27/src/afsocket.c     Sat Jul 10 17:58:33 1999
+++ syslog-ng/src/afsocket.c    Mon Jul 19 23:22:37 1999
@@ -106,6 +106,16 @@
 static void do_handle_afinet_line(struct log_handler *c, struct log_info *=
msg)
 {
        CAST(afsocket_source_connection, self, c);
+       if (!msg->saddr) {
+               char sockaddr_buf[256];
+               struct sockaddr *sa =3D (struct sockaddr *) &sockaddr_buf;
+               int salen =3D sizeof(sockaddr_buf);
+
+               if (getpeername(self->fd, sa, &salen) !=3D -1) {
+                       msg->saddr =3D ol_space_alloc(salen);
+                       memcpy(msg->saddr, sa, salen);
+               }
+       }
        HANDLE_LOG(self->super.next, msg);
 }

I've fixed another problem not reported by you. Variable names beginning=20
with the same bytestring (e.g. f_router & f_router_acct) were resolved
incorrectly. Check out the mailing list (or the archive at
http://lists.balabit.hu/pipermail) for that patch.

--=20
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
     url: http://www.balabit.hu/pgpkey.txt

----- End forwarded message -----

--=20
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
     url: http://www.balabit.hu/pgpkey.txt

--9jxsPFA5p3P2qPhR
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia

iQEVAwUBN5OdEMGXIGCa+NCpAQF23Qf/RTr0v+z3uYMqtF7F9r8cpJ4WxPMz30rx
fUpJejWhCK7dUkqdmh7yvpnQrhW0kj8hj34bIjtW5Fx3JP+lVbwADM5MUyScEVoR
qDJMKV1Cxs5P6bSJndg15drEIwltBzkY71Cn3KRnzMdHsqzfzCuIIA8V+GB4RnJM
8vug7981D97BCDMdcSVwCUIAwJsy8Dg998P+UN0Ou/NoYHi3GSo+Qb/SNQSWijT+
Kjm1HFSryTlavdc/rMkdmeNl2p8FlcqGBJbZ1Hm7BhIbIVQ1ooora3PNUmzALqOV
h5UPPpKpSk5/K1qNL24w9fG2N7ADPnlK3XFRdXljokq9Fod5hb+L4g==
=B8wh
-----END PGP SIGNATURE-----

--9jxsPFA5p3P2qPhR--