xlat 0.1.0.alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +7 -0
  3. data/.rspec +3 -0
  4. data/Cargo.lock +348 -0
  5. data/Cargo.toml +7 -0
  6. data/Dockerfile +49 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +100 -0
  9. data/Rakefile +82 -0
  10. data/benchmark/run.rb +38 -0
  11. data/benchmark/tcp.cfg +23 -0
  12. data/clab/.gitignore +5 -0
  13. data/clab/464xlat-ce-pd.clab.yml +138 -0
  14. data/clab/build.sh +6 -0
  15. data/exe/xlat-siit +91 -0
  16. data/ext/xlat/io_buffer_ext/Cargo.toml +11 -0
  17. data/ext/xlat/io_buffer_ext/extconf.rb +4 -0
  18. data/ext/xlat/io_buffer_ext/src/gvl.rs +49 -0
  19. data/ext/xlat/io_buffer_ext/src/io_buffer.rs +67 -0
  20. data/ext/xlat/io_buffer_ext/src/lib.rs +83 -0
  21. data/fuzz/corpus/010507e2c9f3b5132cbf036c7197f155cd85cca8 +0 -0
  22. data/fuzz/corpus/019a67cbfe27ed6606fe9d9cbee1ba16eb160667 +0 -0
  23. data/fuzz/corpus/021f01b7a6d4ba3e8e45a733c453d6c84f8c4c38 +0 -0
  24. data/fuzz/corpus/02db19829d1a4cbe18127e9ab1f3792e0d7fd5f7 +0 -0
  25. data/fuzz/corpus/059b719daf320e809db75d37ecf7823ba33ca7aa +0 -0
  26. data/fuzz/corpus/080ce49cbdb1983f8b9af09d511c5ec5a6bb14ed +0 -0
  27. data/fuzz/corpus/080d7d8674e7d60ce13b48995567a4ad21a3d652 +0 -0
  28. data/fuzz/corpus/08d488926f31661a1b25f60a723ae1931c762255 +0 -0
  29. data/fuzz/corpus/09ee56fb3259c88ad2cb94951313d792f36da221 +0 -0
  30. data/fuzz/corpus/0bffe4074467b5c4ba2bd5aa33839c5a1b8c1d63 +0 -0
  31. data/fuzz/corpus/0dac63180387255727c844898164ce20ff08fded +0 -0
  32. data/fuzz/corpus/0dc6f6c09c5b7bb4da8d496ac924e7e0d4aa37ad +0 -0
  33. data/fuzz/corpus/0e3e8e947fd9bfed02f927d1a2651e484d231fc0 +0 -0
  34. data/fuzz/corpus/0e5fa83f0ef8ecbf774ac96b8bdeda31395a284d +0 -0
  35. data/fuzz/corpus/12f93fa0b09c44d6c61ccde2731b5554bb180144 +0 -0
  36. data/fuzz/corpus/1659c552b9be677f2c30210430a97c3628f615be +0 -0
  37. data/fuzz/corpus/183aeabfe58d5ccfd5f2ed84e2f5ee4931f14eb7 +0 -0
  38. data/fuzz/corpus/1b9293272fbacbfff7aff4fd951dd7beb6aed3bf +0 -0
  39. data/fuzz/corpus/1c30abedb2d0943ef79b0620f7b3a7e8cdebc67f +0 -0
  40. data/fuzz/corpus/1c479cc892198d0cc389cc681206393c8ae4cbb6 +0 -0
  41. data/fuzz/corpus/1ca9480af5da2221fc320bb281d7c4ff73d5f33c +0 -0
  42. data/fuzz/corpus/1d6087f18146fac3b663bcc635fb470cb651884b +0 -0
  43. data/fuzz/corpus/258d23cbc2c8081782f0dd539270848e275a8e15 +0 -0
  44. data/fuzz/corpus/27512fa5c0ac5f4d8393ab442b50af3e83047c01 +0 -0
  45. data/fuzz/corpus/29933024f32228a8b65419d63dcbb56124db0df7 +0 -0
  46. data/fuzz/corpus/2b19339a2f24978c8413912a8003ae8ba8885684 +0 -0
  47. data/fuzz/corpus/2f8d2861a271e3ee2f658b01ef6ba854d8837aff +0 -0
  48. data/fuzz/corpus/2fed10d20fc4ed25da9cebd41209886304b39465 +0 -0
  49. data/fuzz/corpus/30fd38c3af4877eda7b1ca2dee1a60c4fe0f757c +0 -0
  50. data/fuzz/corpus/3137ba78351b6757255261a4f364e44693c3c85f +0 -0
  51. data/fuzz/corpus/34e68133b209c490f960f9682d33d41aab99e60f +0 -0
  52. data/fuzz/corpus/359870740db1c245d6dfdad1f119c7b17c3f25fc +0 -0
  53. data/fuzz/corpus/37b1bb01b0544125df396b925e2c4242a90d1c52 +0 -0
  54. data/fuzz/corpus/387cab0f8ac36f0f5496f6b0aed7d6c7ca3f2dbf +0 -0
  55. data/fuzz/corpus/3c4e48335e11c3bd066bbb43db4bf82249668869 +0 -0
  56. data/fuzz/corpus/3ec111be62099aaa9b960f4b69c65a3b12962970 +0 -0
  57. data/fuzz/corpus/3fb2f3f01b304e48d9c60477dfe5834693ef80db +0 -0
  58. data/fuzz/corpus/40cf2f11c2ea03c56864f5097d2f989b14762426 +0 -0
  59. data/fuzz/corpus/40cfc6a6a60f2451974522e5450ba6434f61a8bb +0 -0
  60. data/fuzz/corpus/4c3f43f4654332520eb57a9bcfe95951857272ce +0 -0
  61. data/fuzz/corpus/4c85fdf6934e86766274dd668f3f69f15c7bbc11 +0 -0
  62. data/fuzz/corpus/4f708dd44266b8b567e295c03811feef57c0a493 +0 -0
  63. data/fuzz/corpus/50cfff5d1cfc310686d7c1f38787cb77ec6fd892 +0 -0
  64. data/fuzz/corpus/53b2e1cb235c4479711d9ac74a375330d69f9e4c +0 -0
  65. data/fuzz/corpus/560373973be830ca5a34ab8e4d4b25a942ad5ed6 +0 -0
  66. data/fuzz/corpus/57768a4d41ccb6149219ba3eb7fe9e5b191dc4aa +0 -0
  67. data/fuzz/corpus/5a7833a1a882226aa3831298fdb0d23b580016d8 +0 -0
  68. data/fuzz/corpus/5b394ecc62e63d030cfeff7e0c484c233c7e9d63 +0 -0
  69. data/fuzz/corpus/5c10ea32f35ab603f1acd9b3c3ac3c397c1c690a +0 -0
  70. data/fuzz/corpus/5d4f6df161ce9c6465641cea9e0e97771f4249cf +0 -0
  71. data/fuzz/corpus/5f29c11e0f583226dfa98c236b8d48c772bccbf1 +0 -0
  72. data/fuzz/corpus/603d6df8d387f6b191f9b732d8928638e2deab10 +0 -0
  73. data/fuzz/corpus/60e17201e5bc64340b37ac96ff6302546c231eea +0 -0
  74. data/fuzz/corpus/65cc3e13ae39a4cd1b207a3395b5205d3fbcae7b +0 -0
  75. data/fuzz/corpus/692c3712da22c928e0d1b5f91ea7a74ba6fcdf5f +0 -0
  76. data/fuzz/corpus/69ee357cc3bda8a068bc875dda0879bb462b4984 +0 -0
  77. data/fuzz/corpus/6a2310279f4fa43ee4ed3809bc039f8ec7bfdeb4 +0 -0
  78. data/fuzz/corpus/6bfdbaafbe1d257b49f58b7a2fa3fef51894d76a +0 -0
  79. data/fuzz/corpus/6d3c4288760aaf7131fb3caebb5b3aad6a1828fd +0 -0
  80. data/fuzz/corpus/6e2f243fb0020e9bfb797c0100da18a67c8f1cb7 +0 -0
  81. data/fuzz/corpus/6ee7bf4cd8249100046bd4ba28b6646dfd436bd4 +0 -0
  82. data/fuzz/corpus/70e0947673dd1cc2680f907ecfde339688c3fadb +0 -0
  83. data/fuzz/corpus/76b1ab6e0edbfeefd4a23fc8a18f7d5937fe3787 +0 -0
  84. data/fuzz/corpus/77d6e8a03cec0da5803042fd51030e97fb11f5fd +0 -0
  85. data/fuzz/corpus/79b7efd2703e6343b8daf769aea6a76b199d7aa2 +0 -0
  86. data/fuzz/corpus/7ab28e22d79e7f2774ab2b8baaddeedf58f37475 +0 -0
  87. data/fuzz/corpus/7cb99d73cc9c03dc463a7892b27ae78a857c2450 +0 -0
  88. data/fuzz/corpus/81f5010a3c5a44639c0fbb6325c163cd5f8b7ee9 +0 -0
  89. data/fuzz/corpus/8317c66a4178b54bfd405332490dfd82a3949244 +0 -0
  90. data/fuzz/corpus/871b1e5a6ad58fbd654725c0c280f1aa278cd7b5 +0 -0
  91. data/fuzz/corpus/879bd3b24e7c968141bf3c69fdfb11da99af8e8e +0 -0
  92. data/fuzz/corpus/8a6bc02a79659eb0c71d5bc784da0f1b351b4336 +0 -0
  93. data/fuzz/corpus/8d6d41bc7e792d6737c35d7c989c9772ad3ae1d6 +0 -0
  94. data/fuzz/corpus/8ee4e2e6827b38feaa739c7a61535087ae1ca91c +0 -0
  95. data/fuzz/corpus/911a7cad153c517c75ea7d410c4f093865da5b50 +0 -0
  96. data/fuzz/corpus/932c12b633a087eff4f195da9fed03e202190515 +0 -0
  97. data/fuzz/corpus/93c883857d41e5cdaaa4c2b04dd316da73c9c519 +0 -0
  98. data/fuzz/corpus/944e31de1264ab5347f37d1454b6bcdd06b85b51 +0 -0
  99. data/fuzz/corpus/9882bea35622d45012774dbf8f9658c597f07d51 +0 -0
  100. data/fuzz/corpus/989f9271f90207d498fb69eeba16b8393f8cc70b +0 -0
  101. data/fuzz/corpus/9927a043166634231659695111b473cbd19fbeec +0 -0
  102. data/fuzz/corpus/9a33c2ce796569be8450658c6231936816ee55bb +0 -0
  103. data/fuzz/corpus/9a51def27a9547cf9aa059809a2d5482f75ae8af +0 -0
  104. data/fuzz/corpus/9b915fd1452d10a00ae2ecb0d53784a127341e79 +0 -0
  105. data/fuzz/corpus/9de518e7fb61598ac152a91feaf2d7bbe3e8b943 +0 -0
  106. data/fuzz/corpus/9eaee706fb7d021dc5f0ecc79b524de9c74f439e +0 -0
  107. data/fuzz/corpus/9ecb6bbe9d4c7414406e4c002b449279bf898ee4 +0 -0
  108. data/fuzz/corpus/a389244e26c3e525393db7c6b89495981c5160e5 +0 -0
  109. data/fuzz/corpus/a52173807baf225d705386e47e57a115a8cb537c +0 -0
  110. data/fuzz/corpus/a6fdb8761221dfd348c29c9eb224eb5cf5e4849a +0 -0
  111. data/fuzz/corpus/a76ca8a3f3ffb4ff898f896b65a5bae2d0ed002a +0 -0
  112. data/fuzz/corpus/a91ff9c074e9503baa27194d220dca03926a4f3d +0 -0
  113. data/fuzz/corpus/aa66cf1089cea0a8aa7e54394e75d4f2949bba74 +0 -0
  114. data/fuzz/corpus/aafdf57c09c20115384292e1b39cf7dae6674fff +0 -0
  115. data/fuzz/corpus/af0d6601066ec5c6bac2f0a57b5753ef2826463d +0 -0
  116. data/fuzz/corpus/b26766574788c20a8ec6927c19327f3919c7a69f +0 -0
  117. data/fuzz/corpus/b2b582043818797e2a53a72e3f24e545fbda3b57 +0 -0
  118. data/fuzz/corpus/b31e0aa5172beb560c264d8b5c84932870271e9e +0 -0
  119. data/fuzz/corpus/b396625aa6e69a5eef782446bbc09606050abb8a +0 -0
  120. data/fuzz/corpus/b5693370c14ce015236f7746ee63d0af38ec89e4 +0 -0
  121. data/fuzz/corpus/b8fd1ed5f8c575a8ac6a7c468bf93f1f96f8edb4 +0 -0
  122. data/fuzz/corpus/b928cbb72b744adec35cba73db6b09b4c0c8af42 +0 -0
  123. data/fuzz/corpus/b9e36aaac143135fadf4bbcac8d892a7b515cbaf +0 -0
  124. data/fuzz/corpus/bae2b0281a4ce082295254dd4f49183ca6b5f2d3 +0 -0
  125. data/fuzz/corpus/bfdc9d194a5a4ed98adfa14a47cec84ca91aa4ad +0 -0
  126. data/fuzz/corpus/c2f64ce75de11ecb09496d5d95955da7730872e1 +0 -0
  127. data/fuzz/corpus/c45f32e7bfa9ea837d6cdd1844d7c8d354981242 +0 -0
  128. data/fuzz/corpus/c64d7ac2a14b5227524521fab16ff0ca4e5170d6 +0 -0
  129. data/fuzz/corpus/c6f8466a86b7371cbf715317cbd313f609ee739b +0 -0
  130. data/fuzz/corpus/c9d6e62a62fffb21687fae534b8113a07f92aee6 +0 -0
  131. data/fuzz/corpus/d0171338648afb30043ea71f3561c60fd8372a1d +0 -0
  132. data/fuzz/corpus/d0faa1afa3e94f6a51a1a4c0d3dafb2600592593 +0 -0
  133. data/fuzz/corpus/d467fc34aec5d7f2b24a3df67dbf99080dc00681 +0 -0
  134. data/fuzz/corpus/d696b7b20d1cd2a3c2bf47c302afbba1696632c9 +0 -0
  135. data/fuzz/corpus/d6d7695a3c86643a3ad779b75ea4d00fb535a3d9 +0 -0
  136. data/fuzz/corpus/d7b303e5aec6bac4311102a324cbea23663b2b20 +0 -0
  137. data/fuzz/corpus/d8afc09fe51ea23526db161a2a1cdacba0b1fefe +0 -0
  138. data/fuzz/corpus/d9bb42d0a55b8a200e3dfea84ca2e6e265ef2366 +0 -0
  139. data/fuzz/corpus/da6d7c1f2a7d5b0dabe71f048c9c1624c8ebdbd9 +0 -0
  140. data/fuzz/corpus/da70dbded78bc388cd692dc36b9da4697d5b6ad2 +0 -0
  141. data/fuzz/corpus/da71cde284c9f10c6c6952e2e800558720914c30 +0 -0
  142. data/fuzz/corpus/dcdfeaf43771474c3b236ffe79e14dc78b3b09ec +0 -0
  143. data/fuzz/corpus/dcef32e091776dc98ac4a4cf951528857d0b7ce1 +0 -0
  144. data/fuzz/corpus/ddedc95cd0c2db9ad8895fb33227e3e759f57ed9 +0 -0
  145. data/fuzz/corpus/de361721e7f714ac3a55ef5839801e0bf3566b37 +0 -0
  146. data/fuzz/corpus/e1c05af770b1443f8cfeff261affb50b3c551aa0 +0 -0
  147. data/fuzz/corpus/e62f88307794127ffccadf614b7062c3e78ce5c0 +0 -0
  148. data/fuzz/corpus/e85854d63d682e0a16f9aefa477a4337dbc63f5d +0 -0
  149. data/fuzz/corpus/e86666a117e96697f7823d6d61b448a76c7c8c64 +0 -0
  150. data/fuzz/corpus/e91897c8cefdd583e1d60e6a833fab40d775cff1 +0 -0
  151. data/fuzz/corpus/eb8ed69481cf71efdac8df0759d28624f2bc40cc +0 -0
  152. data/fuzz/corpus/ee9308e841589fbabf3013d9366ac6556d82bdf9 +0 -0
  153. data/fuzz/corpus/ef2a0b39689c489d499abc4188b45fafdba66ab8 +0 -0
  154. data/fuzz/corpus/f013d9c3de8fe4958ad84c56c651031314a92e26 +0 -0
  155. data/fuzz/corpus/f19cf033be3041feeee3eefe45ba5adbf2f5d421 +0 -0
  156. data/fuzz/corpus/f1c9fa3baf1730afaa330216edcb5ba34d2590b0 +0 -0
  157. data/fuzz/corpus/f1ed8642840969d76fff003dc68e48a717050e72 +0 -0
  158. data/fuzz/corpus/f2fbe027944e00facddfcb425be9c0269fe3b8b9 +0 -0
  159. data/fuzz/corpus/f7f6ff7ec8323de5100118914bacde5b4cc81a9e +0 -0
  160. data/fuzz/corpus/fade0bf074f861cdb9013fbdd3b084a60d9ac858 +0 -0
  161. data/fuzz/corpus/fd85b215e07f3ce968a5e0b810c6d04930b533e8 +0 -0
  162. data/fuzz/corpus/fd883fb9a67accfc7c61ddda6a781677cc8efc33 +0 -0
  163. data/fuzz/corpus/fd8953a87e3026bdb15d52faa387a6d49586cd66 +0 -0
  164. data/fuzz/corpus/fe46814360987e6b9cdaebf31a8a4ec7d26125b4 +0 -0
  165. data/fuzz/corpus/ffd623a08d5c93aae2ffed33346316d76d9abf1c +0 -0
  166. data/fuzz/instrumentation.rb +13 -0
  167. data/fuzz/run +11 -0
  168. data/fuzz/test_harness.rb +38 -0
  169. data/fuzz/test_tracer.rb +16 -0
  170. data/lib/xlat/adapters/linux_tun.rb +55 -0
  171. data/lib/xlat/address_translation.rb +32 -0
  172. data/lib/xlat/address_translators/rfc6052.rb +46 -0
  173. data/lib/xlat/common.rb +13 -0
  174. data/lib/xlat/pcap.rb +48 -0
  175. data/lib/xlat/protocols/icmp/base.rb +76 -0
  176. data/lib/xlat/protocols/icmp/echo.rb +71 -0
  177. data/lib/xlat/protocols/icmp/error.rb +70 -0
  178. data/lib/xlat/protocols/icmp.rb +14 -0
  179. data/lib/xlat/protocols/ip/ipv4.rb +106 -0
  180. data/lib/xlat/protocols/ip/ipv6.rb +133 -0
  181. data/lib/xlat/protocols/ip.rb +208 -0
  182. data/lib/xlat/protocols/tcp.rb +71 -0
  183. data/lib/xlat/protocols/tcpudp.rb +52 -0
  184. data/lib/xlat/protocols/udp.rb +66 -0
  185. data/lib/xlat/protocols.rb +0 -0
  186. data/lib/xlat/rfc7915.rb +580 -0
  187. data/lib/xlat/runner.rb +51 -0
  188. data/lib/xlat/version.rb +5 -0
  189. data/lib/xlat.rb +8 -0
  190. data/sig/xlat.rbs +4 -0
  191. metadata +246 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 126ee3a81f73b95a7d4f4a60ca386ddeb3174cb38f95d9e6fee7767dc67fd3e7
