Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2002 11:43:15 +0800
From:      Leslie Jackson <int@softhome.net>
To:        freebsd-hackers@freebsd.org
Subject:   ioctl & SIOCDIFADDR
Message-ID:  <20020916114315.7feb4bac.int@softhome.net>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020916114315.7feb4bac.int>