Hi Mohamed,
I'm wondering if there's duplicate entries for the IP address. Can you try calling the CfgGetEntryCnt() API to see what it returns?
int numberOfInstances = CfgGetEntryCnt(0, CFGTAG_IPNET, 1);
What's the value for numberOfInstances?
You might also try configuring the 'network IP address hook' into your application. This hook is called whenever an IP address (IPv4) is added or removed from the system. The IP that's passed to this hook function is the actual IP address that the system will have bound.
To do this, you can add the following line of code to your app's *.cfg file:
Global.networkIPAddrHook = '&mynetworkIPAddrHook';
And the following function to your app's C file:
void mynetworkIPAddrHook(IPN IPAddr, uint IfIdx, uint fAdd)
{
IPN IPTmp;
System_printf("mynetworkIPAddrHook: enter\n");
IPTmp = ntohl(IPAddr);
System_printf("mynetworkIPAddrHook:\tIf-%d:%d.%d.%d.%d\n", IfIdx,
(UINT8)(IPTmp>>24)&0xFF, (UINT8)(IPTmp>>16)&0xFF,
(UINT8)(IPTmp>>8)&0xFF, (UINT8)IPTmp&0xFF);
System_flush();
}
What IP do you see being printed?
You can also add a break point into this hook function to inspect what's going on, too.
Steve