Subject: Re: Cardbus
To: None <>
From: Ken Hornstein <>
List: tech-kern
Date: 12/23/1999 12:29:19
>> You could always look at the if_detach branch we already have and finish
>> it up...
>I was hoping that someone who understands the networking code would
>do that... :)

Sigh, well, I've been feeling very self-concious about this whole thread,
and I feel I must give some explanation.

Just some history:

Bill Studenmund did the if_detach() code originally.  He passed it off
to me.

I took it and banged on it for a while.  It was fairly hairy stuff, but
I did get it to the point where it would detach a card I was using (but
it was iffy; if you were using the card, it would panic some of the time.
And routes never quite got deleted).

I had a death in my family, and I lost a whole lot of momentum.  My
work on NetBSD stalled.  To give you some idea, my laptop was still
running the same version of -current as it was originally when I
started ..  which I think was 1.3I, which was from the Orlando IETF.  I
finally upgraded it in haste for the most recent IETF in November.

Let me say that no one has been screaming at my door, "WHERE IS IF_DETCH(),
YOU ASSHOLE?!?!?".  The guilt I've been feeling is all self-generated :-).
I'm just trying to give some background as to where things were.

Okay, so now that it's obvious that I dropped the ball, where do we
go from here?  Some people have offered to take over the code at
various points in the past.  So far none of their work has materialized.
I'm guessing they found it daunting or didn't have time.

The only person I do know that has tried tackling it recently is
Bill Sommerfeld.  His comments about it are in the mailing list
archives, but to paraphrase him (and correct me if I'm wrong, Bill),
they were basically, "I tried using it, it was really dusty, obviously
not maintained, and after looking at it closer, I'm not sure it was
the right thing".

Bill had some suggestions on what he wanted to do; I thought they were
reasonable, but not everyone agreed.

I think everyone agrees we need some form of interface detachment.
Here are my thoughts:

counting was very problematic.  It caused a whole lot of weird
side effect problems (for example, if you ping'd your own IP address,
you'd get an arp entry for yourself in your arp cache).  Looking
at other implementations, they don't do any reference counting;
they either mark the interface in a special "dead" state (what FreeBSD
did the last time I looked at it), or delete all of the routes from
the route table and then delete the interface from the interface
list (OpenBSD).

I looked at the OpenBSD code, and it was fairly straightforward.  You
call ether_detach() to detach the interface from the ether subsystem,
and then you call if_detach() to remove the host routes, flush the
interface queue, and finally delete the interface from the list.  This
_seems_ like the right approach to me .... but I'd be interested in
discussing it in greater detail.