summaryrefslogtreecommitdiff
path: root/bin/etc/sapp.toml
blob: c01acfecaba8ccbdbe2e10964210265a7c071e10 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
###################################################################################################
# NOTE:                                                                                           #
#    The format of this file is toml (https://github.com/cktan/tomlc99)                           #
#    to make vim editor display colorful and human readable,                                      #
#    you can create a symbolic links named sapp.ini to sapp.toml, ln -sf sapp.toml sapp.ini       #
###################################################################################################

[SYSTEM]
    instance_name = "sapp_v4.2"

[CPU]
    worker_threads=1
    send_only_threads_max=0
### note, bind_mask, if you do not want to bind thread to special CPU core, keep it empty as []
### there are two different grammars:
### toml array format: bind_mask=[1,2,3,4,5,11,12,13,14,15]
### MESA_load_profile range format: bind_mask="1-5,11-15"
    bind_mask=[]


[PACKET_IO]
    [overlay_tunnel_definition]
### note, optional value is [none, vxlan, nf]
    overlay_mode="none"

    [packet_io.feature]
### note, used to represent inbound or outbound direction value,
### because it comes from Third party device, so it needs to be specified manually,
### if inbound_route_dir=1, then outbound_route_dir=0, vice versa,
### in other words, outbound_route_dir = 1 ^ inbound_route_dir;
    inbound_route_dir=1

### note, BSD_packet_filter, if you do not want to set any filter rule, keep it empty as ""
    BSD_packet_filter=""

### note, same as tcpdump -Q/-P arg, possible values are `in', `out' and `inout', default is "in"
    pcap_capture_direction="in"

### note, support two mode: "inner_tuple2", "outer_tuple2"
    pcap_distmode="inner_tuple2"

### note, deployment.mode options: [sys_route, vxlan_by_inline_device, raw_ethernet_single_gateway, raw_ethernet_multi_gateway]
### sys_route: send ip(ipv6) packet by system route table, this is default mode in mirror mode;
### vxlan_by_inline_device: encapsulation inject packet with vxlan, and then send to inline device by udp socket.
### raw_ethernet_single_gateway: send layer2 ethernet packet to specific gateway in same broadcast domain. 
### raw_ethernet_multi_gateway: send layer2 ethernet packet to multiple gateway in same broadcast domain. 
    inject_pkt_mode="default"
    inject_pkt_prepend_segment_id=0
### note, this config is valid if inject_pkt_mode==vxlan_by_inline_device, means udp socket src port.
    #inject_mode_inline_device_sport=54789

### note, this config is valid if inject_pkt_mode==raw_ethernet_single_gateway.
    #inject_mode_single_gateway_device="eth1"
### inject_mode_single_gateway_src_mac has lower priority than get smac from inject_mode_single_gateway_device
    #inject_mode_single_gateway_src_mac="00:11:22:77:88:99"
    #inject_mode_single_gateway_dst_mac="00:11:22:33:44:55"

### note, for example, dst mac is 01:12:34:56:78:90, src src is 02:AA:BB:CC:DD:EE:FF, 
### ether[0] is 0x01, dst mac first octet, ether[1] is 0x12, dst mac second octet,
### ether[6] is 0x02, src mac first octet, ether[11] is 0xFF, src mac sixth octet.
### the bit field is from 0 to 7, the 0 is least significant bit, the 7 is most significant bit.
    ##extract_linkdir_from_mac_in_mirror_mode="ether[4]:0"  ## for Xj example
    #extract_linkdir_from_mac_in_mirror_mode=""
   
    #destroy_all_plug_enabled = 1
    #dlclose_all_plug_enabled = 1
    dumpfile_sleep_time_before_exit=0
    watchdog_enabled=1
    monitor_thread_enabled=1
### note, deployment.mode options: [mirror, inline, transparent]
    [packet_io.deployment]
    mode="inline"

