Subject: Re: IP Firewalling and IP Filetering
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 06/09/1996 20:27:41
> You need to change ip_fil.c around the area where it accesses if_unit
> and if_name[] to use if_xname[] for if_name[] and a kludge for
> if_unit. if_index is NOT the unit ID! [...]
> Now, on the philosophical side there are two sides of a coin here:
> A: Why does the core seem to do gratuitous changes like this that fly
> in the face of industry practice?
Without knowing what's behind it, I'd hesitate to call it "gratuitous".
Those changes were mostly on May 6 by thorpej, and the commit comment
says
| Changed struct ifnet to have a pointer to the softc of the underlying
| device and a printable "external name" (name + unit number), thus eliminating
| if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
| to take a struct ifnet *, rather than a unit number.
This doesn't say anything about _why_ this was done. The last sentence
hints that there were interface that took unit numbers when they really
shouldn't, but that alone does not strike me as reason to go as far as
eliminating if_unit altogether.
> B: You shouldn't rely on internal layout for opaque data structures
> like ifnet!
ifnet is hardly an opaque structure when you're in the kernel.
> [...compatability...] In this case, a sure way to get the unit ID
> without having to guess/devine it from if_xname[] array.
Why do you want a unit number? I can't see why you should care about
the difference between, say, "le0" and "rk0" versus "le0" and "le1";
le0 and le1 are just as much different interfaces as le0 and rk0, and
there's no call to treat the two cases any differently. (rk0 is
hypothetical; AFAIK there is no rk.)
der Mouse
mouse@collatz.mcrcim.mcgill.edu