Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 2009 17:13:43 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Andrea 'simplex' Zulato <simplex@twopenguins.it>
Cc:        =?windows-1251?B?yOv8/yDA7eTw5eXi?= <admin@aivus.name>, Gerrit Beine <gerrit.beine@gmx.de>, freebsd-ports@freebsd.org
Subject:   Re: Unrealircd problems with last patch
Message-ID:  <20090618141343.GB975@straylight.m.ringlet.net>
In-Reply-To: <20090618140708.GA975@straylight.m.ringlet.net>
References:  <4A388C26.3050900@twopenguins.it> <20090617085202.GA976@straylight.m.ringlet.net> <20090618140708.GA975@straylight.m.ringlet.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--gr/z0/N6AeWAPJVB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jun 18, 2009 at 05:07:08PM +0300, Peter Pentchev wrote:
> On Wed, Jun 17, 2009 at 11:52:02AM +0300, Peter Pentchev wrote:
> > On Wed, Jun 17, 2009 at 08:24:38AM +0200, Andrea 'simplex' Zulato wrote:
> > > Hi, i've upgraded c-ares and Unreal from ports but Unreal won't work.
> > > It start without a problem but when someone try to connect to the ser=
ver
> > > it crash with a core dump error:
> > > Jun 16 09:03:33 hazard kernel: pid 57652 (ircd), uid 0: exited on sig=
nal
> > > 11 (core dumped)
> > > I've tried to recompile unreal and c-ares whitout any result ("make
> > > install" finish without problems on both ports).
> > > If there's something that i could try, please tell me...
> > > I'm on a FreeBSD 7.2-RELEASE-p1 #0.
> >=20
> > Hi,
> >=20
> > I've CC'd Gerrit Beine (the actual maintainer of the irc/unreal port :)
> > and Ilya Andreev, who reported the same problem to me yesterday.
> >=20
> > Some time ago, I sent my proposed c-ares update for testing to all
> > the maintainers of ports that depend on c-ares directly.  My patches
> > made the ports compile, but I didn't have the proper setup to actually
> > test them working, since I'm not quite familiar with the programs
> > themselves.  Thus, I asked the maintainers for help with testing, and
> > after nobody replied for a week or so, I went ahead and commited the up=
date.
> >=20
> > Now Ilya Andreev and you have both hit a problem with UnrealIRCd,
> > and Ilya seems to have found a solution.  Could you try putting
> > the attached patch-res.c into the irc/unreal/files/ directory and
> > rebuilding UnrealIRCd?  If this patch helps, I could commit it if
> > Gerrit Beine does not mind.
>=20
> Actually, here's another patch from Ilya who wrote to me privately
> to say that the previous one didn't quite work.

And once again, with the patch inline this time, mainly for the benefit
of the ports@ mailing list and other poor souls who might stumble upon
this problem.

G'luck,
Peter

--- src/res.c	2006-09-19 15:45:18.000000000 +0300
+++ src/res.c	2009-06-17 17:50:18.000000000 +0300
@@ -48,10 +48,15 @@
=20
 #include <res.h>
=20
+/* Prevent crashes due to invalid prototype/ABI */
+#if ARES_VERSION < 0x010600
+ #error "You have an old c-ares version on your system and/or Unreals c-ar=
es failed to compile!"
+#endif
+
 /* Forward declerations */
-void unrealdns_cb_iptoname(void *arg, int status, struct hostent *he);
-void unrealdns_cb_nametoip_verify(void *arg, int status, struct hostent *h=
e);
-void unrealdns_cb_nametoip_link(void *arg, int status, struct hostent *he);
+void unrealdns_cb_iptoname(void *arg, int status, int timeouts, struct hos=
tent *he);
+void unrealdns_cb_nametoip_verify(void *arg, int status, int timeouts, str=
uct hostent *he);
+void unrealdns_cb_nametoip_link(void *arg, int status, int timeouts, struc=
t hostent *he);
 void unrealdns_delasyncconnects(void);
 static unsigned int unrealdns_haship(void *binaryip, int length);
 static void unrealdns_addtocache(char *name, void *binaryip, int length);
@@ -240,7 +245,7 @@
 #endif
 }
