Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 1998 01:10:10 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        rminnich@Sarnoff.COM (Ron G. Minnich)
Cc:        luoqi@watermarkgroup.com, avalon@coombs.anu.edu.au, hackers@FreeBSD.ORG, nate@mt.sri.com
Subject:   Re: ECONNREFUSED on a READ?
Message-ID:  <199806090110.SAA22672@usr07.primenet.com>
In-Reply-To: <Pine.SUN.3.91.980608155411.28579P-100000@terra> from "Ron G. Minnich" at Jun 8, 98 03:58:39 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > >   5606 telnet   CALL  socket(0x2,0x2,0)
> > UDP socket
> 
> OK, telnet is more of a mess than I thought. I just realized the same 
> thing. 
> 
> So what piece of code (telnet, libtelnet, libc, ...) is creating a dgram 
> socket and then trying to do a connect()? does that make any sense? I 
> don't have the whole source tree handy. anybody want to look? This looks 
> like part of dns client code from the trace. 

gethostbyname().

> > >   5606 telnet   CALL  recvfrom(0x3,0xefbfd884,0x400,0,0xefbfce10,0xefbfcd7c)
> > >   5606 telnet   RET   recvfrom -1 errno 61 Connection refused
> > ECONNREFUSED here simply means there's no socket bound at the destination
> > address/port. Probably you make a mistake in your code, you meant to use
> > SOCK_STREAM to create a TCP socket.
> 
> Again, this is not my code. But recvfrom is perfectly OK on a dgram
> socket. Why ECONNREFUSED? Is this holdover state from the previous sendto?
> Is the connect call on a dgram socket putting the socket into a strange 
> state? 

2 possibilities:

1)	Nameserver configuration error/default route error

2)	You are porting Linux code, like the SLP sample implementation,
	and you are not doing:

	sockaddr_in	sin;

	/*
	 * Linux people forget this because their stack pages are zeroed
	 * for "security" reasons.  If this is the first time on the
	 * stack, then stack variables will appear zero'ed as well.  It
	 * is _wrong_ to depend on this behaviour!
	 */
	memset( &sin, 0, sizeof(sin));	


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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