Robert Olsson wrote:
Ben Greear writes:
> It requires a hook in dev.c, or at least that is the only way I can
> think to implement it.
Well the hook be placed along the packet path even in drivers. In tulip I didn't
even take packet of the ring in some experiments.
And there plenty of existing hooks already i.e PRE_ROUTE?
For my particular application the hook needs to be right
after the bridge hook. My dev.c hook looks like this:
#if defined(CONFIG_NET_PKTGEN) || defined(CONFIG_NET_PKTGEN_MODULE)
#include "pktgen.h"
#warning "Compiling dev.c for pktgen.";
int (*handle_pktgen_hook)(struct sk_buff *skb) = NULL;
EXPORT_SYMBOL(handle_pktgen_hook);
static __inline__ int handle_pktgen_rcv(struct sk_buff* skb) {
if (handle_pktgen_hook) {
return handle_pktgen_hook(skb);
}
return -1;
}
#endif
.....
#if defined(CONFIG_NET_PKTGEN) || defined(CONFIG_NET_PKTGEN_MODULE)
if ((skb->dev->pkt_dev) &&
(handle_pktgen_rcv(skb) >= 0)) {
/* Pktgen may consume the packet, no need to send
* to further protocols.
*/
goto out;
}
#endif
If the rx-hook logic is already in pktgen module, and it's symbol
exported, perhaps a second hook module could be written that
would just be the bridge between a driver or a PRE-ROUTE hook
and pktgen? The hook module would probably not be much larger
than the code above...
Thanks,
Ben
--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc http://www.candelatech.com
-
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