=20
-void unrealdns_cb_iptoname(void *arg, int status, struct hostent *he)
+void unrealdns_cb_iptoname(void *arg, int status, int timeouts, struct hos=
tent *he)
 {
 DNSReq *r =3D (DNSReq *)arg;
 DNSReq *newr;
@@ -290,7 +295,7 @@
 }
=20
=20
-void unrealdns_cb_nametoip_verify(void *arg, int status, struct hostent *h=
e)
+void unrealdns_cb_nametoip_verify(void *arg, int status, int timeouts, str=
uct hostent *he)
 {
 DNSReq *r =3D (DNSReq *)arg;
 aClient *acptr =3D r->cptr;
@@ -363,7 +368,7 @@
 	unrealdns_freeandremovereq(r);
 }
=20
-void unrealdns_cb_nametoip_link(void *arg, int status, struct hostent *he)
+void unrealdns_cb_nametoip_link(void *arg, int status, int timeouts, struc=
t hostent *he)
 {
 DNSReq *r =3D (DNSReq *)arg;
 int n;
@@ -390,9 +395,11 @@
 		/* fatal error while resolving */
 		sendto_realops("Unable to resolve hostname '%s', when trying to connect =
to server %s.",
 			r->name, r->linkblock->servername);
+		r->linkblock->refcount--;
 		unrealdns_freeandremovereq(r);
 		return;
 	}
+	r->linkblock->refcount--;
=20
 #ifdef INET6
 	if (((he->h_length !=3D 4) && (he->h_length !=3D 16)) || !he->h_addr_list=
[0])
@@ -715,21 +722,34 @@
 	} else
 	if (*param =3D=3D 'i') /* INFORMATION */
 	{
-		struct ares_config_info inf;
+		struct ares_options inf;
 		int i;
+		int optmask;
 	=09
-		ares_get_config(&inf, resolver_channel);
+		ares_save_options(resolver_channel, &inf, &optmask);
=20
 		sendtxtnumeric(sptr, "****** DNS Configuration Information ******");
 		sendtxtnumeric(sptr, " c-ares version: %s",ares_version(NULL));
-		sendtxtnumeric(sptr, "        timeout: %d", inf.timeout);
-		sendtxtnumeric(sptr, "          tries: %d", inf.tries);
-		sendtxtnumeric(sptr, "   # of servers: %d", inf.numservers);
-		for (i =3D 0; i < inf.numservers; i++)
-			sendtxtnumeric(sptr, "      server #%d: %s", i+1, inf.servers[i] ? inf.=
servers[i] : "[???]");
-		=09
-		/* TODO: free or get memleak ! */
+
+		if(optmask & ARES_OPT_TIMEOUTMS)
+			sendtxtnumeric(sptr, "        timeout: %d", inf.timeout);
+		if(optmask & ARES_OPT_TRIES)
+			sendtxtnumeric(sptr, "          tries: %d", inf.tries);
+		if(optmask & ARES_OPT_SERVERS)
+		{
+			sendtxtnumeric(sptr, "   # of servers: %d", inf.nservers);
+			for (i =3D 0; i < inf.nservers; i++)
+				sendtxtnumeric(sptr, "      server #%d: %s", i+1, inet_ntoa(inf.server=
s[i]));=09
+		}
+		if(optmask & ARES_OPT_DOMAINS)
+		{
+			sendtxtnumeric(sptr, "   # of search domains: %d", inf.ndomains);
+			for (i =3D 0; i < inf.ndomains; i++)
+				sendtxtnumeric(sptr, "      domain #%d: %s", i+1, inf.domains[i]);
+		}
 		sendtxtnumeric(sptr, "****** End of DNS Configuration Info ******");
+	=09
+		ares_destroy_options(&inf);
 	} else /* STATISTICS */
 	{
 		sendtxtnumeric(sptr, "DNS CACHE Stats:");

--=20
Peter Pentchev	roam@ringlet.net    roam@space.bg    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
Hey, out there - is it *you* reading me, or is it someone else?

--gr/z0/N6AeWAPJVB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAko6S5cACgkQ7Ri2jRYZRVOnRQCeJhhwwxfbk0jHpHmuXiBb056f
5DUAoKBgHXmv4ztE406PN6hYx0Helhyd
=ivi5
-----END PGP SIGNATURE-----

--gr/z0/N6AeWAPJVB--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090618141343.GB975>