nf_nat_proto_unknown.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* The "unknown" protocol. This is what is used for protocols we
  2. * don't understand. It's returned by ip_ct_find_proto().
  3. */
  4. /* (C) 1999-2001 Paul `Rusty' Russell
  5. * (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/types.h>
  12. #include <linux/init.h>
  13. #include <linux/netfilter.h>
  14. #include <net/netfilter/nf_nat.h>
  15. #include <net/netfilter/nf_nat_rule.h>
  16. #include <net/netfilter/nf_nat_protocol.h>
  17. static int unknown_in_range(const struct nf_conntrack_tuple *tuple,
  18. enum nf_nat_manip_type manip_type,
  19. const union nf_conntrack_man_proto *min,
  20. const union nf_conntrack_man_proto *max)
  21. {
  22. return 1;
  23. }
  24. static int unknown_unique_tuple(struct nf_conntrack_tuple *tuple,
  25. const struct nf_nat_range *range,
  26. enum nf_nat_manip_type maniptype,
  27. const struct nf_conn *ct)
  28. {
  29. /* Sorry: we can't help you; if it's not unique, we can't frob
  30. anything. */
  31. return 0;
  32. }
  33. static int
  34. unknown_manip_pkt(struct sk_buff **pskb,
  35. unsigned int iphdroff,
  36. const struct nf_conntrack_tuple *tuple,
  37. enum nf_nat_manip_type maniptype)
  38. {
  39. return 1;
  40. }
  41. struct nf_nat_protocol nf_nat_unknown_protocol = {
  42. .name = "unknown",
  43. /* .me isn't set: getting a ref to this cannot fail. */
  44. .manip_pkt = unknown_manip_pkt,
  45. .in_range = unknown_in_range,
  46. .unique_tuple = unknown_unique_tuple,
  47. };