sch_blackhole.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. {
  20. qdisc_drop(skb, sch);
  21. return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
  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_init(void)
  36. {
  37. return register_qdisc(&blackhole_qdisc_ops);
  38. }
  39. device_initcall(blackhole_init)