Problem with TCP socket on RTEMS 4.8.1 (ARM BSP)

Joel Sherrill joel.sherrill at OARcorp.com
Fri Aug 29 03:47:14 UTC 2008


Alex Zolotov wrote:
> I have a simple rtems server-application, that is waiting for 
> connection with telnet client.
> It's working ok with RTEMS 4.7.99.1 <http://4.7.99.1>.
> But after compiling with 4.8.1 my application is not working correctly 
> anymore. It still can send/receive UDP packets and answer on pings 
> without problems. But external telnet-client can't establish 
> connection with this app.
>
> **********************************************************************************************
> There is source:
> (program hangs on accept(...) function)
>
> /* create TCP socket */
> s = socket( AF_INET, SOCK_STREAM, 0 );
> if( s < 0 ) ERROR;
>
> /* bind to the port */
> memset( &sa, 0, sizeof(sa) );
> sa.sin_family = AF_INET;
> sa.sin_port = htons( 23 );
> sa.sin_addr.s_addr = htonl( INADDR_ANY );
> if( bind( s, (struct sockaddr *)&sa, sizeof( sa ) ) < 0 ) ERROR;
>
> /* start listening */
> if( listen( s, 1 ) < 0 ) ERROR;
> struct sockaddr_in sa2;
> socklen_t addr_len;
> int s2;
> while( 1 )
> {
>     addr_len = sizeof( sa2 );
>     memset( &sa2, 0, addr_len );
>     s2 = accept( s, (struct sockaddr*)&sa2, &addr_len );
>     ....
>     ....
> }
>
> ...
>
> /*
>  * Network configuration
>  */
> extern void rtems_bsdnet_loopattach();
> static struct rtems_bsdnet_ifconfig loopback_config =
> {
>     "lo0",                      /* name */
>     (int (*)(struct rtems_bsdnet_ifconfig *, int))rtems_bsdnet_loopattach,
>     NULL,                       /* link to next interface */
>     "127.0.0.1 <http://127.0.0.1>",                /* IP address */
>     "255.0.0.0 <http://255.0.0.0>",                /* IP net mask */
> };
> static struct rtems_bsdnet_ifconfig eth0_config =
> {
>     RTEMS_BSP_NETWORK_DRIVER_NAME,      /* name */
>     RTEMS_BSP_NETWORK_DRIVER_ATTACH,    /* attach (ARM EMAC) */
>     &loopback_config,                   /* link to next interface */
>     MODULE_IP_ADDR0,                    /* IP address */
>     "255.255.255.0 <http://255.255.255.0>",                    /* IP 
> net mask */
>     ethernet_address0,                  /* Ethernet hardware address */
>     0, 0, 0, 0, 0, 0, 0, NULL
> };
> struct rtems_bsdnet_config rtems_bsdnet_config =
> {
>     &eth0_config,
>     NULL,
>     0,
>     256 * 1024,
>     256 * 1024,
>     NULL,
>     NULL,
>     NULL,
>     NULL,
>     {NULL},
>     {NULL}
> };
> **********************************************************************************************
>
> Debug messages in ethernet driver tells me, that rtems receiving all 
> packets correctly.
>
> After enabling rtems libnetworking debug messages (#define TCPDEBUG in 
> cpukit/libnetworking/opt_tcpdebug.h) i see following:
> ???????? drop 0 at 0, urp=0
> ???????? drop 0 at 0, urp=0
> ???????? drop 0 at 0, urp=0
> But, what is it mean? :)
>
It is late and I don't know the message offhand.  But it is
coming from netinet/tcp_debug.c so you can read the code
and see what you think.  There are only a few calls to tcp_trace
and if you have to put a print at all of the TA_DROP invocations
you might learn something.

My gut feeling is that the toolset got better between the two
points and maybe optimized away something that should really
be marked volatile.

The fact you are getting packets at all says mostly it is working.
Hopefully the pointer I gave will help you see what is not
getting set correctly in the incoming packet.
> Thanks for help.


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985





More information about the users mailing list