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

階層独立性の高いプロトコルスタックの設計と実装

 階層独立性の高いプロトコルスタックの設計と実装

2019年3月22日に行われた「第8期サイボウズ・ラボユース成果発表会」にて使用したスライド(一部変更あり)

Hiroki Watanabe (nelio)

March 22, 2019
Tweet

More Decks by Hiroki Watanabe (nelio)

Other Decks in Programming

Transcript

  1. • OFMJP - 5XJUUFS!@@OFMJP@@ - )1https://negli0.github.io - ݱࡏܚጯٛक़େֶ% - ϝϯλʔޫ੒͞Μ

    • ݚڀ෼໺/FUXPSL4ZTUFN - &EHF$PNQVUJOH 4FSWJDF$IBJOJOH - "EWBODFE3PVUJOHɼ1SPUPDPM4UBDL झຯ 2 )JSPLJ8BUBOBCF
  2. • ೥͘Β͍ເ૝ͯͨ͠ϞϊΛ࡞Δ - ֊૚ಠཱੑͷߴ͍ϓϩτίϧελοΫlFYMBZz • ΧʔωϧϓϩάϥϛϯάΛ͍ͨ͠ - ΄ͱΜͲ΍ͬͨ͜ͱ͕ͳ͔ͬͨͷͰ • ϥϘϢʔεલ൒͸Χʔωϧ͹͔ͬ৮ͬͯͨ

    • ޙ൒͸Ϣʔβۭؒʢ1P$ʣ࣮૷ - ͋ͱ͸ݚڀͷࢹ໺Λ޿͛ΔͨΊ • ࣮૷υϦϒϯͳݚڀͱͯ͠Ґஔ͚ͮΔ - ීஈ͸ݚڀυϦϒϯͳ࣮૷ • ࣮૷υϦϒϯͰ͖Δͱָͦ͠͏ Ͱ͖ͨ΄͏͕ྑ͍ 3 ϥϘϢʔεʹ͓͚Δୡ੒໨ඪ
  3. • ݱࡏͷϓϩτίϧελοΫ ҎԼ୯ʹελοΫ  - ϓϩτίϧͷػೳͱ֊૚͕ີ݁߹ ϞϊϦγοΫ  • FH

    &UIFSOFU͸ୈ֊ɼ*1͸ୈ֊ɼʜ - طʹఆٛ͞Εͨ֊૚ߏ଄Λར༻͢ΔϞσϧ • ֤ϓϩτίϧͷػೳͱ֊૚಺ҐஔΛ෼཭ - ֊૚ಠཱੑ͕ߴ͘ͳΔ • ϓϩτίϧػೳͱ֊૚಺Ґஔͷؔ܎͕رബʹ - ϓϩτίϧͷ֓೦Λ͋Δఔ౓·ͰҰൠԽͰ͖Δ • ػೳ͕ҟͳΔ͚ͩͰஔ͖׵͑Մೳ 4 ͸͡Ίʹ
  4. 5 Πϝʔδ Prot. W Prot. X Prot. Z App. App.

    App. Prot. Y Prot. X Prot. W Prot. Y Prot. Z App. App. App. Prot. Y Prot. Z Prot. X Prot. W Prot. Y Prot. W Prot. Z Prot. W Prot. X ϞϊϦγοΫͳελοΫ ֊૚ಠཱੑ͕ߴ͍ελοΫ ֤ϓϩτίϧΛͲ͜ʹҐஔ͚ͮΔ͔ "QQ͝ͱʹҧͬͯ΋ྑ͍
  5. • ϓϩτίϧ֓೦ͷҰൠԽ - ஔ͖׵͑Մೳɼػೳ͕֊૚಺ҐஔʹറΒΕͳ͍ • FH *1͚ͩΛผͷ-ϓϩτίϧʹஔ͖׵͑ • FH ಠࣗͷελοΫΛఆٛՄೳ

    - ੍໿ϓϩτίϧಠࣗͷૢ࡞͕೉͘͠ͳΔ • ϓϩτίϧ࣮૷ͷ࠶ར༻ - ϓϩτίϧ͕ΞϓϦʹ౷߹͞Εͳ͍ˠ࢖͍ճ͠ • ٯʹݴ͑͹ΞϓϦ͝ͱʹ࠷దԽ͸Ͱ͖ͳ͍ - ৽ͨͳಠࣗϓϩτίϧͷ࣮ݧ͕༰қ • Ұ౓࡞Ε͹্Ґ૚ԼҐ૚ΛվΊͯ࡞Βͳͯ͘ྑ͍ 6 ֊૚ಠཱੑΛߴΊΔՁ஋
  6. • 04*ࢀরϞσϧΛ࣮૷͠Α͏ͱͨ͠ - ֤૚಺ͷ*'͸ڞ௨ • ͋ΒΏΔ-ϓϩτίϧ͸
 ڞ௨*'Ͱ-ϓϩτίϧͱ
 ΍ΓऔΓՄೳ - ֤૚ؒͷ*'͸ผ෺

    • --*'ͱ--*'͸ผ 8 ؔ࿈ٕज़4ZTUFN7453&".4 • Transport Provider Interface Specification ◦ http://www.openss7.org/docs/tpi.pdf • Network Provider Interface Specification ◦ http://www.openss7.org/docs/npi.pdf • Datalink Provider Interface Specification ◦ http://www.openss7.org/docs/dlpi.pdf Layer 1 Layer 2 Layer 3 Layer 4 Layer 7 ... L1-L2 I/F L2-L3 I/F L3-L4 I/F ϓϩτίϧ͕֊૚Ґஔʹଋറ͞Ε͍ͯΔͱ͍͑Δ
  7. • ૚ͷந৅Խߏ଄ छͷ*'  - ߴ౓Ͱ༏Εͨந৅Խ - 1SPUPDPM1SPUPDPM*'͸ෆఆ • 'SFF#4%͸protosw

    Ͱ
 ந৅Խ • -JOVY͸ʜʁ • Ұൠʹ֊૚ߏ଄͸੩తఆٛ - ౰વܾΊଧͪ͢Δ΄͏͕ߴ଎ 9 ؔ࿈ٕज़#4%4PDLFU Driver Socket App Protocol-Driver I/F Protocol Stack App.-Socket I/F Socket-Protocol I/F Protocol
  8. • 1SPUPDPM1SPUPDPM*'ͷந৅Խ - "QQY,FSOFMɼ
 Y,FSOFM%SJDFS΋ந৅Խ - 453&".4ͱ#4%4PDLFU
 ͷ͍͍ͱ͜औΓΛ໨ࢦͨ͠ • ֊૚ߏ଄͸΍΍੩తఆٛ

    - ఆٛΛมߋ͢Δʹ͸
 ΧʔωϧίϯύΠϧ͕ඞཁ - ଟ༷ͳελοΫΛදݱՄೳ 10 ؔ࿈ٕज़x,FSOFM Driver App x-Kernel-Driver I/F App.-x-Kernel I/F Protocol-Protocol I/F x-Kernel /$)VUDIJOTPOBOE--1FUFSTPO 5IFY,FSOFMBOBSDIJUFDUVSFGPSJNQMFNFOUJOHOFUXPSLQSPUPDPMT JO*&&& 5SBOTBDUJPOTPO4PGUXBSF&OHJOFFSJOH WPM OP QQ +BO࿦จ63-
  9. • Y,FSOFMΛࠓ෩ʹϦΞϨϯδ - $-*ͰϓϩτίϧΛFYMBZTUBDLʹϩʔυ - ϩʔυ͞ΕͨϓϩτίϧΛ༻͍ͯ"QQ͕
 ελοΫΛఆٛ • ϓϩτίϧ࣮૷ -

    TIBSFEMJCSBSZ • 1P$͸ͬͪ͜ - LFSOFMNPEVMF • ࠓޙ࣮ݱ͍ͨ͠ 11 FYMBZ Driver App exlay-Driver I/F App.-exlay I/F Protocol-Protocol I/F exlay stack Protocol List CLI
  10. • ϓϩτίϧ։ൃͷͨΊͷ਽ܗ - OBNFϓϩτίϧ໊ - IES@TJ[FϔομαΠζ - VQQFS@TJ[F্Ґ૚*%αΠζ • JQQSPUPDPM

    • FUIFSOFUUZQF - E@JOQVUE@PVUQVU • ड৴ૹ৴ϋϯυϥ - D@QVMMD@QVTI • $1MBOFϋϯυϥ 12 ந৅ԽϓϩτίϧQSPUPDPMPCK name d_input d_output c_pull c_push hdr_size bind_size upper_size dial listen close - EJBMMJTUFODMPTF • ελοΫཱ֬ղ์ϋϯυϥ ͕͜͜؊ɼ͔ͭ·ͩෆे෼ͳͷͰߟ͑ଓ͚Δ
  11. root ethernet ipv4 arp uplyr mac1 upper1 mac1 upper2 fbind

    fbind uplyr fp is_top ip1 upper3 ip1 upper4 fbind is_top fbind udp uplyr fbind port1 upper5 is_top • FYMBZͷΤϯυϙΠϯτΛಛఆ͢Δ໦ 13 CJOEJOHUSFF GCJOE QUSUPGPSXBSECJOEJOH  ݱ֊૚಺ͷ౰֘ϓϩτίϧͷ MPDBMCJOEJOHͷϦετΛࢦ͢ GQ QUSUPGPSXBSEQSPUP  ݱ֊૚಺ͷϓϩτίϧͷ ϦετΛࢦ͢ VQMZS QUSUPVQQFSMBZFS  ݱ֊૚ʹ͓͍ͯಛఆ͞Εͨ
 MPDBMCJOEJOHͷ্Ґ૚ ϓϩτίϧͷϦετΛࢦ͢
  12. 14 FYMBZ"1*ͱ࣮૷ঢ়گ ؔ਺໊ ಈ࡞ ࣮૷ঢ়گ FY@DSFBUF@TUBDL ελοΫΛએݴॳظԽ ✔ FY@TFU@CJOEJOH MPDBMͷ*1BEES

    QPSUͳͲͷઃఆ ✔ FY@TFU@SFNPUF SFNPUFͷ*1BEES QPSUͳͲͷઃఆ ✔ FY@CJOE@TUBDL ελοΫΛఆٛ ✔ FY@EJBM@TUBDL $0SJFOUFEͳϓϩτίϧͷ઀ଓཁٻ FY@MJTUFO@TUBDL $0SJFOUFEͳϓϩτίϧͷ઀ଓԠ౴ FY@TFOE@TUBDL ఆٛͨ͠ελοΫʹσʔλΛૹ৴ ✔ FY@SFDW@TUBDL ఆٛͨ͠ελοΫ͔ΒσʔλΛड৴ ✔ FY@DMPTF@TUBDL ఆٛͨ͠ελοΫΛղ์
  13. • τϯωϧΤϯυϙΠϯτΛ࡞Δ - ݱঢ়VOEFSMBZ͔Βࢦఆ͠ͳ͍ͱ͍͚ͳ͍ • τϯωϦϯάͰ͸ͳ͍ʜ • ֤ϓϩτίϧͷॆ࣮ͱ$1MBOFରԠ - ૊Έ߹ΘͤΔϓϩτίϧ͕ແ͍ͱແҙຯ

    • Χʔωϧ಺ಈ࡞ - TIBSFEMJCˠLFSOFMNPEVMF - 'SFF#4%಺Ͱಈ͔͍ͨ͠ • QSPUPTX NCVGΛྲྀ༻͍ͨ͠ 18 ࠓޙͷల๬
  14. • ݱࡏͷϓϩτίϧελοΫ - ϓϩτίϧͷػೳͱ֊૚͕ີ݁߹ • FYMBZϓϩτίϧͷػೳͱ֊૚಺ҐஔΛ෼཭ - ֊૚ಠཱੑ͕ߴ͘ͳΔ • ύζϧͷΑ͏ʹϢʔβ͕ελοΫΛఆٛͰ͖Δ

    - ϓϩτίϧͷ֓೦Λ͋Δఔ౓·ͰҰൠԽͰ͖Δ • σϞ - ࣗ࡞ϓϩτίϧΛ༻͍ͨಠࣗελοΫΛఆٛ - σʔλૹड৴͕Ͱ͖ͨ 19 ·ͱΊ
  15. • وॏͳܦݧ͕Ͱ͖·ͨ͠ - ޷͖ͳ044࡞͓ͬͯ௞ۚ΋͍͚ͨͩͯʜ • ྑ͍ҙݟΛ୔ࢁ͍͖ͨͩ·ͨ͠ - ޫ੒͞Μɼ੕໺͞Μɼ͋Γ͕ͱ͏͍͟͝·ͨ͠ • େֶͰ͸։ൃʹ͍ͭͯฉ͚Δ૬ख͕΄΅͍ͳ͍

    • ಠྗ΋େࣄ͕ͩ։ൃ্खͳਓʹֶͿͷ΋େࣄ • ϥϘϢʔεΛ޿Ί·͢ - ੍౓Λ஌ͬͨΒߦ͖͍ͨਓ͸݁ߏ͍Δͱࢥ͏ 20 ͓ΘΓʹ