On Mon, 2005-25-07 at 13:54 -0700, David S. Miller wrote:
> From: Thomas Graf <[EMAIL PROTECTED]>
> Date: Mon, 25 Jul 2005 22:16:21 +0200
> 
> > * David S. Miller <[EMAIL PROTECTED]> 2005-07-25 13:14
> > > We removed INPUT_DEV from the meta ematch last week remember?
> > 
> > Sure, but we can readd it once its clear how it will be used.
> > What I meant is that the meta ematch doesn't care as it will
> > provide access by name and by ifindex anyway.
> 

Most of the qdisc level code use ifindex and do byname checks first from
user space to grab the ifindex.

> I see.
> 
> I was also just thinking about the semantic change that will
> result if rules are specified by device name, and we start
> doing match comparisons using ifindex.  I don't think we can
> legally do things that way.
> 

the name comparison is useful in general if you want to do many devices
per regexp (example eth* or ppp[0-11] etc). Its harder to do so since
ifindex ranges cant be guaranteed to be contigous. 
 
> If a device goes down, and comes back up with the same name
> but a different ifindex, we should still match it with existing
> rules based upon name.  

The ifindex will change if you unload a module; 
If you try hard enough you will hit a point where things will wrap
around; you just have to consume the 2^31 ifindices ;->

Name is not totaly sane either:
I think one of the fscked s/ware i have seen is pppd that tries
to recycle names immediately with the same name but different ifindex.
It should probably use ppp<ifindex> for name.
In theory, one should be able from user space to really configure the
ifindex; we dont allow for it even for devices that are virtual.

> So we'd end up with stuff like:
> 
>       dev = dev_get_by_index(ifindex);
>       match = 0;
>       if (!strcmp(p->name, dev->name))
>               match = 1;
>       dev_put(dev);
> 
> at which point we might as well just grab a device reference in
> skb->input_dev since that's simpler and a lot cheaper and easier to
> verify.


BTW, I just glanced at your suggested patch. If we are not going to use
ifindex we aint saving the 4 bytes on 64 bit machines. And we have to
keep refcounts and release devices.

cheers,
jamal


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to