From owner-cvs-all@FreeBSD.ORG Thu May 29 15:00:07 2008 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1CA21065672; Thu, 29 May 2008 15:00:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 572DE8FC18; Thu, 29 May 2008 15:00:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id F0E3041C798; Thu, 29 May 2008 17:00:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id hwUaDwhl7jCU; Thu, 29 May 2008 17:00:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 965C141C795; Thu, 29 May 2008 17:00:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id AB3C944487F; Thu, 29 May 2008 14:58:38 +0000 (UTC) Date: Thu, 29 May 2008 14:58:38 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Oliver Fromme In-Reply-To: <200805291416.m4TEGn5X066744@haluter.fromme.com> Message-ID: <20080529144348.L65662@maildrop.int.zabbadoz.net> References: <200805291416.m4TEGn5X066744@haluter.fromme.com> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: inet(3) inet_network() bug, [was: cvs commit: src/usr.sbin/jexec jexec.8 jexec.c] X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2008 15:00:08 -0000 On Thu, 29 May 2008, Oliver Fromme wrote: Hi, > > > However, I do share the concern that there's an ambiguity > > > in the syntax: "127" can be a jail ID as well as an IP > > > number (same as 0.0.0.127) or a hostname. Either the > > > > actually 127.0.0.0 > > I'm afraid I think it is 0.0.0.127. > 127.0.0.0 would be 2130706432. 127.0.0.1 is 0x0000007f. ~/tmp> ./a.out 127 127.0.0.0 > > > using 127.1 as a shotcut for 127.0.0.1. > > > > Yes. because that is 127.1.0.0 and not 127.0.0.1. > > I'm pretty sure 127.1 is the same as 127.0.0.1. Last > time I used telnet 127.1 to test things it worked fine. > > 127.1.0.0 would be 127.65536. re-reading the man page inet(3) it seems you would be right for 127.0.0.1 == 127.1 -- just that our implementation of inet_network() doesn't think you are... *sigh* I know this function. It's from bind sources... ~/tmp> ./a.out 127.1 1.127.0.0 btw. the 3 digit version seems to be broken as well: ~/tmp> ./a.out 128.1.2 2.1.128.0 ~/tmp> cat 127.c #include #include #include #include #include #include int main(int argc, char *argv[]) { in_addr_t ia; char buf[16]; if (argc != 2) errx(1, "usage: %s IP-address", argv[0]); ia = inet_network(argv[1]); if (ia == INADDR_NONE) err(1, "inet_network"); if (inet_ntop(AF_INET, &ia, buf, sizeof(buf)) == NULL) err(1, "inet_ntop"); printf("%s\n", buf); return (0); } -- Bjoern A. Zeeb Stop bit received. Insert coin for new game.