This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Runtime network reinit
- From: "Goran Pantar" <gpantar at xylon dot hr>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Mon, 9 May 2005 12:11:15 +0200
- Subject: [ECOS] Runtime network reinit
Hi,
I have initialised the Network stack using fixed IP adresses. I would
now like the possibility to change the IP address at runtime. Is this
possible in eCos?
Parts of my network intialisation procedure:
..
s = socket(AF_INET, SOCK_DGRAM, 0);
..
ioctl(s, SIOCSIFHWADDR, &ifr);
close(s);
..
eth0_bootp_data.bp_op = BOOTREPLY;
eth0_bootp_data.bp_htype = HTYPE_ETHERNET;
eth0_bootp_data.bp_hlen = ETHER_ADDR_LEN;
for(i = 0; i < eth0_bootp_data.bp_hlen; i++)
{
eth0_bootp_data.bp_chaddr[i] = 0xFF;
}
eth0_bootp_data.bp_ciaddr.s_addr = *(in_addr_t *)NetHeader.addr_ip;
eth0_bootp_data.bp_yiaddr.s_addr = *(in_addr_t *)NetHeader.addr_ip;
eth0_bootp_data.bp_siaddr.s_addr = *(in_addr_t
*)NetHeader.addr_server;
eth0_bootp_data.bp_giaddr.s_addr = *(in_addr_t
*)NetHeader.addr_gateway;
..
init_net(eth0_name, ð0_bootp_data);
..
The obove procedure initializes the network sucessfully and all the
services are working. But when I run the same procedure (with changed IP
addresses) init_net fails with a diag print: SIOCIFADDR: File exist.
Thanks,
Goran Pantar
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss