Hello
I am using TIRTOS 2_12_01_33 with NDK 2_24_02_31 and wish to be able to change the static IP of my Ethernet port on the fly.
I have been able to set the static IP on start up by
bzero(&NetAddr, sizeof(NetAddr));
NetAddr.IPAddr = htonl(IpLocalConfig.IPaddress);
NetAddr.IPMask = htonl(IpLocalConfig.IPnetmask);
strcpy(NetAddr.Domain, (char *)IpLocalConfig.domain);
NetAddr.NetType = 0;
// Add the new static IP entry CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NetAddr, 0);
However when I try to change the static IP using
hCfg = 0; binding = BindGetFirst(); if (binding) { // get the current static IP entry CfgGetEntry(hCfg, CFGTAG_IPNET, 1, 1, &hCfgIpAddr); if (hCfgIpAddr) { if (SystemStatus.DiagState & DIAG_ETHERNET) LogDiagMessage("ETH Change IP Address"); // Remove the current static IP entry CfgRemoveEntry(hCfg, hCfgIpAddr); // Add the new static IP entry CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NetAddr, 0); }
}
I find this works sometimes and not others.
Also I have a PPP session up at the same time and I don't know if this is correctly taking that into account?
How do I correctly determine the existing static route config and replace with a new one?
Thanks in advance for any assistance.