Comments (5)
ついでにですが、
message-helper.cにあるsend_message(send_controller_message)以外のsend_xxxは、
message-helper.rbにもっていくのはだめですか?(rubyで書いた方がいいような気がするためです)
from trema-edge.
send_messageもmessage-helper.rbにいれてみました。
私のイメージは下記のような感じです
https://github.com/sugyo/trema-edge/commit/902f9616719224d3a166133c377501db5fc81909
from trema-edge.
以下2つを実行して、とりあえず回避が出来ました。
PacketDataをStringで渡せれば、もっとスマートなのですが、そうはいかず。。。
(STR2CSTRなど試しましたが、NGでした。。。)
・ send_packet_outにて、:data => packet.unpack("C*") (unpackして渡す)
・ /ruby/trema/message-helper.cに以下を追記してrake
// 以下1行を追記(add)
VALUE r_opt_data = HASH_REF( options, data );
// 以下110行目から9行は変更無し
if ( !NIL_P( r_opt_message ) ) {
if ( datapath_id == rb_iv_get( r_opt_message, "@datapath_id" ) ) {
buffer_id = NUM2UINT( rb_iv_get( r_opt_message, "@buffer_id" ) );
VALUE match = rb_iv_get( r_opt_message, "@match" );
in_port = NUM2UINT( rb_iv_get( match, "@in_port" ) );
}
VALUE r_data = rb_iv_get( r_opt_message, "@data" );
data = r_array_to_buffer( r_data );
}
// 以下3行を追記(add)
else if( !NIL_P(r_opt_data) ){
data = r_array_to_buffer( r_opt_data );
}
buffer *packet_out;
// 以下の判定条件を追加( || !NIL_P(r_opt_data) )
if ( buffer_id == OFP_NO_BUFFER &&
( !NIL_P( r_opt_message ) || !NIL_P(r_opt_data) )) {
// 以下省略
一応send_packet_out全体もそのまま載せておきます。
static VALUE
send_packet_out( int argc, VALUE *argv, VALUE self ) {
VALUE datapath_id = Qnil;
VALUE options = Qnil;
rb_scan_args( argc, argv, "11", &datapath_id, &options );
uint32_t buffer_id = OFP_NO_BUFFER;
buffer *data = NULL;
openflow_actions *actions = NULL;
uint32_t in_port = OFPP_ANY;
if ( !NIL_P( options ) ) {
VALUE r_opt_action = HASH_REF( options, actions );
if ( !NIL_P( r_opt_action ) ) {
actions = pack_basic_action( r_opt_action );
}
VALUE r_opt_message = HASH_REF( options, packet_in );
VALUE r_opt_data = HASH_REF( options, data ); //add
if ( !NIL_P( r_opt_message ) ) {
if ( datapath_id == rb_iv_get( r_opt_message, "@datapath_id" ) ) {
buffer_id = NUM2UINT( rb_iv_get( r_opt_message, "@buffer_id" ) );
VALUE match = rb_iv_get( r_opt_message, "@match" );
in_port = NUM2UINT( rb_iv_get( match, "@in_port" ) );
}
VALUE r_data = rb_iv_get( r_opt_message, "@data" );
data = r_array_to_buffer( r_data );
}
// add following els if
else if( !NIL_P(r_opt_data) ){
data = r_array_to_buffer( r_opt_data );
}
buffer *packet_out;
if ( buffer_id == OFP_NO_BUFFER &&
( !NIL_P( r_opt_message ) || !NIL_P(r_opt_data) )) { // add more 1 condition
buffer *frame = duplicate_buffer( data );
fill_ether_padding( frame );
packet_out = create_packet_out(
get_transaction_id(),
buffer_id,
in_port,
actions,
frame
);
free_buffer( data );
free_buffer( frame );
}
else {
packet_out = create_packet_out(
get_transaction_id(),
buffer_id,
in_port,
actions,
NULL
);
}
send_openflow_message( NUM2ULL( datapath_id ), packet_out );
free_buffer( packet_out );
delete_actions( actions );
}
return self;
}
from trema-edge.
@proshiba @sugyo @shun159 すみません遅くなりました。
この修正がすぐ欲しいという人がいるので、とりあえず大芝さんの修正を入れておいて、のちほどすぎょうさん方式で修正します。
from trema-edge.
ひとまず @proshiba さんの修正を入れておきました。@shun159 @sugyo
from trema-edge.
Related Issues (20)
- Multiple table usage error HOT 2
- make失敗およびlearning-switchの実行失敗 HOT 1
- FLOW_MODに使用するバイトオーダ HOT 1
- Trema::Match*_mask does not work HOT 6
- ExactMatch.from is not fully implemented yet
- LoggerモジュールがSinatraと衝突して動かない HOT 1
- Trema::Controller::send_list_switches_request is not implemented yet
- send_flow_mod_delete
- Trema::Controller#switch_disconnected is not implemented
- Trema::Match#compare is not implemented
- FlowMultipartRequestがエラーになる HOT 2
- FlowMultipartRequestがエラーになる。 (Ipv4SrcAddr) HOT 1
- action buckets に複数の action を定義できない HOT 2
- OpenFLow 1.3.3 HOT 3
- Write-Action instruction does not allow to modify multiple header fields HOT 1
- TremaEdgeでPioが動作しない HOT 3
- trema-edge does not pass the unit tests
- Dumper.rb の port_status メソッド が正しく動作しない HOT 1
- trema version コマンドの出力 HOT 2
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 trema-edge.