From owner-freebsd-bugs Fri Nov 14 20:30:03 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA28839 for bugs-outgoing; Fri, 14 Nov 1997 20:30:03 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA28828; Fri, 14 Nov 1997 20:30:01 -0800 (PST) (envelope-from gnats) Resent-Date: Fri, 14 Nov 1997 20:30:01 -0800 (PST) Resent-Message-Id: <199711150430.UAA28828@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, pavlin@catarina.usc.edu Received: (from nobody@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA28485; Fri, 14 Nov 1997 20:24:42 -0800 (PST) (envelope-from nobody) Message-Id: <199711150424.UAA28485@hub.freebsd.org> Date: Fri, 14 Nov 1997 20:24:42 -0800 (PST) From: pavlin@catarina.usc.edu To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: bin/5047: ipfw(8) IP address resolving problem if only /etc/hosts used Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 5047 >Category: bin >Synopsis: ipfw(8) IP address resolving problem if only /etc/hosts used >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 14 20:30:00 PST 1997 >Last-Modified: >Originator: Pavlin Ivanov Radoslavov >Organization: University of Southern California, Dept. of CS >Release: 2.2.1 >Environment: FreeBSD fbsd14.usc.edu 2.2.1-RELEASE FreeBSD 2.2.1-RELEASE #0: Mon Sep 1 23:11:02 PDT 1997 pim@fbsd14.usc.edu:/usr/home/local/pim/sys/compile/FBSD i386 >Description: If only /etc/hosts is used to resolve hosts names, ipfw does not accept IP addresses, only hosts names. >How-To-Repeat: 1. Recompile the kernel with IP firewall enabled (options IPFIREWALL) and reboot 2. Comment out "bind" and "nis", and uncomment "hosts" in /etc/host.conf 3. Execute the following three lines (from the console!): /sbin/ipfw -f flush /sbin/ipfw add 65000 pass all from any to any /sbin/ipfw add 1000 pass all from 127.0.0.1 to 127.0.0.1 >Fix: Apply the following patch to /usr/src/sbin/ipfw/ipfw.c --- ipfw.c Wed Mar 5 04:30:08 1997 +++ ipfw-new.c Fri Nov 14 19:56:13 1997 @@ -386,8 +386,13 @@ { struct hostent *he = gethostbyname(host); - if (!he) - return(-1); + if (!he) { + u_long host_addr; + host_addr = inet_addr(host); + he = gethostbyaddr((char *)&host_addr, sizeof(u_long), AF_INET); + if (!he) + return(-1); + } *ipaddr = *(struct in_addr *)he->h_addr_list[0]; >Audit-Trail: >Unformatted: