This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: AM437x socket structures question

Tool/software: TI-RTOS

Hi ,

I am currently using ndk_2_24_03_35 and have a question about a couple of structures defined in socketndk.h.

/* AF_INET family (IPv4) Socket address data structure. */

struct sockaddr_in {

UINT8 sin_family; /* address family */

UINT16 sin_port; /* port */

struct in_addr sin_addr;

INT8 sin_zero[8]; /* fixed length address value */

};

/* Generic Socket address storage data structure. */

struct sockaddr {

UINT8 sa_family; /* address family */

char sa_data[14]; /* socket data */

};

These structures seem to be overlayed and interchanged within the stack code.

My compiler pads out structure sockaddr_in to avoid having member sin_port on an odd boundary making a size of 16 bytes compare to the size of socaddr

which is 15 bytes?

Within function NDK_recvfrom()  if the sizeof socaddr (15 bytes) is passed in as parameter  int *plen then  the following check fails:-

/* Validate Sizes and Pointers */

if (pName && (!plen || (pName->sa_family == AF_INET && *plen < sizeof(SA_IN))  where SA_IN is struct sockaddr_in and *plen is the length of struct sockaddr.

Thanks in advance

Brian