sch_blackhole.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 __read_mostly = {
  28. .id = "blackhole",
  29. .priv_size = 0,
  30. .enqueue = blackhole_enqueue,
  31. .dequeue = blackhole_dequeue,
  32. .peek = 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");