From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 9 16:25:46 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 56B9716A420 for ; Thu, 9 Mar 2006 16:25:46 +0000 (GMT) (envelope-from freebsd-hackers@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id E102143D49 for ; Thu, 9 Mar 2006 16:25:45 +0000 (GMT) (envelope-from freebsd-hackers@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FHNvx-0006Zw-Nl for freebsd-hackers@freebsd.org; Thu, 09 Mar 2006 17:24:13 +0100 Received: from gw205.f5.com ([205.229.151.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Mar 2006 17:24:13 +0100 Received: from atkin901 by gw205.f5.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Mar 2006 17:24:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: othermark Date: Thu, 09 Mar 2006 08:23:24 -0800 Lines: 52 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: gw205.f5.com User-Agent: KNode/0.10.1 Sender: news Subject: Advice on the lightweight resolver, lwres. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2006 16:25:46 -0000 I was working on converting the STAF (staf.sourceforge.net) project to an freebsd port, and on my first attempt, I attempted to use the lightweight resolver library because of the thread safe functions _r() that were available. However once I finished a straight port, I found, that lwres_gethostbyname() always returns 61 (connection refused). Nothing ever shows up on tcpdump on any interface (yes, even lo0). Of course, just changing the netdb include and compiling without lwres works. example of slightly modified code from the staf project: #include #include #include #define HERROR -1 int main(void) { char buffer[256]; struct hostent *host; if (gethostname(buffer, sizeof(buffer)) == HERROR) { fprintf(stderr,"Error getting hostname: gethostname() RC=%d\n", errno); return errno; } host = gethostbyname(buffer); if (host == 0) { fprintf(stderr,"Error getting hostent structure: gethostbyname() RC=%d\n",errno); return errno; } return 0; } $ gcc -o lwres-test lwres-test.c -llwres $ ./lwres-test Error getting hostent structure: gethostbyname() RC=61 -- othermark atkin901 at nospam dot yahoo dot com (!wired)?(coffee++):(wired);