Restart network interface

Hello,
how I can restart network interface, when I try reconfigure this interface? I’m using RCM3700 and when I call setIP(), which reconfire ETH0:
err = ifconfig(IF_ETH0,
IFS_IPADDR, aton(set.ip_unit),
IFS_NETMASK, aton(set.nm_unit),
IFS_ROUTER_SET,aton(set.gw_unit),
IFS_UP,
IFS_END);

err is zero and IP is still old :frowning:

Don’t know if it is happening to you, but I had to manually disable the DHCP configuration in order to switch.

Should be able to do so with:

ifconfig( IF_ETH0, IFS_DHCP, 0, IFS_END );

However, I am using the RCM4000 and the calls may be different. Also, I don’t see you using IFS_DOWN at the beginning. You may not be able to bring it up before it goes down.

koutasek,

Are you calling sock_init() in setIP() at all? If so, you must call ifconfig() AFTER sock_init()!

Also, you need to add IFS_DOWN to the ifconfig() call so that the interface is stopped before you try to change the IP.

Try this:

//Call this before ifconfig()!
sock_init();

//Do not forget the IFS_DOWN
err = ifconfig(IF_ETH0,
IFS_DOWN,
IFS_IPADDR, aton(set.ip_unit),
IFS_NETMASK, aton(set.nm_unit),
IFS_ROUTER_SET,aton(set.gw_unit),
IFS_UP,
IFS_END);

Hope that helps…

hi…
I use this in my programs for Rabbit 3000 :

TCPCONFIG 6
.
.
.
unsigned long ip_address;
unsigned long netmask;
unsigned long gateway;

ip_addres=0xC0A80023l;
netmask=0xffffff00l;
gateway=0xC0A80001l;

.
.
.

ifconfig(IF_ETH0,IFS_DHCP,0,IFS_END);
ifconfig(IF_ETH0,IFS_IPADDR,ip_address,IFS_END);
ifconfig(IF_ETH0,IFS_NETMASK,netmask,IFS_END);
ifconfig(IF_ETH0,IFS_ROUTER_SET,gateway,IFS_END);
ifconfig(IF_ETH0,IFS_UP,IFS_END);

while (ifpending(IF_ETH0)&1)
{
tcp_tick(NULL);
}

i hope this code help you