From owner-freebsd-hackers Thu Apr 19 15:11:28 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mx2.zembu.com (nat.zembu.com [209.128.96.253]) by hub.freebsd.org (Postfix) with ESMTP id 69E4437B43C for ; Thu, 19 Apr 2001 15:11:22 -0700 (PDT) (envelope-from wrstuden@zembu.com) Received: from mx-router.z.zembu.com (mx-router.z.zembu.com [172.16.0.104]) by mx2.zembu.com (Postfix) with ESMTP id 1B921AB001; Thu, 19 Apr 2001 15:11:22 -0700 (PDT) Received: from candlekeep.home-net.internetconnect.net (209-128-96-246.bayarea.net [209.128.96.246]) by mx-router.z.zembu.com (Postfix) with ESMTP id C249743D01; Thu, 19 Apr 2001 15:11:21 -0700 (PDT) Received: by candlekeep.home-net.internetconnect.net (Postfix, from userid 100) id 072C11B9D2; Thu, 19 Apr 2001 14:08:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by candlekeep.home-net.internetconnect.net (Postfix) with ESMTP id 058451A28C; Thu, 19 Apr 2001 14:08:54 -0700 (PDT) Date: Thu, 19 Apr 2001 14:08:54 -0700 (PDT) From: Bill Studenmund X-Sender: wrstuden@candlekeep.home-net.internetconnect.net To: Shankar Agarwal Cc: tech-kern@netbsd.org, bsd hackers Subject: Re: Question regarding ifconfig. In-Reply-To: <3ADE3FDB.E082BC69@net.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 18 Apr 2001, Shankar Agarwal wrote: > Hi All, First off, you have sent mail to two different *BSD groups. While we have a common history and share features back and forth over time, you really should limit this message to the group from which you are using code. > I have a doubt about the ifconfig file. when i am trying to configure or > change ip address on the interface. The main calls setifaddr function > which calls ioctl function with command as SIOCGIFADDR by the following > lines > ifr->ifr_addr.sa_family = afp->af_af; > if (ioctl(s, afp->af_gifaddr, afp->af_ridreq) == 0) > clearaddr = 1; > Now i don't understand why the ioctl is called by SIOCGIFADDR when i am > configuring an ip address on the interface. Moreover i believe that when That's because that ioctl is not adding the new address, it is looking to see if there is an existing one. > ioctl returns successfully it returns 0 so the clearaddr will be set and > later on the ip address will be deleted. Any existing IP address will be deleted. If there already is an address, you need to get rid of it before you can add/set the new one. > Please help me out if i am interpreting it wrong as i am not able to > assign an ip address to the interface in my ported code. At least in the NetBSD version, I think the action is in the code block right after the if (clearaddr) { }. That next block is the one which will set the address. Take care, Bill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message