4
+ data.tar.gz: 8f9ac3aede68f63bed9b284257625a8f24074f7978642d16923d38c544adfaa1
5
+ SHA512:
6
+ metadata.gz: 95afa491cdaab20b2124c7ba3d54daaa45921af230ba7417dca3446de0d611bddf10263a976423a044b4a0d7344d98bde66a64ff456fc999f20e4c37d1da407d
7
+ data.tar.gz: b68d8af403aa962e378c133b196d2c5748fc41f2925d5c3cf1658cb02b874477806d36b1f9a358e467d5cbb963374ce5a0bc16873011096d322dcacc7ff84330
data/.dockerignore ADDED
@@ -0,0 +1,7 @@
1
+ .git/
2
+ .bundle/
3
+ vendor/
4
+ clab/
5
+ tmp/
6
+
7
+ Dockerfile
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Cargo.lock ADDED
@@ -0,0 +1,348 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.3"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.69.5"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "lazy_static",
25
+ "lazycell",
26
+ "proc-macro2",
27
+ "quote",
28
+ "regex",
29
+ "rustc-hash",
30
+ "shlex",
31
+ "syn",
32
+ ]
33
+
34
+ [[package]]
35
+ name = "bitflags"
36
+ version = "2.8.0"
37
+ source = "registry+https://github.com/rust-lang/crates.io-index"
38
+ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
39
+
40
+ [[package]]
41
+ name = "cexpr"
42
+ version = "0.6.0"
43
+ source = "registry+https://github.com/rust-lang/crates.io-index"
44
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
45
+ dependencies = [
46
+ "nom",
47
+ ]
48
+
49
+ [[package]]
50
+ name = "cfg-if"
51
+ version = "1.0.0"
52
+ source = "registry+https://github.com/rust-lang/crates.io-index"
53
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
54
+
55
+ [[package]]
56
+ name = "clang-sys"
57
+ version = "1.8.1"
58
+ source = "registry+https://github.com/rust-lang/crates.io-index"
59
+ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
60
+ dependencies = [
61
+ "glob",
62
+ "libc",
63
+ "libloading",
64
+ ]
65
+
66
+ [[package]]
67
+ name = "either"
68
+ version = "1.13.0"
69
+ source = "registry+https://github.com/rust-lang/crates.io-index"
70
+ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
71
+
72
+ [[package]]
73
+ name = "glob"
74
+ version = "0.3.2"
75
+ source = "registry+https://github.com/rust-lang/crates.io-index"
76
+ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
77
+
78
+ [[package]]
79
+ name = "io_buffer_ext"
80
+ version = "0.0.0"
81
+ dependencies = [
82
+ "magnus",
83
+ "rb-sys",
84
+ ]
85
+
86
+ [[package]]
87
+ name = "itertools"
88
+ version = "0.12.1"
89
+ source = "registry+https://github.com/rust-lang/crates.io-index"
90
+ checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
91
+ dependencies = [
92
+ "either",
93
+ ]
94
+
95
+ [[package]]
96
+ name = "lazy_static"
97
+ version = "1.5.0"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
100
+
101
+ [[package]]
102
+ name = "lazycell"
103
+ version = "1.3.0"
104
+ source = "registry+https://github.com/rust-lang/crates.io-index"
105
+ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
106
+
107
+ [[package]]
108
+ name = "libc"
109
+ version = "0.2.169"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
112
+
113
+ [[package]]
114
+ name = "libloading"
115
+ version = "0.8.6"
116
+ source = "registry+https://github.com/rust-lang/crates.io-index"
117
+ checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
118
+ dependencies = [
119
+ "cfg-if",
120
+ "windows-targets",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "magnus"
125
+ version = "0.7.1"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
128
+ dependencies = [
129
+ "magnus-macros",
130
+ "rb-sys",
131
+ "rb-sys-env",
132
+ "seq-macro",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "magnus-macros"
137
+ version = "0.6.0"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
140
+ dependencies = [
141
+ "proc-macro2",
142
+ "quote",
143
+ "syn",
144
+ ]
145
+
146
+ [[package]]
147
+ name = "memchr"
148
+ version = "2.7.4"
149
+ source = "registry+https://github.com/rust-lang/crates.io-index"
150
+ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
151
+
152
+ [[package]]
153
+ name = "minimal-lexical"
154
+ version = "0.2.1"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
157
+
158
+ [[package]]
159
+ name = "nom"
160
+ version = "7.1.3"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
163
+ dependencies = [
164
+ "memchr",
165
+ "minimal-lexical",
166
+ ]
167
+
168
+ [[package]]
169
+ name = "proc-macro2"
170
+ version = "1.0.93"
171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
172
+ checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
173
+ dependencies = [
174
+ "unicode-ident",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "quote"
179
+ version = "1.0.38"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
182
+ dependencies = [
183
+ "proc-macro2",
184
+ ]
185
+
186
+ [[package]]
187
+ name = "rb-sys"
188
+ version = "0.9.110"
189
+ source = "registry+https://github.com/rust-lang/crates.io-index"
190
+ checksum = "56cf964f8e44115e50009921ea3d3791b6f74d1ae6d6ed37114fbe03a1cd7308"
191
+ dependencies = [
192
+ "rb-sys-build",
193
+ ]
194
+
195
+ [[package]]
196
+ name = "rb-sys-build"
197
+ version = "0.9.110"
198
+ source = "registry+https://github.com/rust-lang/crates.io-index"
199
+ checksum = "161480347f56473107d4135643b6b1909331eec61445e113b256708a28b691c5"
200
+ dependencies = [
201
+ "bindgen",
202
+ "lazy_static",
203
+ "proc-macro2",
204
+ "quote",
205
+ "regex",
206
+ "shell-words",
207
+ "syn",
208
+ ]
209
+
210
+ [[package]]
211
+ name = "rb-sys-env"
212
+ version = "0.1.2"
213
+ source = "registry+https://github.com/rust-lang/crates.io-index"
214
+ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
215
+
216
+ [[package]]
217
+ name = "regex"
218
+ version = "1.11.1"
219
+ source = "registry+https://github.com/rust-lang/crates.io-index"
220
+ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
221
+ dependencies = [
222
+ "aho-corasick",
223
+ "memchr",
224
+ "regex-automata",
225
+ "regex-syntax",
226
+ ]
227
+
228
+ [[package]]
229
+ name = "regex-automata"
230
+ version = "0.4.9"
231
+ source = "registry+https://github.com/rust-lang/crates.io-index"
232
+ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
233
+ dependencies = [
234
+ "aho-corasick",
235
+ "memchr",
236
+ "regex-syntax",
237
+ ]
238
+
239
+ [[package]]
240
+ name = "regex-syntax"
241
+ version = "0.8.5"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
244
+
245
+ [[package]]
246
+ name = "rustc-hash"
247
+ version = "1.1.0"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
250
+
251
+ [[package]]
252
+ name = "seq-macro"
253
+ version = "0.3.5"
254
+ source = "registry+https://github.com/rust-lang/crates.io-index"
255
+ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
256
+
257
+ [[package]]
258
+ name = "shell-words"
259
+ version = "1.1.0"
260
+ source = "registry+https://github.com/rust-lang/crates.io-index"
261
+ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
262
+
263
+ [[package]]
264
+ name = "shlex"
265
+ version = "1.3.0"
266
+ source = "registry+https://github.com/rust-lang/crates.io-index"
267
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
268
+
269
+ [[package]]
270
+ name = "syn"
271
+ version = "2.0.98"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
274
+ dependencies = [
275
+ "proc-macro2",
276
+ "quote",
277
+ "unicode-ident",
278
+ ]
279
+
280
+ [[package]]
281
+ name = "unicode-ident"
282
+ version = "1.0.16"
283
+ source = "registry+https://github.com/rust-lang/crates.io-index"
284
+ checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
285
+
286
+ [[package]]
287
+ name = "windows-targets"
288
+ version = "0.52.6"
289
+ source = "registry+https://github.com/rust-lang/crates.io-index"
290
+ checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
291
+ dependencies = [
292
+ "windows_aarch64_gnullvm",
293
+ "windows_aarch64_msvc",
294
+ "windows_i686_gnu",
295
+ "windows_i686_gnullvm",
296
+ "windows_i686_msvc",
297
+ "windows_x86_64_gnu",
298
+ "windows_x86_64_gnullvm",
299
+ "windows_x86_64_msvc",
300
+ ]
301
+
302
+ [[package]]
303
+ name = "windows_aarch64_gnullvm"
304
+ version = "0.52.6"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
307
+
308
+ [[package]]
309
+ name = "windows_aarch64_msvc"
310
+ version = "0.52.6"
311
+ source = "registry+https://github.com/rust-lang/crates.io-index"
312
+ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
313
+
314
+ [[package]]
315
+ name = "windows_i686_gnu"
316
+ version = "0.52.6"
317
+ source = "registry+https://github.com/rust-lang/crates.io-index"
318
+ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
319
+
320
+ [[package]]
321
+ name = "windows_i686_gnullvm"
322
+ version = "0.52.6"
323
+ source = "registry+https://github.com/rust-lang/crates.io-index"
324
+ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
325
+
326
+ [[package]]
327
+ name = "windows_i686_msvc"
328
+ version = "0.52.6"
329
+ source = "registry+https://github.com/rust-lang/crates.io-index"
330
+ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
331
+
332
+ [[package]]
333
+ name = "windows_x86_64_gnu"
334
+ version = "0.52.6"
335
+ source = "registry+https://github.com/rust-lang/crates.io-index"
336
+ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
337
+
338
+ [[package]]
339
+ name = "windows_x86_64_gnullvm"
340
+ version = "0.52.6"
341
+ source = "registry+https://github.com/rust-lang/crates.io-index"
342
+ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
343
+
344
+ [[package]]
345
+ name = "windows_x86_64_msvc"
346
+ version = "0.52.6"
347
+ source = "registry+https://github.com/rust-lang/crates.io-index"
348
+ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
data/Cargo.toml ADDED
@@ -0,0 +1,7 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/xlat/io_buffer_ext"]
7
+ resolver = "2"
data/Dockerfile ADDED
@@ -0,0 +1,49 @@
1
+ ARG RUBY=public.ecr.aws/sorah/ruby:3.4-dev
2
+ ARG RUBY_DEV=public.ecr.aws/sorah/ruby:3.4-dev-noble
3
+
4
+ FROM $RUBY_DEV AS build
5
+
6
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
7
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
8
+ apt-get update && \
9
+ apt-get install -y clang cargo
10
+
11
+ WORKDIR /app
12
+ COPY . .
13
+
14
+ RUN bundle config set --local deployment true
15
+ RUN bundle install
16
+
17
+ RUN bundle exec rake compile
18
+
19
+
20
+ ###
21
+
22
+ FROM $RUBY
23
+
24
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
25
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
26
+ apt-get update && \
27
+ apt-get install -y ubuntu-dbgsym-keyring
28
+
29
+ RUN <<NUR
30
+ . /etc/os-release
31
+ cat <<EOF > /etc/apt/sources.list.d/ddebs.sources
32
+ Types: deb
33
+ URIs: http://ddebs.ubuntu.com
34
+ Suites: ${VERSION_CODENAME} ${VERSION_CODENAME}-updates ${VERSION_CODENAME}-proposed
35
+ Components: main restricted universe multiverse
36
+ EOF
37
+ NUR
38
+
39
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
40
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
41
+ apt-get update && \
42
+ apt-get install -y iproute2 nftables debian-goodies elfutils dctrl-tools && \
43
+ find-dbgsym-packages --install /usr/bin/ruby
44
+
45
+ COPY --from=build /app /app
46
+ COPY --from=build /app/.bundle /app/.bundle
47
+
48
+ ENV BUNDLE_GEMFILE=/app/Gemfile
49
+ ENTRYPOINT ["bundle", "exec", "ruby", "/app/exe/xlat-siit"]
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Sorah Fukumori
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Xlat
2
+
3
+ Userland NAT64 implementation on Linux in Ruby.
4
+
5
+ ## Supported usage
6
+
7
+ - Stateless NAT64 - [RFC 7915](https://datatracker.ietf.org/doc/rfc7915/)
8
+ - Maps 1 IPv6 Address : 1 IPv4 Address
9
+ - Combine with kernel netfilter NAT66 masquerade to archieve stateful NAT64 NAPT functionality (multiple IPv6 address/port : 1 IPv4 Address)
10
+ - `IPv6(src=nat66outer, dst=pref64n+ipv4) -> IPv4(src=ipv4nat64outer, dst=ipv4)`
11
+ - `IPv4(src=ipv4, dst=ipv4nat64outer) -> IPv6(src=pref64n+ipv4, dst=nat66outer)`
12
+
13
+ <!--
14
+ ### Todo?
15
+
16
+ - Stateful NAT64 - [RFC 6146](https://datatracker.ietf.org/doc/rfc6146/)
17
+ - Maps multiple IPv6 addresses and ports : IPv4 addresses and ports
18
+ -->
19
+
20
+ ## Installation
21
+
22
+ ```ruby
23
+ # Gemfile
24
+ source 'https://rubygems.org'
25
+ gem 'xlat'
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ TODO: Write usage instructions here
31
+
32
+ ## Caveats
33
+
34
+ - Expecting no difference in IPv4 and IPv6 MTU
35
+ - Fragmented packets are silently discarded
36
+
37
+ ## Tips
38
+
39
+ ### Checksum Neutrality
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+
45
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+
47
+ ### Benchmarking
48
+
49
+ Requires: iproute2, trafgen&ifpps from [netsniff-ng](http://netsniff-ng.org/) (v0.6.8 of netsniff-ng has [a bug](https://github.com/netsniff-ng/netsniff-ng/pull/233) and you need to build the development version).
50
+
51
+ The `benchmark/` directory has `trafgen` scenarios to generate artificial traffic to benchmark Xlat.
52
+
53
+ ```shell
54
+ sudo XLAT_PROFILE=1 XLAT_NOJIT=1 ruby ./benchmark/run.rb ./benchmark/tcp.cfg
55
+ # or if your ruby is managed by rbenv
56
+ sudo XLAT_PROFILE=1 XLAT_NOJIT=1 "$(rbenv which ruby)" ./benchmark/run.rb ./benchmark/tcp.cfg
57
+ ```
58
+
59
+ If `XLAT_PROFILE` variable is set, profile is emitted every 10 seconds at `/tmp/xlat-#{pid}.pf2profile`. You need to disable YJIT by setting `XLAT_NOJIT` variable due to the current limitation of Pf2.
60
+
61
+ ### Profiling with Pf2 in Docker
62
+
63
+ Requires: Docker, containerlab, iproute2, iperf3.
64
+
65
+ ```shell
66
+ cd clab/
67
+ ./build
68
+ containerlab deploy --reconfigure
69
+ sudo ip netns exec clab-464xlat-ue-pd-sv iperf3 -s
70
+
71
+ # in another session:
72
+ sudo ip netns exec clab-464xlat-ue-pd-ue iperf3 -c 64:ff9b::192.0.2.80
73
+ docker kill --signal=USR1 clab-464xlat-ue-pd-plat
74
+ docker cp clab-464xlat-ue-pd-plat:/tmp/xlat-1.pf2profile .
75
+ pf2 report ./xlat-1.pf2profile -o ./xlat.json
76
+ ```
77
+
78
+ ### Fuzzing
79
+
80
+ Requires: CRuby built with clang compiler.
81
+
82
+ `fuzz/run` performs fuzzing against the parsers and `Xlat::Rfc7915` translator.
83
+
84
+ ```shell
85
+ ./fuzz/run
86
+ ```
87
+
88
+ ## Contributing
89
+
90
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/xlat.
91
+
92
+ ## License
93
+
94
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
95
+
96
+ ### Credits
97
+
98
+ - Copyright (c) 2024 Sorah Fukumori
99
+ - Copyright (c) 2022 Kazuho Oku
100
+ - Some part of this source code are based on the source code at https://github.com/kazuho/rat available under MIT License
data/Rakefile ADDED
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rake/extensiontask"
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: :spec
10
+
11
+ Rake::ExtensionTask.new("xlat/io_buffer_ext",
12
+ Gem::Specification.load("xlat.gemspec")) do |ext|
13
+ ext.lib_dir = "lib/xlat"
14
+ end
15
+
16
+ task spec: :compile
17
+
18
+
19
+ directory 'doc'
20
+
21
+ file 'doc/test_packets.xml' => ['doc', 'spec/test_packets.rb', 'Rakefile'] do |f|
22
+ require 'open3'
23
+ require 'pathname'
24
+ require 'rexml'
25
+ require 'xlat/pcap'
26
+ require_relative './spec/test_packets'
27
+
28
+ packets = TestPackets.constants.filter_map {|k|
29
+ val = TestPackets.const_get(k)
30
+ next unless val.is_a?(IO::Buffer)
31
+
32
+ {
33
+ name: k,
34
+ source_location: TestPackets.const_source_location(k).yield_self {|path, line|
35
+ [Pathname(path).relative_path_from(__dir__), line]
36
+ },
37
+ value: val,
38
+ }
39
+ }.sort_by { _1[:source_location] }
40
+
41
+ opts = {
42
+ 'tcp.check_checksum' => 'TRUE',
43
+ 'udp.check_checksum' => 'TRUE',
44
+ 'ip.check_checksum' => 'TRUE',
45
+ }.map {|k, v| "-o#{k}:#{v}" }
46
+ pdml = Open3.popen2(*%W[tshark -n -r- -Tpdml], *opts) do |stdin, stdout, *|
47
+ pcap = Xlat::Pcap.new(stdin)
48
+ packets.each do |h|
49
+ pcap.write(h[:value], ts: Time.at(0))
50
+ end
51
+ stdin.close
52
+
53
+ xml = REXML::Document.new(stdout)
54
+
55
+ xml.get_elements('//packet').zip(packets) do |e_packet, pkt|
56
+ comment = "#{pkt[:name]} at #{pkt[:source_location].join(?:)}"
57
+
58
+ e_packet.unshift(
59
+ REXML::Element.new('proto').tap {|e_field|
60
+ e_field.add_attribute('name', 'pkt_comment')
61
+ e_field.add_attribute('pos', 0)
62
+ e_field.add_attribute('size', 0)
63
+ e_field.add_attribute('showname', comment)
64
+ },
65
+ )
66
+ end
67
+
68
+ File.write(f.name, xml.to_s)
69
+ end
70
+ end
71
+
72
+ file 'doc/pdml2html.xsl' => ['doc'] do |f|
73
+ require 'net/http'
74
+ require 'uri'
75
+
76
+ uri = URI.parse('https://gitlab.com/wireshark/wireshark/-/raw/v4.4.0/resources/share/doc/wireshark/pdml2html.xsl').freeze
77
+
78
+ File.write(f.name, Net::HTTP.get(uri))
79
+ end
80
+
81
+ desc 'Generate documents'
82
+ task gendoc: %w[doc/test_packets.xml doc/pdml2html.xsl]
data/benchmark/run.rb ADDED
@@ -0,0 +1,38 @@
1
+ warn 'Run as root!!!!!' if Process.euid != 0
2
+
3
+ require 'securerandom'
4
+
5
+ @iface = "tun-xlat-#{SecureRandom.hex(3)}"
6
+ @trafgen_cfg = File.expand_path(ARGV.shift)
7
+ fail "#{@trafgen_cfg} not found" unless File.exist?(@trafgen_cfg)
8
+
9
+ Dir.chdir(File.expand_path('..', __dir__))
10
+
11
+ xlat = spawn(*%W[#{RbConfig.ruby} -I./lib ./exe/xlat-siit #@iface 2001:db8:66:d1e0::/96 64:ff9b::/96], %i[out err] => '/tmp/xlat.log')
12
+
13
+ th = Thread.new do
14
+ loop do
15
+ sleep 10
16
+ Process.kill(:USR1, xlat)
17
+ end
18
+ rescue Errno::ESRCH
19
+ end
20
+
21
+ begin
22
+ sleep 1 until system(*%W[ip link show dev #{@iface}])
23
+
24
+ system(*%W[ip link set up dev #{@iface}])
25
+
26
+ trafgen = spawn(*%W[trafgen -P 1 -i #{@trafgen_cfg} -o #{@iface}], %i[out err] => '/tmp/trafgen.log')
27
+ begin
28
+ system(*%W[ifpps -t 10000 -d #{@iface}])
29
+ ensure
30
+ Process.kill(:KILL, trafgen)
31
+ Process.wait(trafgen)
32
+ end
33
+ ensure
34
+ Process.kill(:KILL, xlat)
35
+ Process.wait(xlat)
36
+ th.kill
37
+ th.join
38
+ end
data/benchmark/tcp.cfg ADDED
@@ -0,0 +1,23 @@
1
+ # Simulates TCP download and upload traffic, checksum neutral prefixes
2
+
3
+ {
4
+ ip6(sa=2001:db8:66:d1e0::c0a8:1, da=64:ff9b::c000:250),
5
+ tcp(sp=60000, dp=80, ack),
6
+ }
7
+
8
+ {
9
+ ip4(sa=192.0.2.80, da=192.168.0.1),
10
+ tcp(sp=80, dp=60000),
11
+ fill(0x20, 1460),
12
+ }
13
+
14
+ {
15
+ ip6(sa=2001:db8:66:d1e0::c0a8:1, da=64:ff9b::c000:250),
16
+ tcp(sp=60010, dp=80),
17
+ fill(0x20, 1440),
18
+ }
19
+
20
+ {
21
+ ip4(sa=192.0.2.80, da=192.168.0.1),
22
+ tcp(sp=80, dp=60010, ack),
23
+ }