### note, interface.type options: [pag, pcap, marsio, tun]
### receive from internal interface, route dir is 0,
### receive from external interface, route dir is 1.
    [packet_io.internal.interface]
    type="pcap"
    name="lo"

    [packet_io.external.interface]
    type="pcap"
    name="lo"
    
    [packet_io.polling]
    enabled=1    
### note, polling_priority = call sapp_recv_pkt every call polling_entry times,     
    polling_priority=100
    
    [packet_io.under_ddos]
### note, to reduce impact of ddos attack,set some stream bypass, all plugins will not process these streams   
    stream_bypass_enabled=0
### note, cpu usage value is percent, for example, config value is 85, means 85%, valid range: [1,100]    
### sapp change to bypass state immediately when realtime cpu usage > bypass_trigger_cpu_usage
    bypass_trigger_cpu_usage=95    
### note, unit of get_cpu_usage_interval is milliseconds(ms)     
    get_cpu_usage_interval=500
### note, use the average of the last $smooth_avg_window times as current realtime value 
    smooth_avg_window=0

    decrease_ratio="0.95"
    increase_ratio="1.005"
### note, unit of bypass_observe_time is second(s)     
    recovery_observe_time=3


[PROTOCOL_FEATURE]
    ipv6_decapsulation_enabled=1
    ipv6_send_packet_enabled=1
    tcp_drop_pure_ack_pkt=0
    tcp_syn_option_parse_enabled=1 
    skip_not_ip_layer_over_eth=0
    skip_gtp_S_PN_E_field_for_inject=0
    ipv4_reassembly_enabled=1
    ipv6_reassembly_enabled=1
    skip_gtp_layer=0

[DUPLICATE_PKT]
[dup_pkt.traffic.original]
    kickout_udp_stream_enabled=1
    original_ipv4_tcp_enabled=1
    original_ipv4_udp_enabled=1
### note, can't distinguish between duplicate traffic and application retransmit traffic for IPv6 packets,
### so not support IPv6 original duplicate traffic check.

[dup_pkt.traffic.inject]
    inject_all_enabled=1

[dup_pkt.parameters]
    #bloom_capacity=1000000
    #bloom_error_rate=0.000001
    #bloom_timeout=60
    #bloom_slice_num=3
    # 0:disable bloom filter, 1:dabloom, 2:apbloom
    #bloom_library=1
    #first_packets=3
    #bloom_partition_num=16
    #bloom_transition_time=3

[STREAM]
### note, stream_id_base_time format is "%Y-%m-%d %H:%M:%S" 
    stream_id_base_time="2021-01-01 00:00:00"
    [stream.tcp]
    max=10000
    timeout=120
    opening_timeout=60
    closing_timeout=3
    syn_mandatory=1
    reorder_pkt_max=32
    analyse_option_enabled=1
    tuple4_reuse_time_interval=30

    #fast_close_nouse=0
    reorder_on_closing=0
    #max_opening_per_sec=5000
    #max_timeouts_per_sec=5000

    meaningful_statistics_minimum_pkt=3
    meaningful_statistics_minimum_byte=5

        [stream.tcp.inject]
        link_mss=1460

        [stream.tcp.inject.rst]
        auto_remedy=1
        number=1
        signature_enabled=1
        signature_seed1=65535
        signature_seed2=13
        remedy_kill_tcp_by_inline_device=0

    [stream.udp]
    max=10000
    timeout=60
    meaningful_statistics_minimum_pkt=3
    meaningful_statistics_minimum_byte=5

    #max_opening_per_sec=5000
    #max_timeouts_per_sec=5000


[PROFILING]
    [profiling.log]
    sapp_log_category="sapp_log"
    sapp_plugin_log_category="sapp_plugin_log"
    
    [profiling.metric]
        [profiling.metric.fs2]
        enabled=0
        prometheus_port=9273
        prometheus_url_path="/metrics"
        local_file="fs2_sysinfo.metrics"
        refresh_interval_s=1
        app_name="sapp4"

        [profiling.metric.fs3]
        enabled=1
        prometheus_port=9373
        prometheus_url_path="/metrics"
        local_file="fs3_sysinfo.metrics"
        refresh_interval_s=1
        app_name="sapp4"
        
        [profiling.metric.fs4]
        enabled=1
        local_file="./metrics/fs4_sysinfo.json"
        refresh_interval_s=1
        app_name="sapp4"

    [profiling.process_latency]
    log_category="sapp_process_latency_log"
    histogram_enabled=0
    local_file="fs2_process_latency.metrics"
    refresh_interval_s=1
