From owner-freebsd-net Wed Sep 18 0:31:30 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 88B4537B401 for ; Wed, 18 Sep 2002 00:31:29 -0700 (PDT) Received: from pirzyk.org (dsl-65-184-181-29.telocity.com [65.184.181.29]) by mx1.FreeBSD.org (Postfix) with ESMTP id E16B343E86 for ; Wed, 18 Sep 2002 00:31:28 -0700 (PDT) (envelope-from jim@pirzyk.org) Received: from snoopy (snoopy-wap.pirzyk.org [10.26.0.10]) by pirzyk.org (8.12.3/8.12.3) with ESMTP id g8I7Tasp003386 for ; Wed, 18 Sep 2002 00:29:36 -0700 (PDT) (envelope-from jim@pirzyk.org) Content-Type: text/plain; charset="us-ascii" From: Jim Pirzyk To: freebsd-net@freebsd.org Subject: getnetbyname broken for DNS case? Date: Wed, 18 Sep 2002 00:32:11 -0700 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200209180032.11590.jim@pirzyk.org> Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, I am trying to debug a problem that I have with /etc/exports. I cannot put in the symbolic name for my network (10.26.0.0) without putting it in /etc/networks. It is currently in DNS, but it looks like the getnetbyname is not working correctly for the DNS case. The functions that are broken is _getnetbydnsname() and getnetanswer(). The _getnetbydnsname() is easily fixed by changing T_PTR to T_A in res_query(), but getnetanswer() is harder to solve. It is not parsing the format of the result correctly. First I had to put some code in to test "type" being T_PTR only if "net_i" is set to BYADDR and T_A if "net_i" is set to BYNAME. When I go into the res_hnok() test, it is assumed by the code that it IP address is in ascii format, which it is not (it is in network binary order). If I remove the res_hnok() test, then it does not load the netent.n_net address correctly. The code is broken for both -CURRENT and -STABLE. So my question is then, can I rewrite getnetbyname() to use gethostbyname() call and massage the result to a netent entry? This would solve the DNS result parsing problem and would also get us T_AAA (IPv6) network name addresses. I would also implement getnetbyaddr() in terms of gethostbyaddr() too. - JimP --- @(#) $Id: dot.signature,v 1.10 2001/05/17 23:38:49 Jim.Pirzyk Exp $ __o jim@pirzyk.org ----------------------------------------------- _'\<,_ (*)/ (*) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message