Somehow my lwip user forum subscription/setting/options was not
functioning properly, and I may have sent out this request multiple
times since I tried to figure out what was wrong. My apologies if it was
the case...
Hi there,
The following test was based on lwip 1.41 port on TI's TiVaware
With #define LWIP_DHCP 1 & #define LWIP_AUTOIP 1 in lwipopts.h, I have
no problem using DHCP
lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
With #define LWIP_DHCP 0 & #define LWIP_AUTOIP 0 in lwipopts.h, I also
have no problem using static IP
lwIPInit(g_ui32SysClock, pui8MACArray, inet_addr("55.0.168.192"),
inet_addr("0.255.255.255"), inet_addr("1.0.168.192"), IPADDR_USE_STATIC);
//The IP address was in a reversed order, but it works
But if I wish to have both DHCP and Static IP feature, switching between
them based on user configuration, I couldn't make it work without
modifying lwiplib.c, ie. if I make
lwipopts.h:
#define LWIP_DHCP 1
#define LWIP_AUTOIP 1
....
if (USER_NEEDS_DHCP){
lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
//This works
}
else{
lwIPInit(g_ui32SysClock, pui8MACArray, inet_addr("55.0.168.192"),
inet_addr("0.255.255.255"), inet_addr("1.0.168.192"), IPADDR_USE_STATIC);
}
Static IP will not work
I am sure I can modify lwiplib.c based on LWIP_DHCP and LWIP_AUTOIP
conditions to make it work, but is there a better way to get the job done?
Thanks!
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users