900-drop_FAILED_POLICY.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 4e7dbf76227e8c7be7897dc81def3011f637864d Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Thu, 30 May 2013 11:54:04 +0200
  4. Subject: [PATCH] add support for dropping with FAILED_POLICY
  5. ---
  6. include/linux/fib_rules.h | 4 ++++
  7. include/linux/rtnetlink.h | 1 +
  8. ip/rtm_map.c | 4 ++++
  9. 3 files changed, 9 insertions(+)
  10. --- a/include/linux/fib_rules.h
  11. +++ b/include/linux/fib_rules.h
  12. @@ -64,6 +64,10 @@ enum {
  13. FR_ACT_BLACKHOLE, /* Drop without notification */
  14. FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
  15. FR_ACT_PROHIBIT, /* Drop with EACCES */
  16. + FR_ACT_RES8,
  17. + FR_ACT_RES9,
  18. + FR_ACT_RES10,
  19. + FR_ACT_FAILED_POLICY, /* Drop with EPERM */
  20. __FR_ACT_MAX,
  21. };
  22. --- a/include/linux/rtnetlink.h
  23. +++ b/include/linux/rtnetlink.h
  24. @@ -210,6 +210,7 @@ enum {
  25. RTN_THROW, /* Not in this table */
  26. RTN_NAT, /* Translate this address */
  27. RTN_XRESOLVE, /* Use external resolver */
  28. + RTN_FAILED_POLICY, /* Source address failed policy */
  29. __RTN_MAX
  30. };
  31. --- a/ip/rtm_map.c
  32. +++ b/ip/rtm_map.c
  33. @@ -49,6 +49,8 @@ char *rtnl_rtntype_n2a(int id, char *buf
  34. return "nat";
  35. case RTN_XRESOLVE:
  36. return "xresolve";
  37. + case RTN_FAILED_POLICY:
  38. + return "failed_policy";
  39. default:
  40. snprintf(buf, len, "%d", id);
  41. return buf;
  42. @@ -84,6 +86,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
  43. res = RTN_UNICAST;
  44. else if (strcmp(arg, "throw") == 0)
  45. res = RTN_THROW;
  46. + else if (strcmp(arg, "failed_policy") == 0)
  47. + res = RTN_FAILED_POLICY;
  48. else {
  49. res = strtoul(arg, &end, 0);
  50. if (!end || end == arg || *end || res > 255)