Bug 38533

Summary: 'ifconfig ifname down delete' does not deletes aliases
Product: Base System Reporter: Eugene Grosbein <ports>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.6-PRERELEASE   
Hardware: Any   
OS: Any   

Description Eugene Grosbein 2002-05-25 08:20:01 UTC
	I have an interface with primary and aliased addresses
	and try to clear them all and take interface down.
	So I type
	
		ifconfig fxp0 down delete

	And I see that primary address (with correct netmask) is removed
	but alias (with netmask 255.255.255.255) is still here.

Fix: 

Unknown for me.
How-To-Repeat: 
	See above.
Comment 1 ru freebsd_committer freebsd_triage 2002-05-25 11:58:32 UTC
On Sat, May 25, 2002 at 03:10:18PM +0800, Eugene Grosbein wrote:
> 
> I have an interface with primary and aliased addresses
> and try to clear them all and take interface down.
> So I type
> 
> 	ifconfig fxp0 down delete
> 
> And I see that primary address (with correct netmask) is removed
> but alias (with netmask 255.255.255.255) is still here.
> 

It would be very sad if it did.

`delete' is just another alias for `-alias'.  It deletes the address
specified, or the first address (in this family) if no address was
specified, of the interface.

This PR can be closed.


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 2 Eugene Grosbein 2002-05-25 16:28:09 UTC
Ruslan Ermilov wrote:
> 
> On Sat, May 25, 2002 at 03:10:18PM +0800, Eugene Grosbein wrote:
> >
> > I have an interface with primary and aliased addresses
> > and try to clear them all and take interface down.
> > So I type
> >
> >       ifconfig fxp0 down delete
> >
> > And I see that primary address (with correct netmask) is removed
> > but alias (with netmask 255.255.255.255) is still here.
> >
> It would be very sad if it did.
> 
> `delete' is just another alias for `-alias'.  It deletes the address
> specified, or the first address (in this family) if no address was
> specified, of the interface.
> 
> This PR can be closed.

Then it should preserve original netmask, I guess.

Well, if 'ifconfig down delete' doesn't deletes all interfaces' IP,
if there an easy way to perform this task?
If not, I think this command is good candidate.

Eugene Grosbein
Comment 3 ru freebsd_committer freebsd_triage 2002-05-25 16:40:56 UTC
On Sat, May 25, 2002 at 11:28:09PM +0800, Eugene Grosbein wrote:
> Ruslan Ermilov wrote:
> > 
> > On Sat, May 25, 2002 at 03:10:18PM +0800, Eugene Grosbein wrote:
> > >
> > > I have an interface with primary and aliased addresses
> > > and try to clear them all and take interface down.
> > > So I type
> > >
> > >       ifconfig fxp0 down delete
> > >
> > > And I see that primary address (with correct netmask) is removed
> > > but alias (with netmask 255.255.255.255) is still here.
> > >
> > It would be very sad if it did.
> > 
> > `delete' is just another alias for `-alias'.  It deletes the address
> > specified, or the first address (in this family) if no address was
> > specified, of the interface.
> > 
> > This PR can be closed.
> 
> Then it should preserve original netmask, I guess.
> 
Umm, preserve the original netmask of _what_?

> Well, if 'ifconfig down delete' doesn't deletes all interfaces' IP,
> if there an easy way to perform this task?
> If not, I think this command is good candidate.
> 
ifconfig rl0 inet | tail +2 | xargs -n1 ifconfig rl0 delete


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 4 Eugene Grosbein 2002-05-25 16:50:18 UTC
Ruslan Ermilov wrote:

> > > > I have an interface with primary and aliased addresses
> > > > and try to clear them all and take interface down.
> > > > So I type
> > > >
> > > >       ifconfig fxp0 down delete
> > > >
> > > > And I see that primary address (with correct netmask) is removed
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > but alias (with netmask 255.255.255.255) is still here.
> > > >
> > > It would be very sad if it did.
> > >
> > > `delete' is just another alias for `-alias'.  It deletes the address
> > > specified, or the first address (in this family) if no address was
> > > specified, of the interface.
> > >
> > > This PR can be closed.
> >
> > Then it should preserve original netmask, I guess.
> >
> Umm, preserve the original netmask of _what_?

