Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 1997 20:24:42 -0800 (PST)
From:      pavlin@catarina.usc.edu
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/5047: ipfw(8) IP address resolving problem if only /etc/hosts used
Message-ID:  <199711150424.UAA28485@hub.freebsd.org>
Resent-Message-ID: <199711150430.UAA28828@hub.freebsd.org>

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

>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:



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