ff2e0aa1ee73f8ac2b844b5d384ea4889203729d
[openwrt/openwrt.git] / package / network / utils / iproute2 / patches / 900-drop_FAILED_POLICY.patch
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 ---
7 include/linux/fib_rules.h | 4 ++++
8 include/linux/rtnetlink.h | 1 +
9 ip/rtm_map.c | 4 ++++
10 3 files changed, 9 insertions(+)
11
12 --- a/include/linux/fib_rules.h
13 +++ b/include/linux/fib_rules.h
14 @@ -64,6 +64,10 @@ enum {
15 FR_ACT_BLACKHOLE, /* Drop without notification */
16 FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
17 FR_ACT_PROHIBIT, /* Drop with EACCES */
18 + FR_ACT_RES8,
19 + FR_ACT_RES9,
20 + FR_ACT_RES10,
21 + FR_ACT_FAILED_POLICY, /* Drop with EPERM */
22 __FR_ACT_MAX,
23 };
24
25 --- a/include/linux/rtnetlink.h
26 +++ b/include/linux/rtnetlink.h
27 @@ -210,6 +210,7 @@ enum {
28 RTN_THROW, /* Not in this table */
29 RTN_NAT, /* Translate this address */
30 RTN_XRESOLVE, /* Use external resolver */
31 + RTN_FAILED_POLICY, /* Source address failed policy */
32 __RTN_MAX
33 };
34
35 --- a/ip/rtm_map.c
36 +++ b/ip/rtm_map.c
37 @@ -49,6 +49,8 @@ char *rtnl_rtntype_n2a(int id, char *buf
38 return "nat";
39 case RTN_XRESOLVE:
40 return "xresolve";
41 + case RTN_FAILED_POLICY:
42 + return "failed_policy";
43 default:
44 snprintf(buf, len, "%d", id);
45 return buf;
46 @@ -84,6 +86,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
47 res = RTN_UNICAST;
48 else if (strcmp(arg, "throw") == 0)
49 res = RTN_THROW;
50 + else if (strcmp(arg, "failed_policy") == 0)
51 + res = RTN_FAILED_POLICY;
52 else {
53 res = strtoul(arg, &end, 0);
54 if (!end || end == arg || *end || res > 255)