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