I have the following code copied from elsewhere to get the client port from a server socket connection. On a 64bit Linux intel arch this compiles with out issues,
struct sockaddr *sa;
struct sockaddr_in *sin;
unsigned short sin_port;
sa = conn->local_sockaddr;
sin = (struct sockaddr_in *) sa;
sin_port = ntohs(sin->sin_port);
In Arm its complaining that 'error: cast increases required alignment of target type' which seems reasonable.
I don't think I can ignore this. Is there some way to tell GCC to fix the alignment so I can read the port?