Makefile.am 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. # $Id$
  2. MAKEFLAGS=-s -k
  3. PRINTF = @PRINTF@
  4. HOST = @host@
  5. TARGET = @target@
  6. BUILD = @build@
  7. nic1 = @nic1@
  8. nic2 = @nic2@
  9. ENABLE_DEBUG = @debug_run_time_flag@
  10. TCPPREP=../src/tcpprep --no-arg-comment
  11. TCPREPLAY=../src/tcpreplay
  12. TCPREWRITE=../src/tcprewrite
  13. TCPBRIDGE=../src/tcpbridge
  14. TEST_PCAP=$(srcdir)/test.pcap
  15. EXTRA_DIST = test.pcap test.auto_bridge test.auto_client test.auto_router \
  16. test.auto_server test.auto_first test.cidr test.comment test.port test.mac \
  17. test.cidr_reverse test.mac_reverse test.regex_reverse \
  18. test.include_packets test.exclude_packets test.include_source \
  19. test.include_dest test.prep_config \
  20. test.primary test.regex test.secondary \
  21. test.rewrite_seed test.rewrite_portmap test.rewrite_endpoint \
  22. test.rewrite_pnat test.rewrite_pad test.rewrite_trunc \
  23. test.rewrite_mac test.rewrite_layer2 test.rewrite_config \
  24. test.rewrite_skip test.rewrite_dltuser test.rewrite_dlthdlc \
  25. test.rewrite_vlandel test.rewrite_efcs test.rewrite_1ttl \
  26. test.rewrite_2ttl test.rewrite_3ttl test.rewrite_enet_subsmac \
  27. test.rewrite_mtutrunc test.rewrite_mac_seed test.rewrite_range_portmap \
  28. test.rewrite_mac_seed_keep test.rewrite_l7fuzzing test.rewrite_sequence \
  29. test2.rewrite_seed test2.rewrite_portmap test2.rewrite_endpoint \
  30. test2.rewrite_pnat test2.rewrite_pad test2.rewrite_trunc \
  31. test2.rewrite_mac test2.rewrite_layer2 test2.rewrite_config \
  32. test2.rewrite_skip test2.rewrite_dltuser test2.rewrite_dlthdlc \
  33. test2.rewrite_vlandel test2.rewrite_efcs test2.rewrite_1ttl \
  34. test2.rewrite_mtutrunc test2.rewrite_enet_subsmac \
  35. test2.rewrite_2ttl test2.rewrite_3ttl test.rewrite_tos test2.rewrite_tos \
  36. test2.rewrite_enet_subsmac test2.rewrite_mac_seed \
  37. test2.rewrite_range_portmap test2.rewrite_mac_seed_keep \
  38. test2.rewrite_l7fuzzing test2.rewrite_sequence
  39. test: all
  40. all: clearlog check tcpprep tcpreplay tcprewrite
  41. clearlog:
  42. -rm test.log
  43. check:
  44. $(PRINTF) "%s\n" "NOTICE: Tests must be run as root"
  45. $(PRINTF) "%s\n" "Sending traffic on '$(nic1)' and '$(nic2)'"
  46. if WORDS_BIGENDIAN
  47. STANDARD_REWRITE = standard_bigendian
  48. REWRITE_WARN = "big"
  49. else
  50. STANDARD_REWRITE = standard_littleendian
  51. REWRITE_WARN = "little"
  52. endif
  53. standard: standard_prep $(STANDARD_REWRITE)
  54. $(PRINTF) "Warning: only creating %s endian standard test files\n" $(REWRITE_WARN)
  55. standard_prep:
  56. $(TCPPREP) -i $(TEST_PCAP) -o test.auto_router -a router
  57. $(TCPPREP) -i $(TEST_PCAP) -o test.auto_bridge -a bridge
  58. $(TCPPREP) -i $(TEST_PCAP) -o test.auto_client -a client
  59. $(TCPPREP) -i $(TEST_PCAP) -o test.auto_server -a server
  60. $(TCPPREP) -i test.pcap -o test.auto_first -a first
  61. $(TCPPREP) --load-opts config -o test.prep_config
  62. $(TCPPREP) -i $(TEST_PCAP) -o test.port -p
  63. $(TCPPREP) -i $(TEST_PCAP) -o test.mac -e 00:1f:f3:3c:e1:13
  64. $(TCPPREP) -i $(TEST_PCAP) -o test.cidr -c '96.17.211.0/24'
  65. $(TCPPREP) -i $(TEST_PCAP) -o test.regex -r '96.17.211.*'
  66. $(TCPPREP) -i $(TEST_PCAP) -o test.comment -C "This is a comment" -p
  67. $(TCPPREP) -i $(TEST_PCAP) -o test.mac_reverse -e 00:1f:f3:3c:e1:13 --reverse
  68. $(TCPPREP) -i $(TEST_PCAP) -o test.cidr_reverse -c '96.17.211.0/24' --reverse
  69. $(TCPPREP) -i $(TEST_PCAP) -o test.regex_reverse -r '96.17.211.*' --reverse
  70. $(TCPPREP) -i $(TEST_PCAP) -o test.exclude_packets -c '96.17.211.0/24' --exclude 'P:61-65,88-91'
  71. $(TCPPREP) -i $(TEST_PCAP) -o test.include_packets -c '96.17.211.0/24' --include 'P:61-65,88-91'
  72. $(TCPPREP) -i $(TEST_PCAP) -o test.include_source -c '96.17.211.0/24' --include 'S:96.0.0.0/8'
  73. $(TCPPREP) -i $(TEST_PCAP) -o test.include_dest -c '96.17.211.0/24' --include 'D:96.0.0.0/8'
  74. standard_bigendian:
  75. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_seed -s 55
  76. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_tos --tos=50
  77. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_portmap -r 80:8080
  78. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_range_portmap -r 1-100:49148
  79. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_sequence --tcp-sequence 42
  80. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_endpoint \
  81. -e 10.10.0.1:10.10.0.2 -c test.auto_router
  82. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_pnat \
  83. -N 96.17.211.0/24:172.16.0.0/24
  84. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_pad -F pad
  85. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_trunc -F trunc
  86. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_mac \
  87. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  88. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c $(srcdir)/test.auto_router
  89. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_enet_subsmac \
  90. --enet-subsmac=00:1f:f3:3c:e1:13,00:22:33:44:55:66 \
  91. --enet-subsmac=f8:1e:df:e5:84:3a,00:66:55:44:33:22
  92. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_mac_seed --enet-mac-seed=42
  93. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_mac_seed_keep --enet-mac-seed=42 \
  94. --enet-mac-seed-keep-bytes=3
  95. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_layer2 \
  96. --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0
  97. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_config --enet-vlan=add --enet-vlan-tag=45 \
  98. --enet-vlan-cfi=1 --enet-vlan-pri=5
  99. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_skip -b -s 55 \
  100. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  101. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c $(srcdir)/test.auto_router
  102. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_dltuser --dlt=user \
  103. --user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
  104. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_dlthdlc --dlt=hdlc \
  105. --hdlc-control=0 --hdlc-address=0x0F
  106. $(TCPREWRITE) -i $(srcdir)/test.rewrite_config -o test.rewrite_vlandel \
  107. --enet-vlan=del
  108. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_efcs --efcs
  109. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_1ttl --ttl=58
  110. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_2ttl --ttl=+58
  111. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_3ttl --ttl=-58
  112. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_mtutrunc --mtu-trunc --mtu=300
  113. $(TCPREWRITE) -i $(TEST_PCAP) -o test.rewrite_l7fuzzing \
  114. --fuzz-seed=42 --fuzz-factor=2
  115. standard_littleendian:
  116. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_seed -s 55
  117. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_tos --tos=50
  118. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_portmap -r 80:8080
  119. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_range_portmap -r 1-100:49148
  120. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_sequence --tcp-sequence 42
  121. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_endpoint \
  122. -e 10.10.0.1:10.10.0.2 -c test.auto_router
  123. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_pnat \
  124. -N 96.17.211.0/24:172.16.0.0/24
  125. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_pad -F pad
  126. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_trunc -F trunc
  127. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_mac \
  128. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  129. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c $(srcdir)/test.auto_router
  130. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_enet_subsmac \
  131. --enet-subsmac=00:1f:f3:3c:e1:13,00:22:33:44:55:66 \
  132. --enet-subsmac=f8:1e:df:e5:84:3a,00:66:55:44:33:22
  133. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_mac_seed --enet-mac-seed=42
  134. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_mac_seed_keep --enet-mac-seed=42 \
  135. --enet-mac-seed-keep-bytes=3
  136. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_layer2 \
  137. --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0
  138. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_config --enet-vlan=add --enet-vlan-tag=45 \
  139. --enet-vlan-cfi=1 --enet-vlan-pri=5
  140. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_skip -b -s 55 \
  141. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  142. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c $(srcdir)/test.auto_router
  143. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_dltuser --dlt=user \
  144. --user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
  145. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_dlthdlc --dlt=hdlc \
  146. --hdlc-control=0 --hdlc-address=0x0F
  147. $(TCPREWRITE) -i $(srcdir)/test.rewrite_config -o test2.rewrite_vlandel \
  148. --enet-vlan=del
  149. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_efcs --efcs
  150. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_1ttl --ttl=58
  151. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_2ttl --ttl=+58
  152. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_3ttl --ttl=-58
  153. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_mtutrunc --mtu-trunc --mtu=300
  154. $(TCPREWRITE) -i $(TEST_PCAP) -o test2.rewrite_l7fuzzing \
  155. --fuzz-seed=42 --fuzz-factor=2
  156. tcpprep: auto_router auto_bridge auto_client auto_server auto_first cidr regex \
  157. port mac comment print_info print_comment prep_config \
  158. mac_reverse cidr_reverse regex_reverse exclude_packets \
  159. include_packets include_source include_dest
  160. tcprewrite: rewrite_portmap rewrite_range_portmap rewrite_endpoint \
  161. rewrite_pnat rewrite_trunc rewrite_pad rewrite_seed rewrite_mac \
  162. rewrite_layer2 rewrite_config rewrite_skip rewrite_dltuser rewrite_dlthdlc \
  163. rewrite_vlandel rewrite_efcs rewrite_1ttl rewrite_2ttl rewrite_3ttl \
  164. rewrite_tos rewrite_mtutrunc rewrite_enet_subsmac rewrite_mac_seed \
  165. rewrite_mac_seed_keep rewrite_l7fuzzing rewrite_sequence
  166. tcpreplay: replay_basic replay_cache replay_pps replay_rate replay_top \
  167. replay_config replay_multi replay_pps_multi replay_precache \
  168. replay_stats replay_dualfile replay_maxsleep
  169. prep_config:
  170. $(PRINTF) "%s" "[tcpprep] Config mode test: "
  171. $(PRINTF) "%s\n" "*** [tcpprep] Config mode test: " >> test.log
  172. $(TCPPREP) $(ENABLE_DEBUG) --load-opts=config -o test.$@1 >> test.log 2>&1
  173. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  174. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  175. auto_router:
  176. $(PRINTF) "%s" "[tcpprep] Auto/Router mode test: "
  177. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Router mode test: " >> test.log
  178. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -a router >> test.log 2>&1
  179. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  180. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  181. auto_bridge:
  182. $(PRINTF) "%s" "[tcpprep] Auto/Bridge mode test: "
  183. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Bridge mode test: " >> test.log
  184. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -a bridge >> test.log 2>&1
  185. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  186. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  187. auto_client:
  188. $(PRINTF) "%s" "[tcpprep] Auto/Client mode test: "
  189. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Client mode test: " >> test.log
  190. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -a client >> test.log 2>&1
  191. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  192. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  193. auto_server:
  194. $(PRINTF) "%s" "[tcpprep] Auto/Server mode test: "
  195. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Server mode test: " >> test.log
  196. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -a server >> test.log 2>&1
  197. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  198. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  199. auto_first:
  200. $(PRINTF) "%s" "[tcpprep] Auto/First mode test: "
  201. $(PRINTF) "%s\n" "*** [tcpprep] Auto/First mode test: " >> test.log
  202. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -a first >> test.log 2>&1
  203. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  204. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  205. regex:
  206. $(PRINTF) "%s" "[tcpprep] Regex mode test: "
  207. $(PRINTF) "%s\n" "*** [tcpprep] Regex mode test: " >> test.log
  208. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -r '96.17.211.*' >> test.log 2>&1
  209. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  210. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  211. cidr:
  212. $(PRINTF) "%s" "[tcpprep] CIDR mode test: "
  213. $(PRINTF) "%s\n" "*** [tcpprep] CIDR mode test: " >> test.log
  214. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -c '96.17.211.0/24' >> test.log 2>&1
  215. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  216. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  217. port:
  218. $(PRINTF) "%s" "[tcpprep] Port mode test: "
  219. $(PRINTF) "%s\n" "*** [tcpprep] Port mode test: " >> test.log
  220. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -p >> test.log 2>&1
  221. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  222. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  223. mac:
  224. $(PRINTF) "%s" "[tcpprep] MAC mode test: "
  225. $(PRINTF) "%s\n" "*** [tcpprep] MAC mode test: " >> test.log
  226. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -e 00:1f:f3:3c:e1:13 >> test.log 2>&1
  227. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  228. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  229. comment:
  230. $(PRINTF) "%s" "[tcpprep] Comment mode test: "
  231. $(PRINTF) "%s\n" "*** [tcpprep] Comment mode test: " >> test.log
  232. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -C "This is a comment" -p >> test.log 2>&1
  233. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  234. print_comment:
  235. $(PRINTF) "%s" "[tcpprep] Print comment mode test: "
  236. $(PRINTF) "%s\n" "*** [tcpprep] Print comment mode test: " >> test.log
  237. $(TCPPREP) $(ENABLE_DEBUG) -P $(srcdir)/test.comment >$(srcdir)/test.$@1 >> test.log 2>&1
  238. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  239. print_info:
  240. $(PRINTF) "%s" "[tcpprep] Print info mode test: "
  241. $(PRINTF) "%s\n" "*** [tcpprep] Print info mode test: " >> test.log
  242. $(TCPPREP) $(ENABLE_DEBUG) -I $(srcdir)/test.comment >$(srcdir)/test.$@1 >> test.log 2>&1
  243. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  244. regex_reverse:
  245. $(PRINTF) "%s" "[tcpprep] Regex reverse mode test: "
  246. $(PRINTF) "%s\n" "*** [tcpprep] Regex reverse mode test: " >> test.log
  247. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -r '96.17.211.*' --reverse >> test.log 2>&1
  248. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  249. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  250. cidr_reverse:
  251. $(PRINTF) "%s" "[tcpprep] CIDR reverse mode test: "
  252. $(PRINTF) "%s\n" "*** [tcpprep] CIDR reverse mode test: " >> test.log
  253. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -c '96.17.211.0/24' --reverse >> test.log 2>&1
  254. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  255. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  256. mac_reverse:
  257. $(PRINTF) "%s" "[tcpprep] MAC reverse mode test: "
  258. $(PRINTF) "%s\n" "*** [tcpprep] MAC reverse mode test: " >> test.log
  259. $(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -e 00:1f:f3:3c:e1:13 --reverse >> test.log 2>&1
  260. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  261. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  262. exclude_packets:
  263. $(PRINTF) "%s" "[tcpprep] exclude packets test: "
  264. $(PRINTF) "%s\n" "*** [tcpprep] exclude packets test: " >> test.log
  265. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '96.17.211.0/24' --exclude 'P:61-65,88-91' >> test.log 2>&1
  266. diff test.$@ test.$@1 >> test.log 2>&1
  267. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  268. include_packets:
  269. $(PRINTF) "%s" "[tcpprep] include packets test: "
  270. $(PRINTF) "%s\n" "*** [tcpprep] include packets test: " >> test.log
  271. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '96.17.211.0/24' --include 'P:61-65,88-91' >> test.log 2>&1
  272. diff test.$@ test.$@1 >> test.log 2>&1
  273. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  274. include_source:
  275. $(PRINTF) "%s" "[tcpprep] include source test: "
  276. $(PRINTF) "%s\n" "*** [tcpprep] include source test: " >> test.log
  277. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '96.17.211.0/24' --include 'S:96.0.0.0/8' >> test.log 2>&1
  278. diff test.$@ test.$@1 >> test.log 2>&1
  279. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  280. include_dest:
  281. $(PRINTF) "%s" "[tcpprep] include destination test: "
  282. $(PRINTF) "%s\n" "*** [tcpprep] include destination test: " >> test.log
  283. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '96.17.211.0/24' --include 'D:96.0.0.0/8' >> test.log 2>&1
  284. diff test.$@ test.$@1 >> test.log 2>&1
  285. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  286. replay_basic:
  287. $(PRINTF) "%s" "[tcpreplay] Basic test: "
  288. $(PRINTF) "%s\n" "*** [tcpreplay] Basic test: " >> test.log
  289. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -t $(TEST_PCAP) >> test.log 2>&1
  290. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  291. replay_cache:
  292. $(PRINTF) "%s" "[tcpreplay] Cache test: "
  293. $(PRINTF) "%s\n" "*** [tcpreplay] Cache test: " >> test.log
  294. $(TCPREPLAY) $(ENABLE_DEBUG) -c $(srcdir)/test.cidr -i $(nic1) -I $(nic2) -t $(TEST_PCAP) >> test.log 2>&1
  295. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  296. replay_accurate:
  297. $(PRINTF) "%s" "[tcpreplay] Accurate test: "
  298. $(PRINTF) "%s\n" "*** [tcpreplay] Accurate test: " >> test.log
  299. $(TCPREPLAY) $(ENABLE_DEBUG) -a -i $(nic1) $(TEST_PCAP) >> test.log 2>&1
  300. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  301. replay_stats:
  302. $(PRINTF) "%s" "[tcpreplay] Statistics test: "
  303. $(PRINTF) "%s\n" "*** [tcpreplay] Statistics test: " >> test.log
  304. $(TCPREPLAY) $(ENABLE_DEBUG) --stats=1 -i $(nic1) $(TEST_PCAP) >> test.log 2>&1
  305. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  306. rewrite_portmap:
  307. $(PRINTF) "%s" "[tcprewrite] Portmap test: "
  308. $(PRINTF) "%s\n" "*** [tcprewrite] Portmap test: " >> test.log
  309. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -r 80:8080 >> test.log 2>&1
  310. if WORDS_BIGENDIAN
  311. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  312. else
  313. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  314. endif
  315. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  316. rewrite_range_portmap:
  317. $(PRINTF) "%s" "[tcprewrite] Portmap range test: "
  318. $(PRINTF) "%s\n" "*** [tcprewrite] Portmap range test: " >> test.log
  319. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -r 1-100:49148 >> test.log 2>&1
  320. if WORDS_BIGENDIAN
  321. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  322. else
  323. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  324. endif
  325. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  326. rewrite_sequence:
  327. $(PRINTF) "%s" "[tcprewrite] TCP sequence test: "
  328. $(PRINTF) "%s\n" "*** [tcprewrite] TCP sequence test: " >> test.log
  329. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --tcp-sequence 42 >> test.log 2>&1
  330. if WORDS_BIGENDIAN
  331. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  332. else
  333. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  334. endif
  335. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  336. rewrite_endpoint:
  337. $(PRINTF) "%s" "[tcprewrite] Endpoint test: "
  338. $(PRINTF) "%s\n" "*** [tcprewrite] Endpoint test: " >> test.log
  339. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -e 10.10.0.1:10.10.0.2 \
  340. -c $(srcdir)/test.auto_router >> test.log 2>&1
  341. if WORDS_BIGENDIAN
  342. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  343. else
  344. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  345. endif
  346. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  347. rewrite_pnat:
  348. $(PRINTF) "%s" "[tcprewrite] Pseudo NAT test: "
  349. $(PRINTF) "%s\n" "*** [tcprewrite] Pseudo NAT test: " >> test.log
  350. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 \
  351. -N 96.17.211.0/24:172.16.0.0/24 >> test.log 2>&1
  352. if WORDS_BIGENDIAN
  353. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  354. else
  355. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  356. endif
  357. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  358. rewrite_mac:
  359. $(PRINTF) "%s" "[tcprewrite] Src/Dst MAC test: "
  360. $(PRINTF) "%s\n" "*** [tcprewrite] Src/Dst MAC test: " >> test.log
  361. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 \
  362. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  363. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c $(srcdir)/test.auto_router >> test.log 2>&1
  364. if WORDS_BIGENDIAN
  365. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  366. else
  367. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  368. endif
  369. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  370. rewrite_enet_subsmac:
  371. $(PRINTF) "%s" "[tcprewrite] Substitute Src/Dst MAC test: "
  372. $(PRINTF) "%s\n" "*** [tcprewrite] Substitute Src/Dst MAC test: " >> test.log
  373. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 \
  374. --enet-subsmac=00:1f:f3:3c:e1:13,00:22:33:44:55:66 \
  375. --enet-subsmac=f8:1e:df:e5:84:3a,00:66:55:44:33:22 >> test.log 2>&1
  376. if WORDS_BIGENDIAN
  377. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  378. else
  379. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  380. endif
  381. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  382. rewrite_mac_seed:
  383. $(PRINTF) "%s" "[tcprewrite] Seeded MAC test: "
  384. $(PRINTF) "%s\n" "*** [tcprewrite] Seeded MAC test: " >> test.log
  385. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 \
  386. --enet-mac-seed=42 >> test.log 2>&1
  387. if WORDS_BIGENDIAN
  388. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  389. else
  390. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  391. endif
  392. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  393. rewrite_mac_seed_keep:
  394. $(PRINTF) "%s" "[tcprewrite] Seeded Keep MAC test: "
  395. $(PRINTF) "%s\n" "*** [tcprewrite] Seeded Keep MAC test: " >> test.log
  396. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 \
  397. --enet-mac-seed=42 --enet-mac-seed-keep-bytes=3 >> test.log 2>&1
  398. if WORDS_BIGENDIAN
  399. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  400. else
  401. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  402. endif
  403. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  404. rewrite_trunc:
  405. $(PRINTF) "%s" "[tcprewrite] Truncate test: "
  406. $(PRINTF) "%s\n" "*** [tcprewrite] Truncate test: " >> test.log
  407. $(TCPREWRITE) $(ENABLE_DEBUG) -F trunc -i $(TEST_PCAP) -o test.$@1 >> test.log 2>&1
  408. if WORDS_BIGENDIAN
  409. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  410. else
  411. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  412. endif
  413. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  414. rewrite_pad:
  415. $(PRINTF) "%s" "[tcprewrite] Pad test: "
  416. $(PRINTF) "%s\n" "*** [tcprewrite] Pad test: " >> test.log
  417. $(TCPREWRITE) $(ENABLE_DEBUG) -F pad -i $(TEST_PCAP) -o test.$@1 >> test.log 2>&1
  418. if WORDS_BIGENDIAN
  419. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  420. else
  421. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  422. endif
  423. if [ $? ] ; then $(PRINTF) "\t\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t\t%s\n" "OK"; fi
  424. rewrite_seed:
  425. $(PRINTF) "%s" "[tcprewrite] Seed IP test: "
  426. $(PRINTF) "%s\n" "*** [tcprewrite] Seed IP test: " >> test.log
  427. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -s 55 >> test.log 2>&1
  428. if WORDS_BIGENDIAN
  429. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  430. else
  431. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  432. endif
  433. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  434. rewrite_layer2:
  435. $(PRINTF) "%s" "[tcprewrite] Layer2 test: "
  436. $(PRINTF) "%s\n" "*** [tcprewrite] Layer2 test: " >> test.log
  437. $(TCPREWRITE) $(ENABLE_DEBUG) --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0 \
  438. -i $(TEST_PCAP) -o test.$@1 >> test.log 2>&1
  439. if WORDS_BIGENDIAN
  440. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  441. else
  442. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  443. endif
  444. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  445. rewrite_config:
  446. $(PRINTF) "%s" "[tcprewrite] Config/VLAN Add test: "
  447. $(PRINTF) "%s\n" "*** [tcprewrite] Config/VLAN Add test: " >> test.log
  448. $(TCPREWRITE) $(ENABLE_DEBUG) --load-opts config >> test.log 2>&1
  449. if WORDS_BIGENDIAN
  450. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  451. else
  452. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  453. endif
  454. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  455. rewrite_skip:
  456. $(PRINTF) "%s" "[tcprewrite] Skip bcast test: "
  457. $(PRINTF) "%s\n" "*** [tcprewrite] Skip bcast test: " >> test.log
  458. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 -b -s 55 \
  459. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  460. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c $(srcdir)/test.auto_router >> test.log 2>&1
  461. if WORDS_BIGENDIAN
  462. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  463. else
  464. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  465. endif
  466. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  467. rewrite_dltuser:
  468. $(PRINTF) "%s" "[tcprewrite] DLT User test: "
  469. $(PRINTF) "%s\n" "*** [tcprewrite] DLT User test: " >> test.log
  470. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --dlt=user \
  471. --user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104 >> test.log 2>&1
  472. if WORDS_BIGENDIAN
  473. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  474. else
  475. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  476. endif
  477. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  478. rewrite_dlthdlc:
  479. $(PRINTF) "%s" "[tcprewrite] DLT Cisco HDLC test: "
  480. $(PRINTF) "%s\n" "*** [tcprewrite] DLT Cisco HDLC test: " >> test.log
  481. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --dlt=hdlc \
  482. --hdlc-control=0 --hdlc-address=0x0F >> test.log 2>&1
  483. if WORDS_BIGENDIAN
  484. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  485. else
  486. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  487. endif
  488. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  489. rewrite_vlandel:
  490. $(PRINTF) "%s" "[tcprewrite] VLAN Delete test: "
  491. $(PRINTF) "%s\n" "*** [tcprewrite] VLAN Delete test: " >> test.log
  492. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(srcdir)/test.rewrite_config -o test.$@1 \
  493. --enet-vlan=del >> test.log 2>&1
  494. if WORDS_BIGENDIAN
  495. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  496. else
  497. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  498. endif
  499. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  500. rewrite_efcs:
  501. $(PRINTF) "%s" "[tcprewrite] Remove EFCS: "
  502. $(PRINTF) "%s\n" "*** [tcprewrite] Remove EFCS: " >> test.log
  503. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --efcs >> test.log 2>&1
  504. if WORDS_BIGENDIAN
  505. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  506. else
  507. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  508. endif
  509. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  510. rewrite_1ttl:
  511. $(PRINTF) "%s" "[tcprewrite] Force TTL: "
  512. $(PRINTF) "%s\n" "*** [tcprewrite] Force TTL: " >> test.log
  513. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --ttl=58 >> test.log 2>&1
  514. if WORDS_BIGENDIAN
  515. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  516. else
  517. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  518. endif
  519. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  520. rewrite_2ttl:
  521. $(PRINTF) "%s" "[tcprewrite] Increase TTL: "
  522. $(PRINTF) "%s\n" "*** [tcprewrite] Increase TTL: " >> test.log
  523. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --ttl=+58 >> test.log 2>&1
  524. if WORDS_BIGENDIAN
  525. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  526. else
  527. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  528. endif
  529. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  530. rewrite_3ttl:
  531. $(PRINTF) "%s" "[tcprewrite] Reduce TTL: "
  532. $(PRINTF) "%s\n" "*** [tcprewrite] Reduce TTL: " >> test.log
  533. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --ttl=-58 >> test.log 2>&1
  534. if WORDS_BIGENDIAN
  535. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  536. else
  537. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  538. endif
  539. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  540. rewrite_tos:
  541. $(PRINTF) "%s" "[tcprewrite] TOS test: "
  542. $(PRINTF) "%s\n" "*** [tcprewrite] TOS test: " >> test.log
  543. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --tos=50 >> test.log 2>&1
  544. if WORDS_BIGENDIAN
  545. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  546. else
  547. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  548. endif
  549. if [ $? ] ; then $(PRINTF) "\t\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t\t%s\n" "OK"; fi
  550. rewrite_mtutrunc:
  551. $(PRINTF) "%s" "[tcprewrite] MTU Truncate test: "
  552. $(PRINTF) "%s\n" "*** [tcprewrite] MTU Truncate test: " >> test.log
  553. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --mtu-trunc --mtu=300 >> test.log 2>&1
  554. if WORDS_BIGENDIAN
  555. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  556. else
  557. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  558. endif
  559. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  560. rewrite_l7fuzzing:
  561. $(PRINTF) "%s" "[tcprewrite] L7 fuzzing test: "
  562. $(PRINTF) "%s\n" "*** [tcprewrite] L7 fuzzing test: " >> test.log
  563. $(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --fuzz-seed=42 --fuzz-factor=2 >> test.log 2>&1
  564. if WORDS_BIGENDIAN
  565. diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1
  566. else
  567. diff $(srcdir)/test2.$@ test.$@1 >> test.log 2>&1
  568. endif
  569. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  570. replay_pps:
  571. $(PRINTF) "%s" "[tcpreplay] Packets/sec test: "
  572. $(PRINTF) "%s\n" "*** [tcpreplay] Packets/sec test: " >> test.log
  573. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -p 25 $(TEST_PCAP) >> test.log 2>&1
  574. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  575. replay_rate:
  576. $(PRINTF) "%s" "[tcpreplay] Mbps test: "
  577. $(PRINTF) "%s\n" "*** [tcpreplay] Mbps test: " >> test.log
  578. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -M 25.0 $(TEST_PCAP) >> test.log 2>&1
  579. if [ $? ] ; then $(PRINTF) "\t\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t\t%s\n" "OK"; fi
  580. replay_multi:
  581. $(PRINTF) "%s" "[tcpreplay] Multiplier test: "
  582. $(PRINTF) "%s\n" "*** [tcpreplay] Multiplier test: " >> test.log
  583. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -x 25.0 $(TEST_PCAP) >> test.log 2>&1
  584. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  585. replay_pps_multi:
  586. $(PRINTF) "%s" "[tcpreplay] Packets/sec Multiplier test: "
  587. $(PRINTF) "%s\n" "*** [tcpreplay] Packets/sec Multiplier test: " >> test.log
  588. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -p 100 --pps-multi=5 $(TEST_PCAP) >> test.log 2>&1
  589. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  590. replay_top:
  591. $(PRINTF) "%s" "[tcpreplay] Topspeed test: "
  592. $(PRINTF) "%s\n" "*** [tcpreplay] Topspeed test: " >> test.log
  593. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -t $(TEST_PCAP) >> test.log 2>&1
  594. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  595. replay_precache:
  596. $(PRINTF) "%s" "[tcpreplay] Precache test: "
  597. $(PRINTF) "%s\n" "*** [tcpreplay] Precache test: " >> test.log
  598. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) --preload-pcap $(TEST_PCAP) >> test.log 2>&1
  599. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  600. datadump_mode:
  601. $(PRINTF) "%s" "[tcpreplay] Data dump test: "
  602. $(PRINTF) "%s\n" "*** [tcpreplay] Data dump mode test: " >> test.log
  603. $(TCPREPLAY) $(ENABLE_DEBUG) -D -i $(nic1) -I $(nic2) -w primary.data -W secondary.data -c $(srcdir)/test.cidr -R $(TEST_PCAP) >> test.log 2>&1
  604. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  605. replay_config:
  606. $(PRINTF) "%s" "[tcpreplay] Config file/VLAN add test: "
  607. $(PRINTF) "%s\n" "*** [tcpreplay] Config file/VLAN add test: " >> test.log
  608. $(TCPREPLAY) $(ENABLE_DEBUG) --load-opts=config $(TEST_PCAP) >> test.log 2>&1
  609. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  610. replay_dualfile:
  611. $(PRINTF) "%s" "[tcpreplay] Dual file test: "
  612. $(PRINTF) "%s\n" "*** [tcpreplay] Dual file test: " >> test.log
  613. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -I $(nic2) --dualfile $(TEST_PCAP) $(TEST_PCAP) >> test.log 2>&1
  614. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  615. replay_maxsleep:
  616. $(PRINTF) "%s" "[tcpreplay] Maximum sleep test: "
  617. $(PRINTF) "%s\n" "*** [tcpreplay] Maximum sleep test: " >> test.log
  618. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) --maxsleep=20 $(TEST_PCAP) $(TEST_PCAP) >> test.log 2>&1
  619. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  620. clean:
  621. rm -f *1 test.log core* *~ primary.data secondary.data
  622. distclean: clean
  623. rm -f Makefile config
  624. maintainer-clean: distclean