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.

Starterware lwIP-Port: why is IP address byte order changed?

Genius 5820 points

Hi,

the lwIP-port that comes with Starterware contains following statement in lwiplib.c / lwIPInit() - a piece of code TI is responsible for:

if(lwipIf->ipMode == IPADDR_USE_STATIC)
{
   ip_addr.addr = htonl(lwipIf->ipAddr);
   net_mask.addr = htonl(lwipIf->netMask);
   gw_addr.addr = htonl(lwipIf->gwAddr);
}

This leads to the strange situation that all IP's that are parsed with

ipaddr_aton(c, &myIP);

need an additional conversion with

myIP.addr=ntohl(myIP.addr)

This is done only to change back the byteorder later on initialisation.

So...what is the diea behind this? Why is it done this way?