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
Hide 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
::{
error
::
Error
,
io
::{
BufRead
,
Cursor
},
io
::{
BufRead
,
Cursor
,
Error
},
mem
::
transmute
,
net
::{
Ipv4Addr
,
Ipv6Addr
},
};
...
...
@@ -275,7 +274,7 @@ impl MatchFields {
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
typ
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
...
...
src/openflow/ofp13/events/packet_in.rs
View file @
8bb532bc
use
crate
::
etherparser
::
ethernet
::
EthernetFrame
;
use
super
::
Payload
;
use
super
::
{
MatchFields
,
Payload
}
;
use
byteorder
::{
BigEndian
,
ReadBytesExt
};
use
std
::
io
::{
BufRead
,
Cursor
,
Error
};
...
...
@@ -30,11 +30,7 @@ pub struct PacketInEvent {
pub
reason
:
PacketInReason
,
pub
table_id
:
u8
,
pub
cookie
:
u64
,
/**
* TODO
* Ofp Match
*/
pub
in_port
:
u16
,
pub
matchs
:
MatchFields
,
pub
payload
:
Payload
,
}
...
...
@@ -51,9 +47,12 @@ impl PacketInEvent {
n
=>
Some
(
n
as
u32
),
};
let
total_len
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
in_port
=
bytes
.read_u16
::
<
BigEndian
>
()
?
;
let
reason
=
PacketInReason
::
new
(
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
payload
=
match
buf_id
{
Some
(
n
)
=>
Payload
::
Buffered
(
n
as
u32
,
packet
),
...
...
@@ -62,9 +61,10 @@ impl PacketInEvent {
Ok
(
PacketInEvent
{
buf_id
,
total_len
,
in_port
,
reason
,
table_id
,
cookie
,
matchs
,
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