tcp_send error!

Mark_Andrews at isc.org Mark_Andrews at isc.org
Wed Jan 30 21:19:09 UTC 2002


> 
> At 10:46 2002-01-26 +1100, you wrote:
> 
> Why does the named have to bind on the 0.0.0.0 address?
> When doest it have to do a query_source?
> 
> I would apreciate any explainations!
> Thanks in advance!
> 
> Here this part of the code:
> src =3D server_options->query_source;
> src.sin_port =3D htons(0);
> if (bind(sp->s_rfd, (struct sockaddr *)&src, sizeof(src)) < 0)
> ns_info(ns_log_default, "tcp_send: bind(query_source):
> %s",
> strerror(errno));
> 
	It's just explictly doing what the OS would do.

	If you want just skip the bind() call when no address is set add 
	"src.sin_addr.s_addr != htonl(0) &&" to the "if (bind(...) < 0)".
	
	e.g.

	if (src.sin_addr.s_addr != htonl(0) &&
	    bind(sp->s_rfd, (struct sockaddr *)&src, sizeof(src)) < 0)
 		ns_info(ns_log_default, "tcp_send: bind(query_source): %s",
                        strerror(errno));

	Mark

> > >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > This is only a guess but are you running (starting) named as a
> > > non-root user and have a query-source port < 1024? If so, that's your
> > > problem. Only root can bind to ports < 1024.
> >
> >         The error would be "permission denied" in that case.  The user
> >         named is running at should not be a issue as the port is set
> >         to zero when binding for TCP letting system select the port.
> >
> >         My suggestion would be to start it under a debugger (using -f)
> >         and set a break point on the ns_info line after the bind call in
> >         tcp_send and examine 'src' and 'options->query_source'.
> >
> >         Mark
> > >
> > > Take out the query-source port option, or start named as root and let
> > > it switch UID itself using the -u command-line option.
> > >
> > >
> > > Michael Kj=F6rling
> > >
> > >
> > > On Jan 25 2002 11:17 -0500, =C9ric Allard wrote:
> > >
> > > >
> > > > Hi!
> > > >
> > > > I use bind 8.2.5 on solaris 2.5.1 and I get constantly this error:
> > > >
> > > > Jan 25 10:49:27 empress named[29134]: tcp_send: bind(query_source):=20
> > Invali
> > > d
> > > > argument
> > > >
> > > > What doest it means! Is anyone can give me a solution to resolve it?
> > > >
> > > > I will apreciate any hints!
> > > >
> > > > Thanks!
> > >
> > > - --
> > > Michael Kj=F6rling  --  Programmer/Network administrator  ^..^
> > > Internet: michael at kjorling.com -- FidoNet: 2:204/254.4   \/
> > > PGP: 95f1 074d 336d f8f0 f297 6a5b 2aa3 7bfd 8a70 e33e
> > >
> > > ``And indeed people sometimes speak of man's "bestial" cruelty, but
> > > this is very unfair and insulting to the beasts: a beast can never be
> > > so cruel as a man, so ingeniously, so artistically cruel.''
> > > (Ivan Karamazov, in Dostoyevsky's 'The Brothers Karamazov')
> > >
> > > *** Thinking about sending me spam? Take a close look at
> > > *** http://michael.kjorling.com/spam/ before doing so.
> > > -----BEGIN PGP SIGNATURE-----
> > > Version: GnuPG v1.0.6 (GNU/Linux)
> > > Comment: Public key is at http://michael.kjorling.com/contact/pgp.html
> > >
> > > iD8DBQE8UYaoKqN7/Ypw4z4RAsItAKDJP8NW1qMskGqnwfgKtgPxApY4VACdE7bg
> > > wKSOmEDAR+hj0dPiTPSOdkE=3D
> > > =3D/StV
> > > -----END PGP SIGNATURE-----
> > >
> > >
> > >
> >--
> >Mark Andrews, Internet Software Consortium
> >1 Seymour St., Dundas Valley, NSW 2117, Australia
> >PHONE: +61 2 9871 4742                 INTERNET: Mark.Andrews at isc.org
> 
> 
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark.Andrews at isc.org


More information about the bind-users mailing list