Makefile.am 35 KB

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