[En-Nut-Discussion] NutNetSaveConfig problem
Lorenzo Lombardo
lorenzo.lombardo at satbn.com
Tue Sep 19 11:46:19 CEST 2006
Hi,
I have always used the traditional method for setting up the nic of ethernut:
- check the rom with NutDhcpIfConfig("eth0", 0, 60000)
- if the config is not found then try the DHCP with NutDhcpIfConfig("eth0", mac, 60000)
- finally if this one fails too, then use the default config
So till now my board is set up by the dhcp on the net.
I have rearranged the code to read the config from the ROM at startup and if it's not found, it has to do nothing. Then using serial, I can send the command to set the parameters with the dhcp and that part it's ok, because the function save the config after it's called. The problem shows up when I try to set manually the parameters with this function:
int manualLanConfiguration(char *ip, char *mask, char *gateway)
{
u_char mac[6] = MY_MAC;
if(NutNetIfConfig("eth0", mac, inet_addr(ip), inet_addr(mask)) < 0)
{
errorHandler(901);
return -1;
}
NutIpRouteDelAll(&DEV_ETHER);
if(NutIpRouteAdd(0, 0, inet_addr(gateway), &DEV_ETHER) < 0)
{
errorHandler(902);
return -2;
}
NutNetSaveConfig();
return 1;
}
I print on screen (terminal) the values and they are changed correctly, but when I reboot, the application start up again, load the net config and it has the previous config I had obtained with the dhcp.
Anyone knows how to handle this problem?
Regards,
Lorenzo
More information about the En-Nut-Discussion
mailing list