Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Misaligned Multicast Message

Honored Contributor II

I get a misaliged memory trap in the network stack and am posting here to see if anyone has seen a similar problem. 


I have a complex MicroC/OS-II multi-task application that uses multicast messages occasionally to report status. The application responds to a finger message with a multicast response. 


The application is up for hours and processes hundreds if not thousands of these messages. Then with no correlation to other network activity I can discern I get a multicast message that gets a misaligned memory failure deep in the network stack. The call trace at the memory trap is below. 


Send_Mcast is my routine responding to the finger. The rest of the routines are from the iniche libraries. Send_Mcast calls send which via a macro becomes t_sendto. Many layers down I get a NIOS2_READ_EXCEPTION with cause 6 which is NIOS2_EXCEPTION_MISALIGNED_DATA_ADDR. 




Send_Mcast::::::: if (sendto(sock, (void *)pB, size, 0, (struct sockaddr *)&destAddr, sizeof(destAddr)) < 0) { 


t_sendto::::::::::: err = sosend(so, name, buf, &sendlen, flags); 

sosend::::::::::::: error = (*so->so_proto->pr_usrreq)(so, head, nam); 

udp_usrreq::::::::: return udp4_socksend(so, m, nam ); 

udp4_socksend:::: e = udp_send(fport, udpconn->u_lport, pkt); 

udp_send::::::::::: e = ip_write(UDP_PROT, p); 

ip_write::::::::::::: return (ip_write_internal(p)); 

ip_write_internal::: inm = lookup_mcast(p->fhost, p->net); 

lookup_mcast::::::: if(imp->inm_addr == addr) { /// this traps.
0 Kudos
1 Reply
Honored Contributor II

Further investigation shows that sending multicast messages in the face of network traffic gets a failure. I created code that sends a multicast message once a second. This code gets the illegal memory trap described here after 10 to 20 attempts.

0 Kudos