2.0.30 buggy UDP 127.0.0.[01] binding/routing?

Christopher Hassell (hassell@ichaos.com)
Tue, 22 Apr 1997 00:04:13 -0600


I ran into a quite annoying snag when I called connect() for a UDP socket
in order to aim at a local server.

I was aiming to connect at "localhost" which is 127.0.0.1 in my /etc/hosts.

What I got was this line in netstat -n (right after the client called
connect() for its UDP socket).

from: to:

udp -1 0 127.0.0.0:1032 127.0.0.1:4103 ESTABLISHED

The reply-packets (after recvfrom()) from sendto() *never* seemed to work.
It also seemed to "damage" the socket so the next recvfrom() on that
server-side socket (*.4103) generated a Connection refused error. What is that
supposed to mean normally?

I tore my hair out until I realized that I needed to merely try 127.0.0.0
instead of 127.0.0.1. It worked fine.. then.. from 127.0.0.0 to 127.0.0.0.

But not when the server's socket was aimed back along its packet addr
(i.e. one would believe it is reverse-addressed "from 127.0.0.1 to 127.0.0.0").

Also, why was the default binding for connecting a UDP socket --> 127.0.0.1
to bind as 127.0.0.0? It could be made the same... I would suppose. Hmm,
maybe not.

Is there anyone out there who has also had problems with a UDP "sendto()"
sent from 127.0.0.[^0] to 127.0.0.0? This isn't some routing bug is it?

Nothing wrong with the /sbin/route line. I'm running 2.0.30 with a PCI ne2000,
and 16M.

loopback * 255.0.0.0 U 3584 0 92 lo

lo Link encap:Local Loopback
inet addr:127.0.0.0 Bcast:127.255.255.255 Mask:255.0.0.0
UP BROADCAST LOOPBACK RUNNING MTU:3584 Metric:1
RX packets:2451 errors:0 dropped:0 overruns:0
TX packets:2451 errors:0 dropped:0 overruns:0

eth0 Link encap:10Mbps Ethernet HWaddr 00:C0:0C:B0:1E:28
inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:40197 errors:0 dropped:0 overruns:0
TX packets:40326 errors:0 dropped:0 overruns:0
Interrupt:11 Base address:0x1020

sl0 Link encap:Serial Line IP
inet addr:127.0.0.2 P-t-P:127.0.0.3 Mask:255.0.0.0
UP POINTOPOINT RUNNING MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0
TX packets:2 errors:0 dropped:0 overruns:0

The last line is for diald.

Is there some Right Way to avoid this that I just didn't know about.
I'm seeing this only as I am using UDP and testing it via the loopback net.

-- CH

-- 
// {if(me==chris)me->confuse(yu);} // DubleTawk+SinglThots+AntiFathe: UnRome II
### C>H> ### jeezfrk@h2net.net ////////////////// {"Nietzsche is dead."-God} //