Comments (10)
ありがとうございます。Pio::Match
の :wildcards
は値は合ってると思いますが、パーサの :nw_src
で Pio::IPv4Address
を使ってるのでいらないマスク情報 (255.255.255.255) が入ってしまいました。ofp_match
での型は uint32_t
なので、マスク情報はいらないですね。RunTime Error についてもちょっと見てみます。
from pio.
マスク情報はいらない
ちなみに、wildcardsに保存されているマスク情報をPio::IPv4Address
newするときに利用してやる感じでしょうか?
from pio.
a196c9f で RuntimeError も含め直してみました。マスクも入るようにしてあります。いかがでしょうか?
from pio.
ありがとう御座います。
大丈夫そうです!
match = Match.new( {:in_port=>1, :dl_src=>"00:00:00:00:00:0a", :dl_dst=>"00:00:00:00:00:14", :dl_vlan=>0, :dl_vlan_pcp=>0, :dl_type=>2048, :nw_tos=>0, :nw_proto=>1, :nw_src=>"10.0.0.0/8", :nw_dst=>"20.0.0.0/8", :tp_src=>8, :tp_dst=>0} )
pp match
{:wildcards=>
{:dl_vlan=>true,
:tp_dst=>true,
:nw_src=>24,
:nw_dst=>24,
:dl_vlan_pcp=>true,
:nw_tos=>true},
:in_port=>1,
:dl_src=>#<Pio::Mac:19452100 "00:00:00:00:00:0a">,
:dl_dst=>#<Pio::Mac:19442780 "00:00:00:00:00:14">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>2048,
:nw_tos=>0,
:nw_proto=>1,
:nw_src=>
#<Pio::IPv4Address:0x000000025160d8
@value=#<IPAddr: IPv4:10.0.0.0/255.0.0.0>>,
:nw_dst=>
#<Pio::IPv4Address:0x00000002504bf8
@value=#<IPAddr: IPv4:20.0.0.0/255.0.0.0>>,
:tp_src=>8,
:tp_dst=>0}
from pio.
ただ、まだ.read
した時反映されてないですね。
pp match = Match.new( {:in_port=>1, :dl_src=>"00:00:00:00:00:0a", :dl_dst=>"00:00:00:00:00:14", :dl_vlan=>0, :dl_vlan_pcp=>0, :dl_type=>2048, :nw_tos=>0, :nw_proto=>1, :nw_src=>"10.0.0.0/8", :nw_dst=>"20.0.0.0/8", :tp_src=>8, :tp_dst=>0} )
{:wildcards=>
{:dl_vlan=>true,
:tp_dst=>true,
:nw_src=>24,
:nw_dst=>24,
:dl_vlan_pcp=>true,
:nw_tos=>true},
:in_port=>1,
:dl_src=>#<Pio::Mac:23438160 "00:00:00:00:00:0a">,
:dl_dst=>#<Pio::Mac:23384200 "00:00:00:00:00:14">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>2048,
:nw_tos=>0,
:nw_proto=>1,
:nw_src=>
#<Pio::IPv4Address:0x00000002c98d60
@value=#<IPAddr: IPv4:10.0.0.0/255.0.0.0>>,
:nw_dst=>
#<Pio::IPv4Address:0x00000002c977d0
@value=#<IPAddr: IPv4:20.0.0.0/255.0.0.0>>,
:tp_src=>8,
:tp_dst=>0}
match_bin = match.to_binary_s
=> "\x006\x18\x82\x00\x01\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x14\x00\x00\x00\x00\b\x00\x00\x01\x00\x00\n\x00\x00\x00\x14\x00\x00\x00\x00\b\x00\x00"
pp Match.read match_bin
{:wildcards=>
{:dl_vlan=>true,
:tp_dst=>true,
:nw_src=>24,
:nw_dst=>24,
:dl_vlan_pcp=>true,
:nw_tos=>true},
:in_port=>1,
:dl_src=>#<Pio::Mac:23798380 "00:00:00:00:00:0a">,
:dl_dst=>#<Pio::Mac:23796900 "00:00:00:00:00:14">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>2048,
:nw_tos=>0,
:nw_proto=>1,
:nw_src=>
#<Pio::IPv4Address:0x00000002d629f8
@value=#<IPAddr: IPv4:10.0.0.0/255.255.255.255>>,
:nw_dst=>
#<Pio::IPv4Address:0x00000002d61e40
@value=#<IPAddr: IPv4:20.0.0.0/255.255.255.255>>,
:tp_src=>8,
:tp_dst=>0}
from pio.
あと、間違えていたらすみません。
wildcardsについてですが、
今、この実装では 各フィールドに0 もしくは すべて0のアドレスについて、
ignoreするようになっていますが、これオプションに指定されなかった場合に
ignoreにすべきではないでしょうか?また、IPアドレスについてはprefixlenが0の場合にignoreする
んじゃないかとおもいます
認識間違えありましたらすみませんが、
よろしくお願いします。
from pio.
ありがとうございます。これ ↑ でどうでしょうか??
from pio.
ありがとう御座います!
大丈夫そうでした。
flow_mod = IO.read "features/packet_data/flow_mod_add_detailed.raw"
pp FlowMod.read flow_mod
#<Pio::FlowMod:0x000000019e8f08
@format=
{:open_flow_header=>
{:ofp_version=>1,
:message_type=>14,
:message_length=>192,
:transaction_id=>0},
:body=>
{:match=>
{:wildcards=>{:nw_src=>24, :nw_dst=>24},
:in_port=>1,
:dl_src=>#<Pio::Mac:13529560 "00:00:00:00:00:0a">,
:dl_dst=>#<Pio::Mac:13527980 "00:00:00:00:00:14">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>2048,
:nw_tos=>0,
:nw_proto=>1,
:nw_src=>
#<Pio::IPv4Address:0x000000019b3560
@value=#<IPAddr: IPv4:10.0.0.0/255.0.0.0>>,
:nw_dst=>
#<Pio::IPv4Address:0x000000019ab9f0
@value=#<IPAddr: IPv4:20.0.0.0/255.0.0.0>>,
:tp_src=>8,
:tp_dst=>0},
:cookie=>0,
:command=>:add,
:idle_timeout=>0,
:hard_timeout=>0,
:priority=>65535,
:buffer_id=>4294967295,
:out_port=>65535,
:flags=>[:send_flow_rem],
:actions=>
[#<Pio::SetVlanVid:0x000000019aa7a8
@format={:type=>1, :message_length=>8, :vlan_id=>10}>,
#<Pio::SetVlanPriority:0x000000019a8db8
@format={:type=>2, :message_length=>8, :vlan_priority=>0}>,
#<Pio::StripVlanHeader:0x000000019a3340
@format={:type=>3, :message_length=>8}>,
#<Pio::SetEthSrcAddr:0x000000019a1cc0
@format=
{:type=>4,
:message_length=>16,
:mac_address=>#<Pio::Mac:13433600 "00:00:00:00:00:01">}>,
#<Pio::SetEthDstAddr:0x0000000199ef20
@format=
{:type=>5,
:message_length=>16,
:mac_address=>#<Pio::Mac:13427880 "00:00:00:00:00:02">}>,
#<Pio::SetIpSrcAddr:0x0000000199c1d0
@format=
{:type=>6,
:message_length=>8,
:ip_address=>
#<Pio::IPv4Address:0x000000019924a0
@value=#<IPAddr: IPv4:10.0.0.1/255.255.255.255>>}>,
#<Pio::SetIpDstAddr:0x00000001991d20
@format=
{:type=>7,
:message_length=>8,
:ip_address=>
#<Pio::IPv4Address:0x0000000197bd90
@value=#<IPAddr: IPv4:20.0.0.2/255.255.255.255>>}>,
#<Pio::SetIpTos:0x0000000197ac88
@format={:type=>8, :message_length=>8, :type_of_service=>184}>,
#<Pio::SetTransportSrcPort:0x00000001978c80
@format={:type=>9, :message_length=>8, :port_number=>8}>,
#<Pio::SetTransportDstPort:0x0000000196b328
@format={:type=>10, :message_length=>8, :port_number=>0}>,
#<Pio::Enqueue:0x00000001969140
@format=
{:type=>11, :message_length=>16, :port_number=>1, :queue_id=>1}>,
#<Pio::SendOutPort:0x00000001966468
@format=
{:type=>0, :message_length=>8, :port_number=>1, :max_len=>128}>]}}>
flow_mod = IO.read "features/packet_data/flow_mod_add.raw"
pp FlowMod.read flow_mod
#<Pio::FlowMod:0x000000015f65d0
@format=
{:open_flow_header=>
{:ofp_version=>1,
:message_type=>14,
:message_length=>80,
:transaction_id=>21},
:body=>
{:match=>
{:wildcards=>
{:dl_vlan=>true,
:dl_src=>true,
:dl_dst=>true,
:dl_type=>true,
:nw_proto=>true,
:tp_src=>true,
:tp_dst=>true,
:nw_src_all=>true,
:nw_dst_all=>true,
:dl_vlan_pcp=>true,
:nw_tos=>true},
:in_port=>1,
:dl_src=>#<Pio::Mac:11478160 "00:00:00:00:00:00">,
:dl_dst=>#<Pio::Mac:11467940 "00:00:00:00:00:00">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>0,
:nw_tos=>0,
:nw_proto=>0,
:nw_src=>
#<Pio::IPv4Address:0x00000001447a68
@value=#<IPAddr: IPv4:0.0.0.0/255.255.255.255>>, # OFPFW_NW_SRC_ALLなら/0にすべき?
:nw_dst=>
#<Pio::IPv4Address:0x0000000143b060
@value=#<IPAddr: IPv4:0.0.0.0/255.255.255.255>>, # OFPFW_NW_DST_ALLなら/0にすべき?
:tp_src=>0,
:tp_dst=>0},
:cookie=>1,
:command=>:add,
:idle_timeout=>0,
:hard_timeout=>0,
:priority=>65535,
:buffer_id=>4294967295,
:out_port=>2,
:flags=>[:send_flow_rem, :check_overwrap],
:actions=>
[#<Pio::SendOutPort:0x000000015d9d40
@format=
{:type=>0, :message_length=>8, :port_number=>2, :max_len=>65535}>]}}>
pp match = Match.new( {:in_port=>1, :dl_src=>"00:00:00:00:00:0a", :dl_dst=>"00:00:00:00:00:14", :dl_vlan=>0, :dl_vlan_pcp=>0, :dl_type=>2048, :nw_tos=>0, :nw_proto=>1, :nw_s
rc=>"10.0.0.0/8", :nw_dst=>"20.0.0.0/8", :tp_src=>8, :tp_dst=>0} )
#<Pio::Match:0x000000016d4a10
@format=
{:wildcards=>{:nw_src=>24, :nw_dst=>24},
:in_port=>1,
:dl_src=>#<Pio::Mac:11931420 "00:00:00:00:00:0a">,
:dl_dst=>#<Pio::Mac:11928560 "00:00:00:00:00:14">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>2048,
:nw_tos=>0,
:nw_proto=>1,
:nw_src=>
#<Pio::IPv4Address:0x000000016b9508
@value=#<IPAddr: IPv4:10.0.0.0/255.0.0.0>>,
:nw_dst=>
#<Pio::IPv4Address:0x000000016b29d8
@value=#<IPAddr: IPv4:20.0.0.0/255.0.0.0>>,
:tp_src=>8,
:tp_dst=>0}>
match_bin = match.to_binary_s
=> "\x00\x06\x18\x00\x00\x01\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x14\x00\x00\x00\x00\b\x00\x00\x01\x00\x00\n\x00\x00\x00\x14\x00\x00\x00\x00\b\x00\x00"
pp Match.read match_bin
{:wildcards=>{:nw_src=>24, :nw_dst=>24},
:in_port=>1,
:dl_src=>#<Pio::Mac:11735780 "00:00:00:00:00:0a">,
:dl_dst=>#<Pio::Mac:11734040 "00:00:00:00:00:14">,
:dl_vlan=>0,
:dl_vlan_pcp=>0,
:dl_type=>2048,
:nw_tos=>0,
:nw_proto=>1,
:nw_src=>
#<Pio::IPv4Address:0x0000000165adc8
@value=#<IPAddr: IPv4:10.0.0.0/255.0.0.0>>,
:nw_dst=>
#<Pio::IPv4Address:0x00000001658aa0
@value=#<IPAddr: IPv4:20.0.0.0/255.0.0.0>>,
:tp_src=>8,
:tp_dst=>0}
from pio.
では明日あたり、リファクタリングしてから新バージョンリリースしますー。
from pio.
よかったです!
何かお手伝いできることありましたらまたおねがいしますー
from pio.
Related Issues (20)
- Pio::OpenFlow.read cannot parse Barrier messages.
- Add FlowStats::Request and FlowStats::Reply
- Add Table Stats Request/Reply message
- Add Port Stats Request/Reply message
- Add Queue Stats Request/Reply message
- Add Vendor Stats Request/Reply message HOT 5
- Features::Reply#dpid (#datapath_id) doesn't return an Integer
- " error: undefined method `key?' for nil:NilClass " のエラーの原因について HOT 14
- GotoTable.new(v) (v > OFPP_MAX) must raise an error.
- ParserのIPv6対応 HOT 7
- flow_modのデフォルトのmatch HOT 1
- パケットからMatchを生成するメソッド HOT 6
- the message #1 have → has
- OpenFlow 1.0 protocol
- Remove action Format classes
- OpenFlow 1.3 protocol
- Pio::DHCPの修正
- MultiPartメッセージについて HOT 1
- ARPのhardware_typeが1で決め打ちされてしまっている
- The doucument link is dead now
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pio.