sch_blackhole.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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/init.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. struct sk_buff **to_free)
  20. {
  21. qdisc_drop(skb, sch, to_free);
  22. return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
  23. }
  24. static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
  25. {
  26. return NULL;
  27. }
  28. static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = {
  29. .id = "blackhole",
  30. .priv_size = 0,
  31. .enqueue = blackhole_enqueue,
  32. .dequeue = blackhole_dequeue,
  33. .peek = blackhole_dequeue,
  34. .owner = THIS_MODULE,
  35. };
  36. static int __init blackhole_init(void)
  37. {
  38. return register_qdisc(&blackhole_qdisc_ops);
  39. }
  40. device_initcall(blackhole_init)