Of primary IP being removed.

> > Well, if 'ifconfig down delete' doesn't deletes all interfaces' IP,
> > if there an easy way to perform this task?
> > If not, I think this command is good candidate.
> >
> ifconfig rl0 inet | tail +2 | xargs -n1 ifconfig rl0 delete

Thanks. I'd like to have some more intuitive for non-script work :-)

Eugene
Comment 5 ru freebsd_committer freebsd_triage 2002-05-25 17:04:05 UTC
On Sat, May 25, 2002 at 11:50:18PM +0800, Eugene Grosbein wrote:
> Ruslan Ermilov wrote:
> 
> > > > > I have an interface with primary and aliased addresses
> > > > > and try to clear them all and take interface down.
> > > > > So I type
> > > > >
> > > > >       ifconfig fxp0 down delete
> > > > >
> > > > > And I see that primary address (with correct netmask) is removed
>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > > but alias (with netmask 255.255.255.255) is still here.
> > > > >
> > > > It would be very sad if it did.
> > > >
> > > > `delete' is just another alias for `-alias'.  It deletes the address
> > > > specified, or the first address (in this family) if no address was
> > > > specified, of the interface.
> > > >
> > > > This PR can be closed.
> > >
> > > Then it should preserve original netmask, I guess.
> > >
> > Umm, preserve the original netmask of _what_?
> 
> Of primary IP being removed.
> 

I don't quite follow, sorry.  Suppose you have two IP addresses
from different networks bound to an interface.  If you delete
one address, it just gets deleted.  Nothing else should be
done.

> > > Well, if 'ifconfig down delete' doesn't deletes all interfaces' IP,
> > > if there an easy way to perform this task?
> > > If not, I think this command is good candidate.
> > >
> > ifconfig rl0 inet | tail +2 | xargs -n1 ifconfig rl0 delete
> 
> Thanks. I'd like to have some more intuitive for non-script work :-)
> 

There is no ioctl(2) to delete all addresses.


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 6 Eugene Grosbein 2002-05-25 17:12:11 UTC
Ruslan Ermilov wrote:

> I don't quite follow, sorry.  Suppose you have two IP addresses
> from different networks bound to an interface.  If you delete
> one address, it just gets deleted.  Nothing else should be
> done.

Right. But suppose you have two IP addresses from the same network
(second with netmask 255.255.255.255). 
If you remove primary one (with correct netmask), you end up
with last IP address and netmask 255.255.255.255 that's seem to be wrong.
I guess right netmask should be preserved.

Eugene
Comment 7 ru freebsd_committer freebsd_triage 2002-05-25 17:41:29 UTC
On Sun, May 26, 2002 at 12:12:11AM +0800, Eugene Grosbein wrote:
> Ruslan Ermilov wrote:
> 
> > I don't quite follow, sorry.  Suppose you have two IP addresses
> > from different networks bound to an interface.  If you delete
> > one address, it just gets deleted.  Nothing else should be
> > done.
> 
> Right. But suppose you have two IP addresses from the same network
> (second with netmask 255.255.255.255). 
> If you remove primary one (with correct netmask), you end up
> with last IP address and netmask 255.255.255.255 that's seem to be wrong.
> I guess right netmask should be preserved.
> 

If you have x.y.z.1/24 and x.y.z.2/32,

	ifconfig if0 x.y.z.2/32 delete
	ifconfig if0 x.y.z.2

will do it for you.  Anyway, we're diverging from the PR's topic.
"delete" works as expected, it just deletes the primary address
of an interface (if no specific address is supplied).


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 8 ru freebsd_committer freebsd_triage 2002-05-25 17:41:59 UTC
State Changed
From-To: open->closed

It shouldn't.