Re: net_bh limitation

From: Krzysztof Halasa (khc@intrepid.pm.waw.pl)
Date: Fri Jun 16 2000 - 18:07:10 EST


kuznet@ms2.inr.ac.ru writes:

> > of type ETH_P_ALL such that I intercept all packets.
>
> ptype is protocol multiplexor, rather than filter.

Sure. However, I think it should be possible for protocol handler to
modify the skb and tell net_rx_action() to reexamine it. That would make
stripping link-level headers easy. Currently we have to:
- call netif_rx to requeue skb (ie. in syncppp.c - this is bad), or
- requeue it in (link-level) protocol handler (unneded complication), or
- add IPv4/IPv6/IPX/whatever protocol dispatcher and call {ip,ipv6...}_rcv
  routines from link-level proto handler (very bad, breaks code separation).

It would be, in my opinion, best for net_rx_action() to:

        /* this calls all net taps - no pt_prev required */
        for (ptype = ptype_all; ptype; ptype = ptype->next) {
                if (!ptype->dev || ptype->dev == skb->dev) {
                        atomic_inc(&skb->users);
                        ptype->func(skb, ...); /* ignore return value */
                        /* func() is not allowed to alter skb */
                        }
                }

/* Bridging code? */
        
        /* this finds proto handler and passes skb to it, eventually
           restarting when the handler asks */

restart:
        type = skb->protocol;
        for (ptype=ptype_base[ntohs(type)&15]; ptype; ptype=ptype->next) {
                if (ptype->type == type &&
                    (!ptype->dev || ptype->dev == skb->dev)) {
                        atomic_inc(&skb->users);
                        switch (ptype->func(skb, ...)) {
                        case RCV_RESTART
                                goto restart;

                        case RCV_ACCEPTED; /* skb altered/destroyed */
                                goto end;

                        default: /* skb unaltered, try next handler */
                        }
                }
end:
        skb_free() if required;

Do we need to try another handler if previous one accepted the packet?

deliver_to_old_ones() should be dropped/fixed asap as well.

What do you think?

-- 
Krzysztof Halasa
Network Administrator

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:13 EST