[Ns-developers] Learning Bridge, NetDevice API changes
Gustavo Carneiro
gjcarneiro at gmail.com
Sat Jul 5 11:23:01 PDT 2008
2008/7/5 Mathieu Lacage <mathieu.lacage at sophia.inria.fr>:
> On Sat, 2008-07-05 at 13:13 +0100, Gustavo Carneiro wrote:
>
> > I would expect to be able to set the device promiscuous bit on
> > globally
> > as root on linux. i.e., "ifconfig ethx promisc" ? So, if we do
> > the same
> > thing, we probably should be fine.
> >
> > If we're going down linux road, at least we should add a packet type
> > parameter to make it easy for protocol handlers to ignore certain
> > packets:
> >
> > unsigned char pkt_type;
> >
> > Packet classification used in delivering it. The driver is
> > responsible for setting it to PACKET_HOST (this packet is for
> > me), PACKET_BROADCAST, PACKET_MULTICAST, or PACKET_OTHERHOST
> > (no, this packet is not for me). Ethernet drivers don't modify
> > pkt_type explicitly because eth_type_trans does it for them.
> >
> > (from http://www.xml.com/ldd/chapter/book/ch14.html)
>
> What is the use-case for that ? I don't have anything against this idea
> but, I really don't see what problem this feature will solve.
I don't know, but I guess it makes it simple and efficient to decide what to
do with a packet. For example I see linux kernel uses it in ip_forward:
[...]
if (skb <http://lxr.linux.no/linux/+code=skb>->pkt_type
<http://lxr.linux.no/linux/+code=pkt_type> != PACKET_HOST
<http://lxr.linux.no/linux/+code=PACKET_HOST>)
<http://lxr.linux.no/linux/net/ipv4/ip_forward.c#L68> goto drop
<http://lxr.linux.no/linux/+code=drop>;
http://lxr.linux.no/linux/net/ipv4/ip_forward.c#L67
Of course, personally I would prefer completely separate flow paths for
packets received promiscuously and normal packets. But if you insist in
mixing it all together and don't provide a way to distinguish (IPv4 does not
count, not all world is IP based), someone will be requesting another API
change in a couple of months. If not sooner.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
More information about the Ns-developers
mailing list