karoshima / nw-diy Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
p4 (p4.org) に対応するのかしないのか。
ナマ ruby でパケットいじるコードを書いてもらうことと、
p4 でパケットいじるコード書いてもらったものを何かでパースしてパケットいじるのと、
どのような違いがあるのか、知る必要がある。
dig で出てきたパケットをキャプチャしたところ、
パケット中の UDP チェックサム値と
wireshark が「こうでしょ?」っていうチェックサム値と
NW-DIY で算出した値がぜんぶ違う。
正しいのはパケット中の値なんだろうけど…
どうなってるんだろう。
6つのネットワーク機能のひとつであるフィルター (flt) を作る。
(ネットワーク機能の分類 → https://www.slideshare.net/karoshima/nwdiy-80486394/1)
NW-DIY で TCP を実装する意義を考えてみた。
適切な TCP の実装方法を試行錯誤してみるにしても、
ベースになる実装いくつかあるといいんだろうなあ。
簡単なデモ環境を考える。
そのために必要なモノとコード
パーツごとの機能を明確にする (どっかに書く)。
その書いた内容をベースに自動テストを書く。
社内向け講座やその他のイベントで使った処理パターンも自動テスト化して、
ruby や gem のバージョンアップや環境再構築に耐えられるようにする。
EtherIP header and function.
After EtherIP is OK, It becomes to implement PIPE.
I'm looking forward to implementing it.
たとえば以下の例でおかしくなる。
irb(main):001:0> udp = Nwdiy::Packet::UDP.new
=> [Nwdiy::Packet::UDP src=nil, dst=nil, length=8, cksum=nil, data=nil]
irb(main):002:0> udp.to_pkt
=> "\x00\x00\x00\x00\x00\b\x00\x00"
irb(main):003:0> udp.cksum
=> 65527
irb(main):004:0> udp.to_pkt
=> "\x00\x00\x00\x00\x00\b\xFF\xF7"
cksum 算出後の to_pkt は正しいチェックサム値を出しているが、
初回は出していない。
After Ethernet, IPv4 function is almost fixed, I must Standardize Function API.
仮想インターフェース NwDiy::Interface::Sock と、
その通信を仲介する NwDiy::Interface::SockServer との
ネゴの仕組みの欠陥。
l2sw_spec.rb では複数の仮想インターフェースを NwDiy::Interface.new して
そのうちひとつにパケット送信する。
NwDiy::Interface.new すなわち NwDiy::Interface::Sock.new は
NwDiy::Interface::SockServer に connect を仕掛けるが
これは SockServer 側での accept を待たずに正常終了する。
そのため、回線の両端が accept されるより前に一方の側からパケットを投入され、
パケロスを起こすことがある。
回避策: Interface.new したら、ちょっと待つ。
対処: Sock.new() は SockServer 側の accept を待つ必要がある。
社内演習で発生。
内部インターフェースに送信したパケットが、受信側に出てこない。
手順の問題なのか、実装の問題なのか不明であり、未再現。
some objs have obj.send(pkt) method.
in some bug cases, we want to alarm that is not implemented, but it did warn that the arg is not a string or a label.
The reason is the method name, which all Ruby object has that method to exec method.
So we should rename "send" method to "sendpkt".
and rename some method as same.
つくる
splitter を作る
rspec の WIndows 対応中に発見。
NwDiy::VLAN で追加した access インターフェースから受信したパケットは
NwDiy::VM::addif で起動されたスレッドと NwDiy::VLAN:: forward とで
奪い合っている。
NwDiy:VM::addif でパケット受信スレッドを起こす現在の仕組みは適切なのか?
IP checksum うまいこと実装する。
create modelings for Ethernet, IPv4, IPv6, TCP, UDP, ICMP, IPIP, EtherIP
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.