1
0

Makefile.am 40 KB

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