使用TCPREPAIR替换FORGESOCKET版本,数据可以联通,代码待整理
This commit is contained in:
18
bin/kni/kni.inf
Normal file
18
bin/kni/kni.inf
Normal file
@@ -0,0 +1,18 @@
|
||||
[PLUGINFO]
|
||||
PLUGNAME=KNI
|
||||
SO_PATH=./plug/business/kni/kni.so
|
||||
INIT_FUNC=kni_init
|
||||
DESTROY_FUNC=
|
||||
|
||||
[IP]
|
||||
FUNC_FLAG=all
|
||||
FUNC_NAME=kni_ip_entry
|
||||
|
||||
|
||||
#[TCP_ALL]
|
||||
#FUNC_FLAG=all
|
||||
#FUNC_NAME=kni_tcpall_entry
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
bin/kni/kni.so
Normal file
BIN
bin/kni/kni.so
Normal file
Binary file not shown.
30
bin/kni_set_cmd
Normal file
30
bin/kni_set_cmd
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# cd /home/liuyang/src/forge_socket-master/;insmod forge_socket.ko
|
||||
|
||||
#ip tuntap add dev tun0 mode tun
|
||||
#ifconfig tun0 up
|
||||
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
#route add default dev tun0
|
||||
|
||||
iptables -t mangle -N DIVERT
|
||||
iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
|
||||
iptables -t mangle -A DIVERT -j MARK --set-mark 1
|
||||
iptables -t mangle -A DIVERT -j ACCEPT
|
||||
|
||||
ip rule add fwmark 1 lookup 100
|
||||
#ip route add local 0.0.0.0/0 dev tun0 table 100
|
||||
ip route add local 0.0.0.0/0 dev lo table 100
|
||||
|
||||
#iptables -t mangle -A PREROUTING -p tcp -i tun0 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 50080
|
||||
|
||||
|
||||
ethtool -K p7p1 lro off
|
||||
ethtool -K p7p1 tso off
|
||||
ethtool -K p7p1 gro off
|
||||
|
||||
ethtool -K em2 lro off
|
||||
ethtool -K em2 tso off
|
||||
ethtool -K em2 gro off
|
||||
|
||||
9
bin/kniconf/kni.conf
Normal file
9
bin/kniconf/kni.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
[MOUDLE]
|
||||
table_info_path=./kniconf/maat_table_info.conf
|
||||
ful_cfg_dir=/home/liuyang/run/sapp_run/config/index
|
||||
inc_cfg_dir=/home/liuyang/run/sapp_run/config/inc/index
|
||||
logger_filepath=./log/kni.log
|
||||
logger_level=10
|
||||
|
||||
maat_json_switch=1
|
||||
|
||||
5
bin/kniconf/maat_table_info.conf
Normal file
5
bin/kniconf/maat_table_info.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
1 MATT_CONFIG_COMPILE compile GBK GBK no 0
|
||||
#2 MATT_CONFIG_GROUP group GBK GBK no 0
|
||||
3 IP_BMD ip GBK GBK no 0
|
||||
4 USER_AREA ip GBK GBK no 0
|
||||
5 SNI_BMD expr GBK GBK yes 0
|
||||
67
bin/kniconf/maat_test.json
Normal file
67
bin/kniconf/maat_test.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"compile_table": "MATT_CONFIG_COMPILE",
|
||||
"group_table": "MATT_CONFIG_GROUP",
|
||||
"rules": [
|
||||
{
|
||||
"compile_id": 1,
|
||||
"service": 1,
|
||||
"action": 2,
|
||||
"do_blacklist": 1,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "anything",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "group_1",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "IP_BMD",
|
||||
"table_type": "ip",
|
||||
"table_content": {
|
||||
"addr_type": "ipv4",
|
||||
"src_ip": "192.168.11.199",
|
||||
"mask_src_ip": "255.255.255.255",
|
||||
"src_port": "0",
|
||||
"mask_src_port": "65535",
|
||||
"dst_ip": "0.0.0.0",
|
||||
"mask_dst_ip": "255.255.255.255",
|
||||
"dst_port": "0",
|
||||
"mask_dst_port": "65535",
|
||||
"protocol": 0,
|
||||
"direction": "double"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 2,
|
||||
"service": 48,
|
||||
"action": 2,
|
||||
"do_blacklist": 1,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "anything",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "group_2",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SNI_BMD",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "www.baidu.com",
|
||||
"expr_type": "regex",
|
||||
"match_method": "sub",
|
||||
"format":"uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
3
bin/kniconf/maat_test.json_iris_tmp/.local
Normal file
3
bin/kniconf/maat_test.json_iris_tmp/.local
Normal file
@@ -0,0 +1,3 @@
|
||||
0000000002
|
||||
0 1 1
|
||||
1 2 1
|
||||
2
bin/kniconf/maat_test.json_iris_tmp/IP_BMD.local
Normal file
2
bin/kniconf/maat_test.json_iris_tmp/IP_BMD.local
Normal file
@@ -0,0 +1,2 @@
|
||||
0000000001
|
||||
0 0 4 192.168.11.199 255.255.255.255 0 65535 0.0.0.0 255.255.255.255 0 65535 0 0 1
|
||||
@@ -0,0 +1,3 @@
|
||||
0000000002
|
||||
1 1 2 1 1 0 anything 1
|
||||
2 48 2 1 1 0 anything 1
|
||||
2
bin/kniconf/maat_test.json_iris_tmp/SNI_BMD.local
Normal file
2
bin/kniconf/maat_test.json_iris_tmp/SNI_BMD.local
Normal file
@@ -0,0 +1,2 @@
|
||||
0000000001
|
||||
1 1 www.baidu.com 2 0 0 1
|
||||
@@ -0,0 +1,4 @@
|
||||
MATT_CONFIG_COMPILE 2 ./kniconf/maat_test.json_iris_tmp/MATT_CONFIG_COMPILE.local
|
||||
2 ./kniconf/maat_test.json_iris_tmp/.local
|
||||
IP_BMD 1 ./kniconf/maat_test.json_iris_tmp/IP_BMD.local
|
||||
SNI_BMD 1 ./kniconf/maat_test.json_iris_tmp/SNI_BMD.local
|
||||
Reference in New Issue
Block a user