### note, threshold unit is microseconds (us), legal_scope [1,99999999], max value is 99
    threshold_us=1000
### define in time.h,use CLOCK_MONOTONIC_COARSE as default
### 0 means CLOCK_REALTIME, 1 means CLOCK_MONOTONIC, 2 means CLOCK_PROCESS_CPUTIME_ID, 3 means CLOCK_THREAD_CPUTIME_ID
### 4 means CLOCK_MONOTONIC_RAW, 5 means CLOCK_REALTIME_COARSE, 6 means CLOCK_MONOTONIC_COARSE
    clock_gettime_id=6
    [profiling.sanity_check]
    raw_pkt_broken_enabled=0
    symbol_conflict_enabled=0

    [profiling.memory]
    memory_used_stat_interval_s=10

[TOOLS]
    [tools.pkt_dump]
    enabled=0
### note, mode options value:[storage, udp_socket]
    mode="udp_socket"
    BSD_packet_filter=""
   
        [tools.pkt_dump.threads]
### note, if you want enable pkt dump in all thread, set dump_thread_all_enabled=1, then 'dump_thread_id' is obsoleted.
###       if dump_thread_all_enabled=0, then use dump_thread_id to specify separate specified thread index.
        all_threads_enabled=1
   
### note, dump_thread_id start from 0, max is CPU.worker_threads-1
        dump_thread_id=[0,1,2,3,4]
   
        [tools.pkt_dump.udp]
        command_port=12345
        pkt_dump_ratio=30

        [tools.pkt_dump.storage]
### note, file path must be double quotation mark extension, for example,  path="/dev/shm/pkt_dump"
        path="/dev/shm/pkt_dump"
### note, file size unit: MB
        file_size_max_per_thread=10000 

[BREAKPAD]
    disable_coredump=0
    enable_breakpad=0
    breakpad_minidump_dir="/tmp/crashreport"
    enable_breakpad_upload=0
    breakpad_upload_url="http://127.0.0.1/"
    breakpad_upload_tools="/opt/MESA/bin/minidump_upload"


### note:
### These configurations format is complex and difficult to describe with toml grammar,
### so, create a independent secondary config file to description specific information.

[SECONDARY_CONFIG_LINK]
    cfg_file_sapp_log="etc/sapp_log.conf"
    cfg_file_plug_list="plug/conflist.inf"
    cfg_file_project_list="etc/project_list.conf"
    cfg_file_entrylist="etc/entrylist.conf"
    cfg_file_send_raw_pkt="etc/send_raw_pkt.conf"
    cfg_file_vxlan_sport_map="etc/vxlan_sport_service_map.conf"
    cfg_file_inline_device="etc/gdev.conf"
    cfg_file_necessary_plug_list="etc/necessary_plug_list.conf"
    cfg_file_stream_compare_layer="etc/stream_compare_layer.conf"
    cfg_file_vlan_flipping="etc/vlan_flipping_map.conf"
    cfg_file_asymmetric_addr_layer="etc/asymmetric_addr_layer.conf"
    cfg_file_well_known_port="etc/well_known_port.conf"

[SECONDARY_DATA_LINK]
    data_file_sysinfo_log="sysinfo.log"
    data_file_inline_keepalive_log="gdev_keeplive_status.log"
    data_file_load_plugin_stat_log="load_plugin_stat.log"
    data_file_under_ddos_stat_log="under_ddos_stat.log"
    data_file_memory_stat_log="memory_used_stat.log"

[LIBRARY_LINK]
    marsio_library_path="/opt/mrzcpd/lib/libmarsio.so"