This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: How to deconfigure an interface?
- From: Tarmo Kuuse <tarmo dot kuuse at mail dot ee>
- To: ecos-discuss at sources dot redhat dot com
- Date: Tue, 01 Sep 2009 11:59:10 +0300
- Subject: [ECOS] Re: How to deconfigure an interface?
- References: <4A9C0111.70300@gmail.com>
Hi Stanislav,
Stanislav Meduna wrote:
I'd like to be able to change an IP address of an interface
without reboot.
Same here.
The same happens if I try to set the address using SIOCSIFADDR.
Is this the intended behaviour? Shouldn't the SIFADDR
change the address and AIFADDR add a new one?
I think it's intended behaviour.
Is there a way to bring the IP stack back to the clean
state, or does one needs to deconfigure the interface
step-by step by removing addresses already configured
using SIOCDIFADDR (which works)?
There could be a better way, but I just do SIOCGIFADDR to read the
current addresses from an interface and delete them with SIOCDIFADDR. As
input, the "struct ifreq" needs the interface's textual name (e.g.
"eth0"). Works fine.
Another task which needs doing is clearing the routes table. There
exists a function "cyg_route_reinit()" which simply flushes all routes.
Unfortunately it also deletes routes for the local loopback and all
other interfaces you may have. I haven't yet figured out how to delete
the routes only for a given interface.
Have a look at function do_dhcp_down_net() in dhcp_prot.c for an example.
--
Kind regards,
Tarmo Kuuse
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss