sch_blackhole.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/skbuff.h>
  17. #include <net/pkt_sched.h>
  18. static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
  19. {
  20. qdisc_drop(skb, sch);
  21. return NET_XMIT_SUCCESS;
  22. }
  23. static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
  24. {
  25. return NULL;
  26. }
  27. static struct Qdisc_ops blackhole_qdisc_ops = {
  28. .id = "blackhole",
  29. .priv_size = 0,
  30. .enqueue = blackhole_enqueue,
  31. .dequeue = blackhole_dequeue,
  32. .owner = THIS_MODULE,
  33. };
  34. static int __init blackhole_module_init(void)
  35. {
  36. return register_qdisc(&blackhole_qdisc_ops);
  37. }
  38. static void __exit blackhole_module_exit(void)
  39. {
  40. unregister_qdisc(&blackhole_qdisc_ops);
  41. }
  42. module_init(blackhole_module_init)
  43. module_exit(blackhole_module_exit)
  44. MODULE_LICENSE("GPL");