Try to compile this and see if you get 127.0.0.1 printed


#include <ns.h>

main()
{
   struct in_addr addr;
   addr.s_addr = inet_addr("127.0.0.1");
   printf("%s\n", ns_inet_ntoa(addr));
}

gcc -I /usr/local/ns/include -o a a.c /usr/local/ns/lib/libnsthread.so


Michael A. Cleverly wrote:
I've compiled naviserver on OpenBSD 4.0/sparc64.  What baffles me is
that [ns_conn peeraddr] always returns 0.0.0.0 for the client IP.  The
access.log also shows 0.0.0.0 as the source IP address.

For example:

0.0.0.0 - - [05/Feb/2007:19:08:16 -0700] "GET / HTTP/1.1" 200 865 ""
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.7)
Gecko/20060911 Camino/1.0.3" 3.562137
0.0.0.0 - - [05/Feb/2007:20:45:37 -0700] "GET / HTTP/1.0" 200 865 ""
"Lynx/2.8.5rel.4 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7j" 4.294168

The first is from my powerbook; the second is from lynx (local to the box).

Just to rule out some completely screwed up tcp configuration I wrote
a small tclsh script.  When I point a browser to it tclsh knows the
real peer's address.

    proc accept {sock peer port} {after 1000 [list reply $sock]}

    proc reply {sock} {
        puts $sock "HTTP/1.0 200 OK"
        puts $sock "MIME-Version: 1.0"
        puts $sock "Content-Type: text/plain"
        puts $sock ""
        puts $sock [fconfigure $sock -peername]
        close $sock
    }

    socket -server accept -myaddr 0.0.0.0 80
    vwait forever

I get:

    67.172.241.159 c-67-172-241-159.hsd1.ut.comcast.net 64323
    127.0.0.1 localhost 4660

Any thoughts on why nsd doesn't see the real peer address?

Thanks,

Michael

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


--
Vlad Seryakov
571 262-8608 office
[EMAIL PROTECTED]
http://www.crystalballinc.com/vlad/


Reply via email to