Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ネットワーク機器の中の OCaml

Masayuki Mizuno
January 25, 2024
590

ネットワーク機器の中の OCaml

第五回関数型プログラミング(仮)の会発表スライド

Masayuki Mizuno

January 25, 2024
Tweet

Transcript

  1. ࠓ೔࿩͢͜ͱ ؔ਺ܕݴޠ OCaml ͕࢖ΘΕ͍ͯΔ OSS ͷ঺հ • ωοτϫʔΫ OS VyOS

    VyOS ಺ͰͲͷΑ͏ʹ OCaml ͕࢖ΘΕ͍ͯΔ͔ • ઃఆϑΝΠϧͷॲཧܥ • ஋ͷόϦσʔλ © 2023 Wantedly, Inc. VyOS ͸झຯͰ࢖͍ͬͯΔ͚ͩͰɺۀ຿ͷ࿩͸ग़͖ͯ·ͤΜ
  2. VyOS ͱ͸ ΦʔϓϯιʔεͷωοτϫʔΫ OS • Debian ϕʔε • Vyatta ແঈ൛ͷϑΥʔΫ

    • ϕΞϝλϧ্͚ͩͰͳ͘ɺԾ૝Խج൫΍Ϋϥ΢υ্Ͱͷಈ࡞΋αϙʔτ ۀ຿༻ϧʔλ૬౰ͷػೳΛඋ͑Δ • OSPFɺBGP4+ ౳ͷϧʔςΟϯάϓϩτίϧ • IPsecɺSSL ౳ʹجͮ͘ VPN ػೳ • VRF-lite ʹΑΔϧʔλԾ૝Խ © 2023 Wantedly, Inc.
  3. എܠ: VyOS ͷΞʔΩςΫνϟ Linux ͷػߏ΍ OSS Λ૊Έ߹ΘͤͯछʑͷػೳΛఏڙ • VyOS ͷઃఆϑΝΠϧΛ֤छιϑτͷͦΕʹม׵

    © 2023 Wantedly, Inc. vyconf FRR strongSwan iptables … ݸผͷઃఆϑΝΠϧ VyOS ͷઃఆϑΝΠϧ
  4. ͲͷΑ͏ʹ OCaml ͕࢖ΘΕ͍ͯΔ͔ ઃఆϑΝΠϧͷॲཧܥ • ߏจղੳ΍ AST ͷૢ࡞ͷͨΊͷϥΠϒϥϦ࣮૷ʹ࢖ΘΕ͍ͯΔ • ࣮ࡍͷίʔυੜ੒͸

    OCaml Ͱॻ͔ΕͨϥΠϒϥϦΛ࢖ͬͯ Python Ͱ࣮૷ ઃఆ஋ͷόϦσʔλ • ೖྗ஋͕ਖ਼͍͠ IPv6 ΞυϨεʹͳ͍ͬͯΔ͔౳ • ߴ଎ԽͷͨΊʹݩʑ Python Ͱॻ͔Ε͍ͯͨόϦσʔλΛஔ͖׵͍͑ͯΔ © 2023 Wantedly, Inc.
  5. OCaml Ͱॻ͔ΕͨίʔυΛಡΉ (1/2) © 2023 Wantedly, Inc. ϰΝϦΞϯτΛ׆༻ͯ͠ AST ౳͕ఆٛ͞Ε͍ͯΔ

    https://github.com/vyos/vyconf/blob/dd9271b4304c6b1a5a2576821d1b2b8fd3aa6bf5/src/ vytree.ml#L1-L7
  6. OCaml Ͱॻ͔ΕͨίʔυΛಡΉ (2/2) © 2023 Wantedly, Inc. ύλʔϯϚονΛ࢖ͬͯ AST ͷૢ࡞͕࣮૷͞Ε͍ͯΔ

    https://github.com/vyos/vyconf/blob/dd9271b4304c6b1a5a2576821d1b2b8fd3aa6bf5/src/ vytree.ml#L22-L30
  7. ·ͱΊ ωοτϫʔΫ OS ͷ VyOS ಺Ͱ͸ OCaml ͕࢖ΘΕ͍ͯΔ • ઃఆϑΝΠϧͷॲཧܥ

    • ֤छ஋ͷόϦσʔλ ҙ֎ͳॴʹ΋ؔ਺ܕݴޠͷً͚Δ৔໘͕͋Δ • ϰΝϦΞϯτ΍ύλʔϯϚονͷԸܙͰݴޠॲཧܥΛ؆୯ʹ࣮૷Ͱ͖Δͷ͕ڧ͍ • DSL ΋ؚΊΕ͹ɺݴޠॲཧܥͷԠ༻ൣғ͸޿͍ © 2023 Wantedly, Inc.