From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26211 invoked by alias); 11 May 2005 20:23:49 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 25609 invoked from network); 11 May 2005 20:23:41 -0000 Received: from unknown (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org with SMTP; 11 May 2005 20:23:41 -0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1DVxjy-000792-00; Wed, 11 May 2005 22:23:34 +0200 Date: Wed, 11 May 2005 20:42:00 -0000 To: Goran Pantar Cc: ecos-discuss@ecos.sourceware.org Message-ID: <20050511202334.GT31731@lunn.ch> Mail-Followup-To: Goran Pantar , ecos-discuss@ecos.sourceware.org References: <9D79B9A9194389468A922F618415D0A4020435@abc.xylon.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9D79B9A9194389468A922F618415D0A4020435@abc.xylon.local> User-Agent: Mutt/1.5.9i From: Andrew Lunn Subject: Re: [ECOS] Runtime network reinit X-SW-Source: 2005-05/txt/msg00169.txt.bz2 On Mon, May 09, 2005 at 12:11:15PM +0200, Goran Pantar wrote: > 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. You probably need to make a couple of ioctl calls to remove the current addressing information before you can call init_net again. Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss