httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <di...@webweaving.org>
Subject Re: bind-connect in rfc1413.c
Date Thu, 02 Sep 1999 16:37:08 GMT


On Thu, 2 Sep 1999, Ryan Bloom wrote:

> Okay, I must be missing something.  I am trying to put some of the APR
> stuff into Apache 2.0, and I came across a case I wasn't prepared for when
> I wrote APR.

> bind (sock, &our_query_sin, sizeof(struct sockaddr_in));
> connect(sock, &rmt_query_sin, sizeof(struct sockaddr_in));
 
> In all of the TCP/IP network programming I have done, bind is done on the
> server side, and connect is done on the client side.  In fact, most of my
> books say the bind is really unnecessary.

If I recall correctly, the gist of this is: that this way a TCP client can
control its IP source address that will be used for anything going out of
this socket. And this in turn is nessesary to accomodate for restriction
'3' in the rfc:

   Queries are permitted only for fully specified connections.  The
   query contains the local/foreign port pair -- the local/foreign
   address pair used to fully specify the connection is taken from the
   local and foreign address of query connection.  This means a user on
   address A may only query the server on address B about connections
   between A and B.

See ftp://ftp.ripe.net/rfc/rfc1413.txt or any other source for the full
story. The bit about bind() controlling the IP source address in a socket
is described as a note in Stevens and on the BSD man pages.

Dw.
















St. Johns                                                       [Page 8]



Mime
View raw message