Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
Tenjin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
Tenjin
Commits
8bb532bc
Commit
8bb532bc
authored
Jul 24, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packet_in and change match_fields return error
parent
af398df7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
match_fields.rs
src/openflow/ofp13/events/flow_mod/match_fields.rs
+2
-3
packet_in.rs
src/openflow/ofp13/events/packet_in.rs
+8
-8
No files found.
src/openflow/ofp13/events/flow_mod/match_fields.rs
View file @
8bb532bc
use
std
::{
use
std
::{
error
::
Error
,
io
::{
BufRead
,
Cursor
,
Error
},
io
::{
BufRead
,
Cursor
},
mem
::
transmute
,
mem
::
transmute
,
net
::{
Ipv4Addr
,
Ipv6Addr
},
net
::{
Ipv4Addr
,
Ipv6Addr
},
};
};
...
@@ -275,7 +274,7 @@ impl MatchFields {
...
@@ -275,7 +274,7 @@ impl MatchFields {
ofp_match
.marshal
(
bytes
);
ofp_match
.marshal
(
bytes
);
}
}
pub
fn
parse
(
bytes
:
&
mut
Cursor
<
Vec
<
u8
>>
)
->
Result
<
MatchFields
,
Box
<
dyn
Error
>
>
{
pub
fn
parse
(
bytes
:
&
mut
Cursor
<
Vec
<
u8
>>
)
->
Result
<
MatchFields
,
Error
>
{
let
mut
matcher
=
MatchFields
::
match_all
();
let
mut
matcher
=
MatchFields
::
match_all
();
let
typ
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
typ
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
...
...
src/openflow/ofp13/events/packet_in.rs
View file @
8bb532bc
use
crate
::
etherparser
::
ethernet
::
EthernetFrame
;
use
crate
::
etherparser
::
ethernet
::
EthernetFrame
;
use
super
::
Payload
;
use
super
::
{
MatchFields
,
Payload
}
;
use
byteorder
::{
BigEndian
,
ReadBytesExt
};
use
byteorder
::{
BigEndian
,
ReadBytesExt
};
use
std
::
io
::{
BufRead
,
Cursor
,
Error
};
use
std
::
io
::{
BufRead
,
Cursor
,
Error
};
...
@@ -30,11 +30,7 @@ pub struct PacketInEvent {
...
@@ -30,11 +30,7 @@ pub struct PacketInEvent {
pub
reason
:
PacketInReason
,
pub
reason
:
PacketInReason
,
pub
table_id
:
u8
,
pub
table_id
:
u8
,
pub
cookie
:
u64
,
pub
cookie
:
u64
,
/**
pub
matchs
:
MatchFields
,
* TODO
* Ofp Match
*/
pub
in_port
:
u16
,
pub
payload
:
Payload
,
pub
payload
:
Payload
,
}
}
...
@@ -51,9 +47,12 @@ impl PacketInEvent {
...
@@ -51,9 +47,12 @@ impl PacketInEvent {
n
=>
Some
(
n
as
u32
),
n
=>
Some
(
n
as
u32
),
};
};
let
total_len
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
total_len
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
in_port
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
reason
=
PacketInReason
::
new
(
bytes
.read_u8
()
?
);
let
reason
=
PacketInReason
::
new
(
bytes
.read_u8
()
?
);
let
table_id
=
bytes
.read_u8
()
?
;
let
table_id
=
bytes
.read_u8
()
?
;
let
cookie
=
bytes
.read_u64
::
<
BigEndian
>
()
?
;
let
matchs
=
MatchFields
::
parse
(
&
mut
bytes
)
?
;
// padding
bytes
.consume
(
2
);
let
packet
=
bytes
.fill_buf
()
?
.to_vec
();
let
packet
=
bytes
.fill_buf
()
?
.to_vec
();
let
payload
=
match
buf_id
{
let
payload
=
match
buf_id
{
Some
(
n
)
=>
Payload
::
Buffered
(
n
as
u32
,
packet
),
Some
(
n
)
=>
Payload
::
Buffered
(
n
as
u32
,
packet
),
...
@@ -62,9 +61,10 @@ impl PacketInEvent {
...
@@ -62,9 +61,10 @@ impl PacketInEvent {
Ok
(
PacketInEvent
{
Ok
(
PacketInEvent
{
buf_id
,
buf_id
,
total_len
,
total_len
,
in_port
,
reason
,
reason
,
table_id
,
table_id
,
cookie
,
matchs
,
payload
,
payload
,
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment