On my system, I used static IP address using this:
// Set up the MAC address
netif.hwaddr_len = 6;
netif.hwaddr[0] = ethaddr->addr[0];
netif.hwaddr[1] = ethaddr->addr[1];
netif.hwaddr[2] = ethaddr->addr[2];
netif.hwaddr[3] = ethaddr->addr[3];
netif.hwaddr[4] = ethaddr->addr[4];
netif.hwaddr[5] = ethaddr->addr[5];
status = netif_add(&netif, ipaddr,
netmask, gw, NULL, eth_device_init, tcpip_input);
if (status==NULL) {
//
Could not add the iface
return;
}
netif_set_default(&netif);
netif_set_up(&netif);
From:
address@hidden
[mailto:address@hidden On Behalf Of Julian
Gardner [RSD]
Sent: Tuesday, February 05, 2008 09:20
To: Mailing list for lwIP users; Mailing list for lwIP users
Subject: RE: [lwip-users] dhcp works but i cant get static ip to work
Yes its
initialised from e2prom! i will just check to see that i have the ip/mn/gw the
right way around!!
-----Original Message-----
From: address@hidden on behalf of Grubb, Jared
Sent: Tue 05/02/2008 17:15
To: Mailing list for lwIP users
Subject: RE: [lwip-users] dhcp works but i cant get static ip to work
In the second half of the code (the else{} part) it looks like you're
setting the IP address but did you initialize it? Maybe that was done
earlier?
Jared
From: address@hidden
[mailto:address@hidden]
On Behalf Of
Julian Gardner [RSD]
Sent: Tuesday, February 05, 2008 07:06
To: address@hidden
Subject: [lwip-users] dhcp works but i cant get static ip to work
This is my code which i cant seem to get working on a static ip address,
if i set the dhcp to on it works fine?
looked in scribbiwiki and it looks right to me
netif_add( &smcif_if,
&ipaddr, &netmask, &gw, NULL, smcIfinit,
tcpip_input);
netif_set_default( &smcif_if);
if(
e2Prom.ethernetSettings.dhcpActive )
{
// Seems i need to do this to get DHCP to work
IP4_ADDR( &smcif_if.ip_addr, 0,
0, 0, 0);
IP4_ADDR(
&smcif_if.gw,
0, 0, 0,
0);
IP4_ADDR( &smcif_if.netmask, 255, 255, 255, 255);
dhcp_start( &smcif_if);
}
else
{
netif_set_addr( &smcif_if, &ipaddr, &netmask, &gw);
netif_set_up( &smcif_if);
}
Any ideas?
joolz