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
7 include/linux/fib_rules.h | 4 ++++
8 include/linux/rtnetlink.h | 1 +
10 3 files changed, 9 insertions(+)
12 diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
13 index 51da65b..3420838 100644
14 --- a/include/linux/fib_rules.h
15 +++ b/include/linux/fib_rules.h
16 @@ -64,6 +64,10 @@ enum {
17 FR_ACT_BLACKHOLE, /* Drop without notification */
18 FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
19 FR_ACT_PROHIBIT, /* Drop with EACCES */
23 + FR_ACT_FAILED_POLICY, /* Drop with EPERM */
27 diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
28 index 93370bd..cfec9ff 100644
29 --- a/include/linux/rtnetlink.h
30 +++ b/include/linux/rtnetlink.h
31 @@ -203,6 +203,7 @@ enum {
32 RTN_THROW, /* Not in this table */
33 RTN_NAT, /* Translate this address */
34 RTN_XRESOLVE, /* Use external resolver */
35 + RTN_FAILED_POLICY, /* Source address failed policy */
39 diff --git a/ip/rtm_map.c b/ip/rtm_map.c
40 index 21e818b..8ad2d07 100644
43 @@ -49,6 +49,8 @@ char *rtnl_rtntype_n2a(int id, char *buf, int len)
47 + case RTN_FAILED_POLICY:
48 + return "failed_policy";
50 snprintf(buf, len, "%d", id);
52 @@ -84,6 +86,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
54 else if (strcmp(arg, "throw") == 0)
56 + else if (strcmp(arg, "failed_policy") == 0)
57 + res = RTN_FAILED_POLICY;
59 res = strtoul(arg, &end, 0);
60 if (!end || end == arg || *end || res > 255)