-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_shaper_proxy-arp.patch
More file actions
81 lines (73 loc) · 2.65 KB
/
fix_shaper_proxy-arp.patch
File metadata and controls
81 lines (73 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
--- limiter.c_orig 2018-08-30 15:54:13.373216582 +0300
+++ limiter.c 2018-08-30 15:58:25.773303016 +0300
@@ -13,6 +13,7 @@
#include <linux/pkt_sched.h>
#include <linux/tc_act/tc_mirred.h>
#include <linux/tc_act/tc_skbedit.h>
+#include <linux/tc_act/tc_gact.h>
#include "log.h"
#include "ppp.h"
@@ -326,6 +327,10 @@
.ifindex = conf_ifb_ifindex,
};
+ struct tc_gact p3 = {
+ .action = TC_ACT_OK,
+ };
+
if (tc_qdisc_modify(rth, conf_ifb_ifindex, RTM_NEWTCLASS, NLM_F_EXCL|NLM_F_CREATE, &opt1))
return -1;
@@ -342,7 +347,7 @@
req.t.tcm_handle = 1;
req.t.tcm_parent = 0xffff0000;
- req.t.tcm_info = TC_H_MAKE(100 << 16, ntohs(ETH_P_IP));
+ req.t.tcm_info = TC_H_MAKE(100 << 16, ntohs(ETH_P_ALL));
addattr_l(&req.n, sizeof(req), TCA_KIND, "u32", 4);
@@ -386,6 +391,50 @@
addattr32(&req.n, TCA_BUF_MAX, TCA_U32_CLASSID, 1);
addattr_l(&req.n, MAX_MSG, TCA_U32_SEL, &sel, sizeof(sel));
+ tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail;
+
+ if (rtnl_talk(rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0)
+ return -1;
+
+ //Pass ARP
+ memset(&req, 0, sizeof(req));
+
+ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
+ req.n.nlmsg_flags = NLM_F_REQUEST|NLM_F_EXCL|NLM_F_CREATE;
+ req.n.nlmsg_type = RTM_NEWTFILTER;
+ req.t.tcm_family = AF_UNSPEC;
+ req.t.tcm_ifindex = ifindex;
+ req.t.tcm_handle = 1;
+ req.t.tcm_parent = 0xffff0000;
+
+ req.t.tcm_info = TC_H_MAKE(90 << 16, ntohs(ETH_P_ARP));
+
+
+ addattr_l(&req.n, sizeof(req), TCA_KIND, "u32", 4);
+
+ tail = NLMSG_TAIL(&req.n);
+ addattr_l(&req.n, MAX_MSG, TCA_OPTIONS, NULL, 0);
+
+ tail1 = NLMSG_TAIL(&req.n);
+ addattr_l(&req.n, MAX_MSG, TCA_U32_ACT, NULL, 0);
+
+ // action pass
+ tail2 = NLMSG_TAIL(&req.n);
+ addattr_l(&req.n, MAX_MSG, 1, NULL, 0);
+ addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, "gact", 5);
+
+ tail3 = NLMSG_TAIL(&req.n);
+ addattr_l(&req.n, MAX_MSG, TCA_ACT_OPTIONS, NULL, 0);
+ addattr_l(&req.n, MAX_MSG, TCA_GACT_PARMS, &p3, sizeof(p3));
+ tail3->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail3;
+
+ tail2->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail2;
+
+ tail1->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail1;
+ //
+
+ addattr32(&req.n, TCA_BUF_MAX, TCA_U32_CLASSID, 1);
+ addattr_l(&req.n, MAX_MSG, TCA_U32_SEL, &sel, sizeof(sel));
tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail;
if (rtnl_talk(rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0)