1
0

Makefile.am 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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_flag@
  10. TCPPREP=../src/tcpprep --no-arg-comment
  11. TCPREPLAY=../src/tcpreplay
  12. TCPREWRITE=../src/tcprewrite
  13. TCPBRIDGE=../src/tcpbridge
  14. EXTRA_DIST = test.pcap test.auto_bridge test.auto_client test.auto_router \
  15. test.auto_server test.auto_first test.cidr test.comment test.port test.mac \
  16. test.prep_config test.primary test.regex test.secondary \
  17. test.rewrite_seed test.rewrite_portmap test.rewrite_endpoint \
  18. test.rewrite_pnat test.rewrite_pad test.rewrite_trunc \
  19. test.rewrite_mac test.rewrite_layer2 test.rewrite_config \
  20. test.rewrite_skip test.rewrite_dltuser test.rewrite_dlthdlc \
  21. test.rewrite_vlandel \
  22. test2.rewrite_seed test2.rewrite_portmap test2.rewrite_endpoint \
  23. test2.rewrite_pnat test2.rewrite_pad test2.rewrite_trunc \
  24. test2.rewrite_mac test2.rewrite_layer2 test2.rewrite_config \
  25. test2.rewrite_skip test2.rewrite_dltuser test2.rewrite_dlthdlc \
  26. test2.rewrite_vlandel
  27. test: all
  28. all: clearlog check tcpprep tcpreplay tcprewrite
  29. clearlog:
  30. -rm test.log
  31. check:
  32. $(PRINTF) "%s\n" "NOTICE: Tests must be run as root"
  33. $(PRINTF) "%s\n" "Sending traffic on '$(nic1)' and '$(nic2)'"
  34. if WORDS_BIGENDIAN
  35. STANDARD_REWRITE = standard_bigendian
  36. REWRITE_WARN = "big"
  37. else
  38. STANDARD_REWRITE = standard_littleendian
  39. REWRITE_WARN = "little"
  40. endif
  41. standard: standard_prep $(STANDARD_REWRITE)
  42. $(PRINTF) "Warning: only creating %s endian standard test files\n" $(REWRITE_WARN)
  43. standard_prep:
  44. $(TCPPREP) -i test.pcap -o test.auto_router -a router
  45. $(TCPPREP) -i test.pcap -o test.auto_bridge -a bridge
  46. $(TCPPREP) -i test.pcap -o test.auto_client -a client
  47. $(TCPPREP) -i test.pcap -o test.auto_server -a server
  48. $(TCPPREP) -i test.pcap -o test.auto_first -a first
  49. $(TCPPREP) --load-opts config -o test.prep_config
  50. $(TCPPREP) -i test.pcap -o test.port -p
  51. $(TCPPREP) -i test.pcap -o test.mac -e 00:02:3b:00:3d:ce
  52. $(TCPPREP) -i test.pcap -o test.cidr -c '216.27.178.0/24'
  53. $(TCPPREP) -i test.pcap -o test.regex -r '216.27.178.*'
  54. $(TCPPREP) -i test.pcap -o test.comment -C "This is a comment" -p
  55. standard_bigendian:
  56. $(TCPREWRITE) -i test.pcap -o test.rewrite_seed -s 55
  57. $(TCPREWRITE) -i test.pcap -o test.rewrite_portmap -r 80:8080
  58. $(TCPREWRITE) -i test.pcap -o test.rewrite_endpoint \
  59. -e 10.10.0.1:10.10.0.2 -c test.auto_router
  60. $(TCPREWRITE) -i test.pcap -o test.rewrite_pnat \
  61. -N 216.27.178.0/24:172.16.0.0/24
  62. $(TCPREWRITE) -i test.pcap -o test.rewrite_pad -F pad
  63. $(TCPREWRITE) -i test.pcap -o test.rewrite_trunc -F trunc
  64. $(TCPREWRITE) -i test.pcap -o test.rewrite_mac \
  65. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  66. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
  67. $(TCPREWRITE) -i test.pcap -o test.rewrite_layer2 \
  68. --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0
  69. $(TCPREWRITE) -i test.pcap -o test.rewrite_config --enet-vlan=add --enet-vlan-tag=45 \
  70. --enet-vlan-cfi=1 --enet-vlan-pri=5
  71. $(TCPREWRITE) -i test.pcap -o test.rewrite_skip -b -s 55 \
  72. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  73. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
  74. $(TCPREWRITE) -i test.pcap -o test.rewrite_dltuser --dlt=user \
  75. --user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
  76. $(TCPREWRITE) -i test.pcap -o test.rewrite_dlthdlc --dlt=hdlc \
  77. --hdlc-control=0 --hdlc-address=0x0F
  78. $(TCPREWRITE) -i test.rewrite_config -o test.rewrite_vlandel \
  79. --enet-vlan=del
  80. standard_littleendian:
  81. $(TCPREWRITE) -i test.pcap -o test2.rewrite_seed -s 55
  82. $(TCPREWRITE) -i test.pcap -o test2.rewrite_portmap -r 80:8080
  83. $(TCPREWRITE) -i test.pcap -o test2.rewrite_endpoint \
  84. -e 10.10.0.1:10.10.0.2 -c test.auto_router
  85. $(TCPREWRITE) -i test.pcap -o test2.rewrite_pnat \
  86. -N 216.27.178.0/24:172.16.0.0/24
  87. $(TCPREWRITE) -i test.pcap -o test2.rewrite_pad -F pad
  88. $(TCPREWRITE) -i test.pcap -o test2.rewrite_trunc -F trunc
  89. $(TCPREWRITE) -i test.pcap -o test2.rewrite_mac \
  90. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  91. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
  92. $(TCPREWRITE) -i test.pcap -o test2.rewrite_layer2 \
  93. --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0
  94. $(TCPREWRITE) -i test.pcap -o test2.rewrite_config --enet-vlan=add --enet-vlan-tag=45 \
  95. --enet-vlan-cfi=1 --enet-vlan-pri=5
  96. $(TCPREWRITE) -i test.pcap -o test2.rewrite_skip -b -s 55 \
  97. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  98. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
  99. $(TCPREWRITE) -i test.pcap -o test2.rewrite_dltuser --dlt=user \
  100. --user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
  101. $(TCPREWRITE) -i test.pcap -o test2.rewrite_dlthdlc --dlt=hdlc \
  102. --hdlc-control=0 --hdlc-address=0x0F
  103. $(TCPREWRITE) -i test.rewrite_config -o test2.rewrite_vlandel \
  104. --enet-vlan=del
  105. tcpprep: auto_router auto_bridge auto_client auto_server auto_first cidr regex \
  106. port mac comment print_info print_comment prep_config
  107. tcprewrite: rewrite_portmap rewrite_endpoint rewrite_pnat rewrite_trunc \
  108. rewrite_pad rewrite_seed rewrite_mac rewrite_layer2 rewrite_config \
  109. rewrite_skip rewrite_dltuser rewrite_dlthdlc rewrite_vlandel
  110. tcpreplay: replay_basic replay_cache replay_pps replay_rate replay_top \
  111. replay_config replay_multi replay_accurate
  112. prep_config:
  113. $(PRINTF) "%s" "[tcpprep] Config mode test: "
  114. $(PRINTF) "%s\n" "*** [tcpprep] Config mode test: " >>test.log
  115. $(TCPPREP) $(ENABLE_DEBUG) --load-opts=config -o test.$@1 2>>test.log
  116. diff test.$@ test.$@1 >>test.log 2>&1
  117. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  118. auto_router:
  119. $(PRINTF) "%s" "[tcpprep] Auto/Router mode test: "
  120. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Router mode test: " >>test.log
  121. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a router 2>>test.log
  122. diff test.$@ test.$@1 >>test.log 2>&1
  123. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  124. auto_bridge:
  125. $(PRINTF) "%s" "[tcpprep] Auto/Bridge mode test: "
  126. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Bridge mode test: " >>test.log
  127. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a bridge 2>>test.log
  128. diff test.$@ test.$@1 >>test.log 2>&1
  129. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  130. auto_client:
  131. $(PRINTF) "%s" "[tcpprep] Auto/Client mode test: "
  132. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Client mode test: " >>test.log
  133. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a client 2>>test.log
  134. diff test.$@ test.$@1 >>test.log 2>&1
  135. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  136. auto_server:
  137. $(PRINTF) "%s" "[tcpprep] Auto/Server mode test: "
  138. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Server mode test: " >>test.log
  139. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a server 2>>test.log
  140. diff test.$@ test.$@1 >>test.log 2>&1
  141. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  142. auto_first:
  143. $(PRINTF) "%s" "[tcpprep] Auto/First mode test: "
  144. $(PRINTF) "%s\n" "*** [tcpprep] Auto/First mode test: " >>test.log
  145. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a first 2>>test.log
  146. diff test.$@ test.$@1 >>test.log 2>&1
  147. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  148. regex:
  149. $(PRINTF) "%s" "[tcpprep] Regex mode test: "
  150. $(PRINTF) "%s\n" "*** [tcpprep] Regex mode test: " >>test.log
  151. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -r '216.27.178.*' 2>>test.log
  152. diff test.$@ test.$@1 >>test.log 2>&1
  153. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  154. cidr:
  155. $(PRINTF) "%s" "[tcpprep] CIDR mode test: "
  156. $(PRINTF) "%s\n" "*** [tcpprep] CIDR mode test: " >>test.log
  157. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '216.27.178.0/24' 2>>test.log
  158. diff test.$@ test.$@1 >>test.log 2>&1
  159. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  160. port:
  161. $(PRINTF) "%s" "[tcpprep] Port mode test: "
  162. $(PRINTF) "%s\n" "*** [tcpprep] Port mode test: " >>test.log
  163. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -p 2>>test.log
  164. diff test.$@ test.$@1 >>test.log 2>&1
  165. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  166. mac:
  167. $(PRINTF) "%s" "[tcpprep] MAC mode test: "
  168. $(PRINTF) "%s\n" "*** [tcpprep] MAC mode test: " >>test.log
  169. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -e 00:02:3b:00:3d:ce 2>>test.log
  170. diff test.$@ test.$@1 >>test.log 2>&1
  171. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  172. comment:
  173. $(PRINTF) "%s" "[tcpprep] Comment mode test: "
  174. $(PRINTF) "%s\n" "*** [tcpprep] Comment mode test: " >>test.log
  175. $(TCPPREP) $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -C "This is a comment" -p 2>>test.log
  176. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  177. print_comment:
  178. $(PRINTF) "%s" "[tcpprep] Print comment mode test: "
  179. $(PRINTF) "%s\n" "*** [tcpprep] Print comment mode test: " >>test.log
  180. $(TCPPREP) $(ENABLE_DEBUG) -P test.comment >test.$@1 2>>test.log
  181. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  182. print_info:
  183. $(PRINTF) "%s" "[tcpprep] Print info mode test: "
  184. $(PRINTF) "%s\n" "*** [tcpprep] Print info mode test: " >>test.log
  185. $(TCPPREP) $(ENABLE_DEBUG) -I test.comment >test.$@1 2>>test.log
  186. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  187. replay_basic:
  188. $(PRINTF) "%s" "[tcpreplay] Basic test: "
  189. $(PRINTF) "%s\n" "*** [tcpreplay] Basic test: " >>test.log
  190. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -t test.pcap >>test.log 2>&1
  191. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  192. replay_cache:
  193. $(PRINTF) "%s" "[tcpreplay] Cache test: "
  194. $(PRINTF) "%s\n" "*** [tcpreplay] Cache test: " >>test.log
  195. $(TCPREPLAY) $(ENABLE_DEBUG) -c test.cidr -i $(nic1) -I $(nic2) -t test.pcap >>test.log 2>&1
  196. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  197. replay_accurate:
  198. $(PRINTF) "%s" "[tcpreplay] Accurate test: "
  199. $(PRINTF) "%s\n" "*** [tcpreplay] Accurate test: " >>test.log
  200. $(TCPREPLAY) $(ENABLE_DEBUG) -a -i $(nic1) test.pcap >>test.log 2>&1
  201. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  202. rewrite_portmap:
  203. $(PRINTF) "%s" "[tcprewrite] Portmap test: "
  204. $(PRINTF) "%s\n" "*** [tcprewrite] Portmap test: " >>test.log
  205. $(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_portmap1 -r 80:8080 >>test.log 2>&1
  206. if WORDS_BIGENDIAN
  207. diff test.$@ test.$@1 >>test.log 2>&1
  208. else
  209. diff test2.$@ test.$@1 >>test.log 2>&1
  210. endif
  211. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  212. rewrite_endpoint:
  213. $(PRINTF) "%s" "[tcprewrite] Endpoint test: "
  214. $(PRINTF) "%s\n" "*** [tcprewrite] Endpoint test: " >>test.log
  215. $(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_endpoint1 -e 10.10.0.1:10.10.0.2 -c test.auto_router
  216. if WORDS_BIGENDIAN
  217. diff test.$@ test.$@1 >>test.log 2>&1
  218. else
  219. diff test2.$@ test.$@1 >>test.log 2>&1
  220. endif
  221. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  222. rewrite_pnat:
  223. $(PRINTF) "%s" "[tcprewrite] Pseudo NAT test: "
  224. $(PRINTF) "%s\n" "*** [tcprewrite] Pseudo NAT test: " >>test.log
  225. $(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_pnat1 -N 216.27.178.0/24:172.16.0.0/24
  226. if WORDS_BIGENDIAN
  227. diff test.$@ test.$@1 >>test.log 2>&1
  228. else
  229. diff test2.$@ test.$@1 >>test.log 2>&1
  230. endif
  231. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  232. rewrite_mac:
  233. $(PRINTF) "%s" "[tcprewrite] Src/Dst MAC test: "
  234. $(PRINTF) "%s\n" "*** [tcprewrite] Src/Dst MAC test: " >>test.log
  235. $(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_mac1 \
  236. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  237. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
  238. if WORDS_BIGENDIAN
  239. diff test.$@ test.$@1 >>test.log 2>&1
  240. else
  241. diff test2.$@ test.$@1 >>test.log 2>&1
  242. endif
  243. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  244. rewrite_trunc:
  245. $(PRINTF) "%s" "[tcprewrite] Truncate test: "
  246. $(PRINTF) "%s\n" "*** [tcprewrite] Truncate test: " >>test.log
  247. $(TCPREWRITE) $(ENABLE_DEBUG) -F trunc -i test.pcap -o test.rewrite_trunc1 >>test.log 2>&1
  248. if WORDS_BIGENDIAN
  249. diff test.$@ test.$@1 >>test.log 2>&1
  250. else
  251. diff test2.$@ test.$@1 >>test.log 2>&1
  252. endif
  253. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  254. rewrite_pad:
  255. $(PRINTF) "%s" "[tcprewrite] Pad test: "
  256. $(PRINTF) "%s\n" "*** [tcprewrite] Pad test: " >>test.log
  257. $(TCPREWRITE) $(ENABLE_DEBUG) -F pad -i test.pcap -o test.rewrite_pad1 >>test.log 2>&1
  258. if WORDS_BIGENDIAN
  259. diff test.$@ test.$@1 >>test.log 2>&1
  260. else
  261. diff test2.$@ test.$@1 >>test.log 2>&1
  262. endif
  263. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  264. rewrite_seed:
  265. $(PRINTF) "%s" "[tcprewrite] Seed IP test: "
  266. $(PRINTF) "%s\n" "*** [tcprewrite] Seed IP test: " >>test.log
  267. $(TCPREWRITE) $(ENABLE_DEBUG) -i test.pcap -o test.rewrite_seed1 -s 55 >>test.log 2>&1
  268. if WORDS_BIGENDIAN
  269. diff test.$@ test.$@1 >>test.log 2>&1
  270. else
  271. diff test2.$@ test.$@1 >>test.log 2>&1
  272. endif
  273. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  274. rewrite_layer2:
  275. $(PRINTF) "%s" "[tcprewrite] Layer2 test: "
  276. $(PRINTF) "%s\n" "*** [tcprewrite] Layer2 test: " >>test.log
  277. $(TCPREWRITE) $(ENABLE_DEBUG) --dlt=user --user-dlink=00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0 \
  278. -i test.pcap -o test.rewrite_layer21 >>test.log 2>&1
  279. if WORDS_BIGENDIAN
  280. diff test.$@ test.$@1 >>test.log 2>&1
  281. else
  282. diff test2.$@ test.$@1 >>test.log 2>&1
  283. endif
  284. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  285. rewrite_config:
  286. $(PRINTF) "%s" "[tcprewrite] Config/VLAN Add test: "
  287. $(PRINTF) "%s\n" "*** [tcprewrite] Config/VLAN Add test: " >>test.log
  288. $(TCPREWRITE) --load-opts config
  289. if WORDS_BIGENDIAN
  290. diff test.$@ test.$@1 >>test.log 2>&1
  291. else
  292. diff test2.$@ test.$@1 >>test.log 2>&1
  293. endif
  294. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  295. rewrite_skip:
  296. $(PRINTF) "%s" "[tcprewrite] Skip bcast test: "
  297. $(PRINTF) "%s\n" "*** [tcprewrite] Skip bcast test: " >>test.log
  298. $(TCPREWRITE) -i test.pcap -o test.rewrite_skip1 -b -s 55 \
  299. --enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66 \
  300. --enet-smac=00:22:33:44:55:66,00:12:13:14:15:16 -c test.auto_router
  301. if WORDS_BIGENDIAN
  302. diff test.$@ test.$@1 >>test.log 2>&1
  303. else
  304. diff test2.$@ test.$@1 >>test.log 2>&1
  305. endif
  306. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  307. rewrite_dltuser:
  308. $(PRINTF) "%s" "[tcprewrite] DLT User test: "
  309. $(PRINTF) "%s\n" "*** [tcprewrite] DLT User test: " >>test.log
  310. $(TCPREWRITE) -i test.pcap -o test.rewrite_dltuser1 --dlt=user \
  311. --user-dlink=0x0f,0x00,0x08,0x00 --user-dlt=104
  312. if WORDS_BIGENDIAN
  313. diff test.$@ test.$@1 >>test.log 2>&1
  314. else
  315. diff test2.$@ test.$@1 >>test.log 2>&1
  316. endif
  317. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  318. rewrite_dlthdlc:
  319. $(PRINTF) "%s" "[tcprewrite] DLT Cisco HDLC test: "
  320. $(PRINTF) "%s\n" "*** [tcprewrite] DLT Cisco HDLC test: " >>test.log
  321. $(TCPREWRITE) -i test.pcap -o test.rewrite_dlthdlc1 --dlt=hdlc \
  322. --hdlc-control=0 --hdlc-address=0x0F
  323. if WORDS_BIGENDIAN
  324. diff test.$@ test.$@1 >>test.log 2>&1
  325. else
  326. diff test2.$@ test.$@1 >>test.log 2>&1
  327. endif
  328. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  329. rewrite_vlandel:
  330. $(PRINTF) "%s" "[tcprewrite] VLAN Delete test: "
  331. $(PRINTF) "%s\n" "*** [tcprewrite] VLAN Delete test: " >>test.log
  332. $(TCPREWRITE) -i test.rewrite_config -o test.rewrite_vlandel1 \
  333. --enet-vlan=del
  334. if WORDS_BIGENDIAN
  335. diff test.$@ test.$@1 >>test.log 2>&1
  336. else
  337. diff test2.$@ test.$@1 >>test.log 2>&1
  338. endif
  339. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  340. replay_pps:
  341. $(PRINTF) "%s" "[tcpreplay] Packets/sec test: "
  342. $(PRINTF) "%s\n" "*** [tcpreplay] Packets/sec test: " >>test.log
  343. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -p 25 test.pcap >>test.log 2>&1
  344. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  345. replay_rate:
  346. $(PRINTF) "%s" "[tcpreplay] Mbps test: "
  347. $(PRINTF) "%s\n" "*** [tcpreplay] Mbps test: " >>test.log
  348. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -M 25.0 test.pcap >>test.log 2>&1
  349. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  350. replay_multi:
  351. $(PRINTF) "%s" "[tcpreplay] Multiplier test: "
  352. $(PRINTF) "%s\n" "*** [tcpreplay] Multiplier test: " >>test.log
  353. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -m 25.0 test.pcap >>test.log 2>&1
  354. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  355. replay_top:
  356. $(PRINTF) "%s" "[tcpreplay] Topspeed test: "
  357. $(PRINTF) "%s\n" "*** [tcpreplay] Topspeed test: " >>test.log
  358. $(TCPREPLAY) $(ENABLE_DEBUG) -i $(nic1) -t test.pcap >>test.log 2>&1
  359. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  360. datadump_mode:
  361. $(PRINTF) "%s" "[tcpreplay] Data dump test: "
  362. $(PRINTF) "%s\n" "*** [tcpreplay] Data dump mode test: " >>test.log
  363. $(TCPREPLAY) $(ENABLE_DEBUG) -D -i $(nic1) -j $(nic2) -w primary.data -W secondary.data -c test.cidr -R test.pcap >>test.log 2>&1
  364. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  365. replay_config:
  366. $(PRINTF) "%s" "[tcpreplay] Config file/VLAN add test: "
  367. $(PRINTF) "%s\n" "*** [tcpreplay] Config file/VLAN add test: " >>test.log
  368. $(TCPREPLAY) $(ENABLE_DEBUG) --load-opts=config test.pcap >>test.log 2>&1
  369. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  370. clean:
  371. rm -f *1 test.log core* *~ primary.data secondary.data
  372. distclean: clean
  373. rm -f Makefile config
  374. maintainer-clean: distclean