forked from appneta/tcpreplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
566 lines (500 loc) · 24.1 KB
/
Makefile.am
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# $Id$
MAKEFLAGS=-s -k
PRINTF = @PRINTF@
HOST = @host@
TARGET = @target@
BUILD = @build@
nic1 = @nic1@
nic2 = @nic2@
ENABLE_DEBUG = @debug_run_time_flag@
TCPPREP=../src/tcpprep --no-arg-comment
TCPREPLAY=../src/tcpreplay
TCPREWRITE=../src/tcprewrite
TCPBRIDGE=../src/tcpbridge
EXTRA_DIST = test.pcap test.auto_bridge test.auto_client test.auto_router \
test.auto_server test.auto_first test.cidr test.comment test.port test.mac \
test.cidr_reverse test.mac_reverse test.regex_reverse \
test.prep_config test.primary test.regex test.secondary \
test.rewrite_seed test.rewrite_portmap test.rewrite_endpoint \
test.rewrite_pnat test.rewrite_pad test.rewrite_trunc \
test.rewrite_mac test.rewrite_layer2 test.rewrite_config \
test.rewrite_skip test.rewrite_dltuser test.rewrite_dlthdlc \
test.rewrite_vlandel test.rewrite_efcs test.rewrite_1ttl \
test.rewrite_2ttl test.rewrite_3ttl \
test2.rewrite_seed test2.rewrite_portmap test2.rewrite_endpoint \
test2.rewrite_pnat test2.rewrite_pad test2.rewrite_trunc \
test2.rewrite_mac test2.rewrite_layer2 test2.rewrite_config \
test2.rewrite_skip test2.rewrite_dltuser test2.rewrite_dlthdlc \
test2.rewrite_vlandel test2.rewrite_efcs test2.rewrite_1ttl \
test2.rewrite_mtutrunc \
test2.rewrite_2ttl test2.rewrite_3ttl test.rewrite_tos test2.rewrite_tos
test: all
all: clearlog check tcpprep tcpreplay tcprewrite
clearlog:
-rm test.log
check:
$(PRINTF) "%s\n" "NOTICE: Tests must be run as root"
$(PRINTF) "%s\n" "Sending traffic on '$(nic1)' and '$(nic2)'"
if WORDS_BIGENDIAN
STANDARD_REWRITE = standard_bigendian
REWRITE_WARN = "big"
else
STANDARD_REWRITE = standard_littleendian
REWRITE_WARN = "little"
endif
standard: standard_prep $(STANDARD_REWRITE)
$(PRINTF) "Warning: only creating %s endian standard test files\n" $(REWRITE_WARN)
standard_prep:
$(TCPPREP) -i test.pcap -o test.auto_router -a router
$(TCPPREP) -i test.pcap -o test.auto_bridge -a bridge
$(TCPPREP) -i test.pcap -o test.auto_client -a client
$(TCPPREP) -i test.pcap -o test.auto_server -a server
$(TCPPREP) -i test.pcap -o test.auto_first -a first
$(TCPPREP) --load-opts config -o test.prep_config
$(TCPPREP) -i test.pcap -o test.port -p
$(TCPPREP) -i test.pcap -o test.mac -e 00:02:3b:00:3d:ce
$(TCPPREP) -i test.pcap -o test.cidr -c '216.27.178.0/24'
$(TCPPREP) -i test.pcap -o test.regex -r '216.27.178.*'
$(TCPPREP) -i test.pcap -o test.comment -C "This is a comment" -p
$(TCPPREP) -i test.pcap -o test.mac_reverse -e 00:02:3b:00:3d:ce --reverse
$(TCPPREP) -i test.pcap -o test.cidr_reverse -c '216.27.178.0/24' --reverse
$(TCPPREP) -i test.pcap -o test.regex_reverse -r '216.27.178.*' --reverse
standard_bigendian:
$(TCPREWRITE) -i test.pcap -o test.rewrite_seed -s 55
$(TCPREWRITE) -i test.pcap -o test.rewrite_tos --tos=50
$(TCPREWRITE) -i test.pcap -o test.rewrite_portmap -r 80:8080
$(TCPREWRITE) -i test.pcap -o test.rewrite_endpoint \
-e 10.10.0.1:10.10.0.2 -c test.auto_router
$(TCPREWRITE) -i test.pcap -o test.rewrite_pnat \
-N 216.27.178.0/24:172.16.0.0/24
$(TCPREWRITE) -i test.pcap -o test.rewrite_pad -F pad
$(TCPREWRITE) -i test.pcap -o test.rewrite_trunc -F trunc
$(TCPREWRITE) -i test.pcap -o test.rewrite_mac \
--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
--enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
$(TCPREWRITE) -i test.pcap -o test.rewrite_layer2 \
--dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0
$(TCPREWRITE) -i test.pcap -o test.rewrite_config --enet-vlan=add --enet-vlan-tag=45 \
--enet-vlan-cfi=1 --enet-vlan-pri=5
$(TCPREWRITE) -i test.pcap -o test.rewrite_skip -b -s 55 \
--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
--enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
$(TCPREWRITE) -i test.pcap -o test.rewrite_dltuser --dlt=user \
--user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
$(TCPREWRITE) -i test.pcap -o test.rewrite_dlthdlc --dlt=hdlc \
--hdlc-control=0 --hdlc-address=0x0F
$(TCPREWRITE) -i test.rewrite_config -o test.rewrite_vlandel \
--enet-vlan=del
$(TCPREWRITE) -i test.pcap -o test.rewrite_efcs --efcs
$(TCPREWRITE) -i test.pcap -o test.rewrite_1ttl --ttl=58
$(TCPREWRITE) -i test.pcap -o test.rewrite_2ttl --ttl=+58
$(TCPREWRITE) -i test.pcap -o test.rewrite_3ttl --ttl=-58
standard_littleendian:
$(TCPREWRITE) -i test.pcap -o test2.rewrite_seed -s 55
$(TCPREWRITE) -i test.pcap -o test2.rewrite_tos --tos=50
$(TCPREWRITE) -i test.pcap -o test2.rewrite_portmap -r 80:8080
$(TCPREWRITE) -i test.pcap -o test2.rewrite_endpoint \
-e 10.10.0.1:10.10.0.2 -c test.auto_router
$(TCPREWRITE) -i test.pcap -o test2.rewrite_pnat \
-N 216.27.178.0/24:172.16.0.0/24
$(TCPREWRITE) -i test.pcap -o test2.rewrite_pad -F pad
$(TCPREWRITE) -i test.pcap -o test2.rewrite_trunc -F trunc
$(TCPREWRITE) -i test.pcap -o test2.rewrite_mac \
--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
--enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
$(TCPREWRITE) -i test.pcap -o test2.rewrite_layer2 \
--dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0
$(TCPREWRITE) -i test.pcap -o test2.rewrite_config --enet-vlan=add --enet-vlan-tag=45 \
--enet-vlan-cfi=1 --enet-vlan-pri=5
$(TCPREWRITE) -i test.pcap -o test2.rewrite_skip -b -s 55 \
--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
--enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
$(TCPREWRITE) -i test.pcap -o test2.rewrite_dltuser --dlt=user \
--user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
$(TCPREWRITE) -i test.pcap -o test2.rewrite_dlthdlc --dlt=hdlc \
--hdlc-control=0 --hdlc-address=0x0F
$(TCPREWRITE) -i test.rewrite_config -o test2.rewrite_vlandel \
--enet-vlan=del
$(TCPREWRITE) -i test.pcap -o test2.rewrite_efcs --efcs
$(TCPREWRITE) -i test.pcap -o test2.rewrite_1ttl --ttl=58
$(TCPREWRITE) -i test.pcap -o test2.rewrite_2ttl --ttl=+58
$(TCPREWRITE) -i test.pcap -o test2.rewrite_3ttl --ttl=-58
$(TCPREWRITE) -i test.pcap -o test2.rewrite_mtutrunc --mtu-trunc --mtu=300
tcpprep: auto_router auto_bridge auto_client auto_server auto_first cidr regex \
port mac comment print_info print_comment prep_config \
mac_reverse cidr_reverse regex_reverse
tcprewrite: rewrite_portmap rewrite_endpoint rewrite_pnat rewrite_trunc \
rewrite_pad rewrite_seed rewrite_mac rewrite_layer2 rewrite_config \
rewrite_skip rewrite_dltuser rewrite_dlthdlc rewrite_vlandel rewrite_efcs \
rewrite_1ttl rewrite_2ttl rewrite_3ttl rewrite_tos rewrite_mtutrunc
tcpreplay: replay_basic replay_cache replay_pps replay_rate replay_top \
replay_config replay_multi replay_pps_multi replay_precache \
replay_stats replay_dualfile replay_maxsleep
prep_config:
$(PRINTF) "%s" "[tcpprep] Config mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Config mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) --load-opts=config -o test.$@1 >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
auto_router:
$(PRINTF) "%s" "[tcpprep] Auto/Router mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Auto/Router mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a router >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
auto_bridge:
$(PRINTF) "%s" "[tcpprep] Auto/Bridge mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Auto/Bridge mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a bridge >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
auto_client:
$(PRINTF) "%s" "[tcpprep] Auto/Client mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Auto/Client mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a client >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
auto_server:
$(PRINTF) "%s" "[tcpprep] Auto/Server mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Auto/Server mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a server >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
auto_first:
$(PRINTF) "%s" "[tcpprep] Auto/First mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Auto/First mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a first >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
regex:
$(PRINTF) "%s" "[tcpprep] Regex mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Regex mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -r '216.27.178.*' >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
cidr:
$(PRINTF) "%s" "[tcpprep] CIDR mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] CIDR mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '216.27.178.0/24' >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
port:
$(PRINTF) "%s" "[tcpprep] Port mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Port mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -p >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
mac:
$(PRINTF) "%s" "[tcpprep] MAC mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] MAC mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -e 00:02:3b:00:3d:ce >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
comment:
$(PRINTF) "%s" "[tcpprep] Comment mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Comment mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -C "This is a comment" -p >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
print_comment:
$(PRINTF) "%s" "[tcpprep] Print comment mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Print comment mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -P test.comment >test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
print_info:
$(PRINTF) "%s" "[tcpprep] Print info mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Print info mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -I test.comment >test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
regex_reverse:
$(PRINTF) "%s" "[tcpprep] Regex reverse mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] Regex reverse mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -r '216.27.178.*' --reverse >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
cidr_reverse:
$(PRINTF) "%s" "[tcpprep] CIDR reverse mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] CIDR reverse mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '216.27.178.0/24' --reverse >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
mac_reverse:
$(PRINTF) "%s" "[tcpprep] MAC reverse mode test: "
$(PRINTF) "%s\n" "*** [tcpprep] MAC reverse mode test: " >>test.log
$(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -e 00:02:3b:00:3d:ce --reverse >>test.log 2>&1
diff test.$@ test.$@1 >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
replay_basic:
$(PRINTF) "%s" "[tcpreplay] Basic test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Basic test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -t test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_cache:
$(PRINTF) "%s" "[tcpreplay] Cache test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Cache test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -c test.cidr -i $(nic1) -I $(nic2) -t test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_accurate:
$(PRINTF) "%s" "[tcpreplay] Accurate test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Accurate test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -a -i $(nic1) test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_stats:
$(PRINTF) "%s" "[tcpreplay] Statistics test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Statistics test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) --stats=1 -i $(nic1) test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_portmap:
$(PRINTF) "%s" "[tcprewrite] Portmap test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Portmap test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_portmap1 -r 80:8080 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_endpoint:
$(PRINTF) "%s" "[tcprewrite] Endpoint test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Endpoint test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_endpoint1 -e 10.10.0.1:10.10.0.2 \
-c test.auto_router >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_pnat:
$(PRINTF) "%s" "[tcprewrite] Pseudo NAT test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Pseudo NAT test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_pnat1 \
-N 216.27.178.0/24:172.16.0.0/24 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_mac:
$(PRINTF) "%s" "[tcprewrite] Src/Dst MAC test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Src/Dst MAC test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_mac1 \
--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
--enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_trunc:
$(PRINTF) "%s" "[tcprewrite] Truncate test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Truncate test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -F trunc -i test.pcap -o test.rewrite_trunc1 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_pad:
$(PRINTF) "%s" "[tcprewrite] Pad test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Pad test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -F pad -i test.pcap -o test.rewrite_pad1 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t\t%s\n" "OK"; fi
rewrite_seed:
$(PRINTF) "%s" "[tcprewrite] Seed IP test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Seed IP test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_seed1 -s 55 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_layer2:
$(PRINTF) "%s" "[tcprewrite] Layer2 test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Layer2 test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0 \
-i test.pcap -o test.rewrite_layer21 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_config:
$(PRINTF) "%s" "[tcprewrite] Config/VLAN Add test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Config/VLAN Add test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) --load-opts config >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
rewrite_skip:
$(PRINTF) "%s" "[tcprewrite] Skip bcast test: "
$(PRINTF) "%s\n" "*** [tcprewrite] Skip bcast test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_skip1 -b -s 55 \
--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
--enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_dltuser:
$(PRINTF) "%s" "[tcprewrite] DLT User test: "
$(PRINTF) "%s\n" "*** [tcprewrite] DLT User test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_dltuser1 --dlt=user \
--user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_dlthdlc:
$(PRINTF) "%s" "[tcprewrite] DLT Cisco HDLC test: "
$(PRINTF) "%s\n" "*** [tcprewrite] DLT Cisco HDLC test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_dlthdlc1 --dlt=hdlc \
--hdlc-control=0 --hdlc-address=0x0F >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
rewrite_vlandel:
$(PRINTF) "%s" "[tcprewrite] VLAN Delete test: "
$(PRINTF) "%s\n" "*** [tcprewrite] VLAN Delete test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.rewrite_config -o test.rewrite_vlandel1 \
--enet-vlan=del >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_efcs:
$(PRINTF) "%s" "[tcprewrite] Remove EFCS: "
$(PRINTF) "%s\n" "*** [tcprewrite] Remove EFCS: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_efcs1 --efcs >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_1ttl:
$(PRINTF) "%s" "[tcprewrite] Force TTL: "
$(PRINTF) "%s\n" "*** [tcprewrite] Force TTL: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 --ttl=58 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_2ttl:
$(PRINTF) "%s" "[tcprewrite] Increase TTL: "
$(PRINTF) "%s\n" "*** [tcprewrite] Increase TTL: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 --ttl=+58 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_3ttl:
$(PRINTF) "%s" "[tcprewrite] Reduce TTL: "
$(PRINTF) "%s\n" "*** [tcprewrite] Reduce TTL: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 --ttl=-58 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
rewrite_tos:
$(PRINTF) "%s" "[tcprewrite] TOS test: "
$(PRINTF) "%s\n" "*** [tcprewrite] TOS test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 --tos=50 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t\t%s\n" "OK"; fi
rewrite_mtutrunc:
$(PRINTF) "%s" "[tcprewrite] MTU Truncate test: "
$(PRINTF) "%s\n" "*** [tcprewrite] MTU Truncate test: " >>test.log
$(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 --mtu-trunc --mtu=300 >>test.log 2>&1
if WORDS_BIGENDIAN
diff test.$@ test.$@1 >>test.log 2>&1
else
diff test2.$@ test.$@1 >>test.log 2>&1
endif
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
replay_pps:
$(PRINTF) "%s" "[tcpreplay] Packets/sec test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Packets/sec test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -p 25 test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_rate:
$(PRINTF) "%s" "[tcpreplay] Mbps test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Mbps test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -M 25.0 test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t\t%s\n" "OK"; fi
replay_multi:
$(PRINTF) "%s" "[tcpreplay] Multiplier test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Multiplier test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -x 25.0 test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_pps_multi:
$(PRINTF) "%s" "[tcpreplay] Packets/sec Multiplier test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Packets/sec Multiplier test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -p 100 --pps-multi=5 test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
replay_top:
$(PRINTF) "%s" "[tcpreplay] Topspeed test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Topspeed test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -t test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_precache:
$(PRINTF) "%s" "[tcpreplay] Precache test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Precache test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) --preload-pcap test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
datadump_mode:
$(PRINTF) "%s" "[tcpreplay] Data dump test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Data dump mode test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -D -i $(nic1) -I $(nic2) -w primary.data -W secondary.data -c test.cidr -R test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_config:
$(PRINTF) "%s" "[tcpreplay] Config file/VLAN add test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Config file/VLAN add test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) --load-opts=config test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
replay_dualfile:
$(PRINTF) "%s" "[tcpreplay] Dual file test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Dual file test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -I $(nic2) --dualfile test.pcap test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
replay_maxsleep:
$(PRINTF) "%s" "[tcpreplay] Maximum sleep test: "
$(PRINTF) "%s\n" "*** [tcpreplay] Maximum sleep test: " >>test.log
$(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) --maxsleep=20 test.pcap test.pcap >>test.log 2>&1
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
clean:
rm -f *1 test.log core* *~ primary.data secondary.data
distclean: clean
rm -f Makefile config
maintainer-clean: distclean