sch_blackhole.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * net/sched/sch_blackhole.c Black hole queue
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. *
  9. * Authors: Thomas Graf <tgraf@suug.ch>
  10. *
  11. * Note: Quantum tunneling is not supported.
  12. */
  13. #include <linux/module.h>
  14. #include <linux/types.h>
  15. #include <linux/kernel.h>
  16. #include <linux/netdevice.h>
  17. #include <linux/skbuff.h>
  18. #include <net/pkt_sched.h>
  19. static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
  20. {
  21. qdisc_drop(skb, sch);
  22. return NET_XMIT_SUCCESS;
  23. }
  24. static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
  25. {
  26. return NULL;
  27. }
  28. static struct Qdisc_ops blackhole_qdisc_ops = {
  29. .id = "blackhole",
  30. .priv_size = 0,
  31. .enqueue = blackhole_enqueue,
  32. .dequeue = blackhole_dequeue,
  33. .owner = THIS_MODULE,
  34. };
  35. static int __init blackhole_module_init(void)
  36. {
  37. return register_qdisc(&blackhole_qdisc_ops);
  38. }
  39. static void __exit blackhole_module_exit(void)
  40. {
  41. unregister_qdisc(&blackhole_qdisc_ops);
  42. }
  43. module_init(blackhole_module_init)
  44. module_exit(blackhole_module_exit)
  45. MODULE_LICENSE("GPL");