From owner-freebsd-hackers Sun Sep 15 20:43:54 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34C8437B400 for ; Sun, 15 Sep 2002 20:43:53 -0700 (PDT) Received: from jive.SoftHome.net (jive.SoftHome.net [66.54.152.27]) by mx1.FreeBSD.org (Postfix) with SMTP id AF57743E42 for ; Sun, 15 Sep 2002 20:43:52 -0700 (PDT) (envelope-from int@softhome.net) Received: (qmail 5852 invoked by uid 417); 16 Sep 2002 03:43:22 -0000 Received: from shunt-smtp-out-0 (HELO softhome.net) (172.16.3.12) by shunt-smtp-out-0 with SMTP; 16 Sep 2002 03:43:22 -0000 Received: from int.homeunix.org ([218.58.82.222]) (AUTH: LOGIN int@softhome.net) by softhome.net with esmtp; Sun, 15 Sep 2002 21:43:20 -0600 Date: Mon, 16 Sep 2002 11:43:15 +0800 From: Leslie Jackson To: freebsd-hackers@freebsd.org Subject: ioctl & SIOCDIFADDR Message-Id: <20020916114315.7feb4bac.int@softhome.net> X-Mailer: Sylpheed version 0.7.6 (GTK+ 1.2.10; i386-portbld-freebsd4.6) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I just want to use ioctl() to change IP address of a spcified interface. By using ktrace(and kdump), i've found that 'ifconfig' command first uses SIOCDIFADDR to delete an IP and then uses SIOCAIFADDR to make a aliase (this way a new IP is assigned). And from the man page of netintro: ------------------------------------------------------------------------------- SIOCDIFADDR: [sniped] and also adopts the convention that specification of the default address means to delete the first address for the interface belonging to the address family in which the original socket was opened. ------------------------------------------------------------------------------- I can specify an specific IP, say, "192.168.0.2", for SIOCDIFADDR to delete. But how can i specify this "default address"(said in the netintor(4)) to "delete the first address of the interface"? Thanks in advance. -- Leslie Jackson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message