This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inconsistency between the Open BSD IP stack and the tests in version 2.0


On Tue, Aug 17, 2004 at 05:24:12PM +0100, Paul Riley wrote:
> Unless I'm missing something there is an inconsistency between the Open
> BSD stack and the io/fileio socket.c test.
>  
> It transpires that upon a call to bind then inside the function
> in_pcbbind the port entry in the sockaddr_in structure is set to zero,
> with the syntax
>  
>    sin->sin_port = 0;  /* yech... */
> 
> Why? 
>  
> In addition this breaks the socket test as the subsequent connect is now
> connecting to a port which is zero and this barfs. Now it's easy to fix
> the test so that the port is set after the call to bind, however that
> feels wrong. Does anyone know why this is zero'd out?

This is probably a userspace/kernel space problem. The origional stack
would have made a copy of the sockaddr_in when moving over the kernel
boundary. Any modifications made to the address in the kernel would
not be reflectred in userspace unless the kernel explicitely copied it
back again.

But eCos does not have this userspace/kernel space boundary. The
FreeBSD stack has had a similar problem which i remember adding a
patch for. The same patch is probably needed here as well.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]