Dropping skb's

Memon, Mazhar I (mimemon@sandia.gov)
Mon, 1 Jul 2002 08:49:31 -0600


dealloc an skb; causing the packet to never be sent (or received):

skb_unlink(skb);
dev_kfree_skb(skb);

Instead, when trying to drop outbound skb's, they get sent anyway. I've
already checked that skb->users drops to zero and should be deallocated when
dev_kfree_skb is called. I've also tried directly calling the
skb->destructor function and manually (and atomically) decrementing
skb->users.

Refer to the packet_handler below:

Regards,
Mazhar

static struct packet_type all_type;
static int pkt_handler(struct sk_buff *skb, struct net_device *dv, struct
packet_type *pt) {
switch(skb->pkt_type) {
case PACKET_OUTGOING:
printk("outgoing\n");

skb_unlink(skb);
dev_kfree_skb(skb);

goto destroy;
break;
default:
printk("incoming\n");
break;
}

pass:
dev_kfree_skb(skb);
destroy:
return 0;
}
...
int init_module(void)
{
all_type.type = htons(ETH_P_ALL);
all_type.func = pkt_handler;

dev_add_pack(&all_type);
return 0;
}

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