trema 0.1.3.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rantfile +87 -80
- data/VERSION +1 -1
- data/cruise.rb +3 -3
- data/features/step_definitions/misc_steps.rb +2 -2
- data/features/support/env.rb +3 -3
- data/ruby/trema/command/kill.rb +1 -1
- data/ruby/trema/daemon.rb +3 -3
- data/ruby/trema/executables.rb +36 -54
- data/ruby/trema/link.rb +4 -1
- data/ruby/trema/monkey-patch/module.rb +2 -0
- data/ruby/trema/monkey-patch/module/class-method.rb +40 -0
- data/ruby/trema/open-vswitch.rb +1 -1
- data/ruby/trema/packet_in.c +96 -0
- data/ruby/trema/path.rb +42 -92
- data/ruby/trema/util.rb +6 -1
- data/spec/trema/dsl/runner_spec.rb +31 -8
- data/spec/trema/echo-request_spec.rb +1 -1
- data/spec/trema/executables_spec.rb +22 -41
- data/spec/trema/packet-in_spec.rb +375 -67
- data/spec/trema/packet-out_spec.rb +2 -1
- data/spec/trema/queue-get-config-request_spec.rb +1 -1
- data/src/lib/ipv4.h +18 -1
- data/src/lib/packet_info.h +1 -1
- data/src/lib/packet_parser.c +2 -2
- data/trema +3 -4
- data/trema.gemspec +3 -2
- data/unittests/lib/openflow_message_test.c +1 -1
- data/unittests/lib/packet_parser_test.c +1 -1
- data/unittests/lib/utility_test.c +2 -2
- metadata +5 -5
@@ -38,7 +38,7 @@ describe QueueGetConfigRequest, ".new( VALID OPTIONS )" do
|
|
38
38
|
|
39
39
|
context "when #queue_get_config_request is sent" do
|
40
40
|
it "should #queue_get_config_reply" do
|
41
|
-
pending "#queue_get_config_reply is not implemented in #{Trema
|
41
|
+
pending "#queue_get_config_reply is not implemented in #{Trema.vendor_openvswitch}"
|
42
42
|
class QueueGetConfigController < Controller; end
|
43
43
|
network {
|
44
44
|
vswitch { datapath_id 0xabc }
|
data/src/lib/ipv4.h
CHANGED
@@ -28,7 +28,24 @@
|
|
28
28
|
#include "buffer.h"
|
29
29
|
|
30
30
|
|
31
|
-
typedef struct
|
31
|
+
typedef struct {
|
32
|
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
33
|
+
unsigned int ihl:4;
|
34
|
+
unsigned int version:4;
|
35
|
+
#elif __BYTE_ORDER == __BIG_ENDIAN
|
36
|
+
unsigned int version:4;
|
37
|
+
unsigned int ihl:4;
|
38
|
+
#endif
|
39
|
+
u_int8_t tos;
|
40
|
+
u_int16_t tot_len;
|
41
|
+
u_int16_t id;
|
42
|
+
u_int16_t frag_off;
|
43
|
+
u_int8_t ttl;
|
44
|
+
u_int8_t protocol;
|
45
|
+
u_int16_t csum;
|
46
|
+
u_int32_t saddr;
|
47
|
+
u_int32_t daddr;
|
48
|
+
} ipv4_header_t;
|
32
49
|
|
33
50
|
|
34
51
|
#define IPV4_ADDRLEN 4
|
data/src/lib/packet_info.h
CHANGED
data/src/lib/packet_parser.c
CHANGED
@@ -185,7 +185,7 @@ parse_ipv4( buffer *buf ) {
|
|
185
185
|
packet_info->ipv4_frag_off = ntohs( ipv4_header->frag_off );
|
186
186
|
packet_info->ipv4_ttl = ipv4_header->ttl;
|
187
187
|
packet_info->ipv4_protocol = ipv4_header->protocol;
|
188
|
-
packet_info->ipv4_checksum = ntohs( ipv4_header->
|
188
|
+
packet_info->ipv4_checksum = ntohs( ipv4_header->csum );
|
189
189
|
packet_info->ipv4_saddr = ntohl( ipv4_header->saddr );
|
190
190
|
packet_info->ipv4_daddr = ntohl( ipv4_header->daddr );
|
191
191
|
|
@@ -369,7 +369,7 @@ parse_igmp( buffer *buf ) {
|
|
369
369
|
igmp_header_t *igmp = ptr;
|
370
370
|
packet_info->igmp_type = igmp->type;
|
371
371
|
packet_info->igmp_code = igmp->code;
|
372
|
-
packet_info->
|
372
|
+
packet_info->igmp_checksum = ntohs( igmp->csum );
|
373
373
|
packet_info->igmp_group = ntohl( igmp->group );
|
374
374
|
|
375
375
|
packet_info->format |= NW_IGMP;
|
data/trema
CHANGED
@@ -22,7 +22,6 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
$LOAD_PATH.unshift File.expand_path( File.join File.dirname( __FILE__ ), "ruby" )
|
25
|
-
$LOAD_PATH.unshift File.expand_path( File.join File.dirname( __FILE__ ), "vendor", "ruby-ifconfig-1.2", "lib" )
|
26
25
|
|
27
26
|
|
28
27
|
require "English"
|
@@ -61,9 +60,9 @@ def method_for command
|
|
61
60
|
end
|
62
61
|
|
63
62
|
|
64
|
-
FileUtils.mkdir_p Trema.
|
65
|
-
FileUtils.mkdir_p Trema.
|
66
|
-
FileUtils.mkdir_p Trema.
|
63
|
+
FileUtils.mkdir_p Trema.log
|
64
|
+
FileUtils.mkdir_p Trema.pid
|
65
|
+
FileUtils.mkdir_p Trema.sock
|
67
66
|
|
68
67
|
command = ARGV.shift
|
69
68
|
if method_for( command )
|
data/trema.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "trema"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Yasuhito Takamiya"]
|
12
12
|
s.bindir = ["."]
|
13
|
-
s.date = "2012-02-
|
13
|
+
s.date = "2012-02-29"
|
14
14
|
s.description = "Trema is a full-stack, easy-to-use framework for developing OpenFlow controllers in Ruby/C"
|
15
15
|
s.email = "yasuhito@gmail.com"
|
16
16
|
s.executables = ["trema", "trema-config"]
|
@@ -172,6 +172,7 @@ Gem::Specification.new do |s|
|
|
172
172
|
"ruby/trema/monkey-patch/integer/base-conversions.rb",
|
173
173
|
"ruby/trema/monkey-patch/integer/ranges.rb",
|
174
174
|
"ruby/trema/monkey-patch/module.rb",
|
175
|
+
"ruby/trema/monkey-patch/module/class-method.rb",
|
175
176
|
"ruby/trema/monkey-patch/module/deprecation.rb",
|
176
177
|
"ruby/trema/monkey-patch/string.rb",
|
177
178
|
"ruby/trema/monkey-patch/string/inflectors.rb",
|
@@ -5072,7 +5072,7 @@ setup_ipv4_packet( size_t length, uint16_t type ) {
|
|
5072
5072
|
ipv4->tos = 0;
|
5073
5073
|
ipv4->tot_len = htons( sizeof( ipv4_header_t ) );
|
5074
5074
|
ipv4->ttl = 0;
|
5075
|
-
ipv4->
|
5075
|
+
ipv4->csum = 0;
|
5076
5076
|
ipv4->saddr = htonl( 0xC0A80067 );
|
5077
5077
|
ipv4->daddr = htonl( 0xC0A80036 );
|
5078
5078
|
ipv4->frag_off = htons( 0 );
|
@@ -565,7 +565,7 @@ test_parse_packet_igmp_query_v2_succeeds() {
|
|
565
565
|
|
566
566
|
assert_int_equal( packet_info->igmp_type, IGMP_MEMBERSHIP_QUERY );
|
567
567
|
assert_int_equal( packet_info->igmp_code, 100 );
|
568
|
-
assert_int_equal( packet_info->
|
568
|
+
assert_int_equal( packet_info->igmp_checksum, 0xee9b );
|
569
569
|
assert_int_equal( packet_info->igmp_group, 0 );
|
570
570
|
|
571
571
|
assert_true( packet_type_igmp_membership_query( buffer ) );
|
@@ -529,7 +529,7 @@ test_get_checksum_udp_packet() {
|
|
529
529
|
ipv4_header.frag_off = htons( 0 );
|
530
530
|
ipv4_header.ttl = 0x80;
|
531
531
|
ipv4_header.protocol = 0x11;
|
532
|
-
ipv4_header.
|
532
|
+
ipv4_header.csum = 0;
|
533
533
|
ipv4_header.saddr = htonl( 0x0a3835af );
|
534
534
|
ipv4_header.daddr = htonl( 0x0a3837ff );
|
535
535
|
|
@@ -553,7 +553,7 @@ test_get_checksum_icmp_packet() {
|
|
553
553
|
ipv4_header.frag_off = htons( 0 );
|
554
554
|
ipv4_header.ttl = 0x40;
|
555
555
|
ipv4_header.protocol = 0x01;
|
556
|
-
ipv4_header.
|
556
|
+
ipv4_header.csum = 0;
|
557
557
|
ipv4_header.saddr = htonl( 0xc0a8642b );
|
558
558
|
ipv4_header.daddr = htonl( 0xc0a8642c );
|
559
559
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
8
|
- 2
|
11
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Yasuhito Takamiya
|
@@ -17,7 +16,7 @@ bindir:
|
|
17
16
|
- .
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2012-02-
|
19
|
+
date: 2012-02-29 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: bundler
|
@@ -389,6 +388,7 @@ files:
|
|
389
388
|
- ruby/trema/monkey-patch/integer/base-conversions.rb
|
390
389
|
- ruby/trema/monkey-patch/integer/ranges.rb
|
391
390
|
- ruby/trema/monkey-patch/module.rb
|
391
|
+
- ruby/trema/monkey-patch/module/class-method.rb
|
392
392
|
- ruby/trema/monkey-patch/module/deprecation.rb
|
393
393
|
- ruby/trema/monkey-patch/string.rb
|
394
394
|
- ruby/trema/monkey-patch/string/inflectors.rb
|