In the related thread found that when attempted to use the NDK from simplelink_msp432e4_sdk_4_20_00_12 to send a UDP packet which was greater than the MSS that the sendto() function returned -1, rather than sending fragmented UDP packets.
The test was done with a modified udpEcho example in which the recvfrom() could receive a UDP packet which was larger than the MSS and had therefore been fragmented. The issue was that trying to use sendto() to echo the received UDP packet failed.
The issue appears to be the structure of the UdpOutput() function in simplelink_msp432e4_sdk_4_20_00_12\source\ti\ndk\stack\udp\udp.c:
/*-------------------------------------------------------------------- */ /* UdpOutput() */ /* Called when UDP packet should be sent */ /*-------------------------------------------------------------------- */ int UdpOutput( void *hSock, unsigned char *buf, int32_t size, int32_t *pRetSize ) { <snip> mss -= SockGetIpHdrSize(hSock) + UDPHDR_SIZE; /* Sub off IpHdr & UdpHdr */ if( size > mss ) { error = NDK_EMSGSIZE; goto UDP_EXIT; } <snip> /* Send the packet */ error=(int)IPTxPacket(pPkt,SockGetOptionFlags(hSock)&FLG_IPTX_SOSUPPORTED); UDP_EXIT: if( !error ) *pRetSize = size; else *pRetSize = 0; return( error ); }
The issue that UdpOutput() returns the error NDK_EMSGSIZE if the packet size is larger than the MSS, rather than attempting to send a fragmented packet. The IPTxPacket() function does appear to be able to send a fragmented UDP packet as has a /* Send out a bunch of fragmented packets */ loop.
If it a bug that sendto() can't send a fragmented UDP packet?
Note that the original thread is marked as resolved since the original poster changed their program to avoid sending UDP packets greater than the MSS to avoid the issue. I created this thread to query if it is a bug which should be fixed in the NDK.
I have attached the UDP echo programs used, one for TI-RTOS and one for FreeRTOS, both of which show the issue. The changes made to the examples were:
- Increase the UDPPACKETSIZE macro to allow to handle packets larger than the MSS.
- Increase the stack size for echoFxn task due to the increase in UDPPACKETSIZE
- Add a Display_printf() call to report an error from sendto()