Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
d230e509
Commit
d230e509
authored
12 years ago
by
Shudong Zhou
Browse files
Options
Downloads
Patches
Plain Diff
Downgrade packet parsing error message to trace
parent
0f77b289
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/net/floodlightcontroller/packet/Ethernet.java
+7
-13
7 additions, 13 deletions
src/main/java/net/floodlightcontroller/packet/Ethernet.java
src/main/java/net/floodlightcontroller/packet/IPv4.java
+14
-11
14 additions, 11 deletions
src/main/java/net/floodlightcontroller/packet/IPv4.java
with
21 additions
and
24 deletions
src/main/java/net/floodlightcontroller/packet/Ethernet.java
+
7
−
13
View file @
d230e509
...
...
@@ -22,7 +22,6 @@ import java.util.Arrays;
import
java.util.HashMap
;
import
java.util.Map
;
import
net.floodlightcontroller.core.annotations.LogMessageDoc
;
import
net.floodlightcontroller.util.MACAddress
;
import
org.openflow.util.HexString
;
...
...
@@ -229,12 +228,6 @@ public class Ethernet extends BasePacket {
return
data
;
}
@LogMessageDoc
(
level
=
"INFO"
,
message
=
"Failed to parse ethernet packet payload"
,
explanation
=
"Was unable to parse ethernet payload, often caused "
+
"by packet truncation. Packet is forwarded as a plain "
+
"ethernet packet."
,
recommendation
=
LogMessageDoc
.
GENERIC_ACTION
)
@Override
public
IPacket
deserialize
(
byte
[]
data
,
int
offset
,
int
length
)
{
if
(
length
<=
16
)
// Ethernet packet minium should be 60, this is reasonable
...
...
@@ -270,12 +263,13 @@ public class Ethernet extends BasePacket {
payload
=
clazz
.
newInstance
();
this
.
payload
=
payload
.
deserialize
(
data
,
bb
.
position
(),
bb
.
limit
()-
bb
.
position
());
}
catch
(
Exception
e
)
{
log
.
info
(
"Failed to parse ethernet packet {}->{} payload as {},"
+
" treat as plain ethernet packet"
,
new
Object
[]
{
this
.
sourceMACAddress
,
this
.
destinationMACAddress
,
clazz
.
getClass
().
getName
()});
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"Exception from parsing {}"
,
e
);
if
(
log
.
isTraceEnabled
())
{
log
.
trace
(
"Failed to parse ethernet packet {}->{}"
+
" payload as {}, treat as plain ethernet packet"
,
new
Object
[]
{
this
.
sourceMACAddress
,
this
.
destinationMACAddress
,
clazz
.
getClass
().
getName
()});
log
.
trace
(
"Exception from parsing {}"
,
e
);
}
payload
=
new
Data
();
this
.
payload
=
payload
.
deserialize
(
data
,
bb
.
position
(),
bb
.
limit
()-
bb
.
position
());
...
...
This diff is collapsed.
Click to expand it.
src/main/java/net/floodlightcontroller/packet/IPv4.java
+
14
−
11
View file @
d230e509
...
...
@@ -26,8 +26,6 @@ import java.util.Collection;
import
java.util.HashMap
;
import
java.util.Map
;
import
net.floodlightcontroller.core.annotations.LogMessageDoc
;
/**
* @author David Erickson (daviderickson@cs.stanford.edu)
*
...
...
@@ -60,6 +58,7 @@ public class IPv4 extends BasePacket {
protected
byte
[]
options
;
protected
boolean
isTruncated
;
protected
boolean
isFragment
;
/**
* Default constructor that sets the version to 4.
...
...
@@ -68,6 +67,7 @@ public class IPv4 extends BasePacket {
super
();
this
.
version
=
4
;
isTruncated
=
false
;
isFragment
=
false
;
}
/**
...
...
@@ -129,6 +129,14 @@ public class IPv4 extends BasePacket {
this
.
isTruncated
=
isTruncated
;
}
public
boolean
isFragment
()
{
return
isFragment
;
}
public
void
setFragment
(
boolean
isFrag
)
{
this
.
isFragment
=
isFrag
;
}
/**
* @param identification the identification to set
*/
...
...
@@ -336,11 +344,6 @@ public class IPv4 extends BasePacket {
return
data
;
}
@LogMessageDoc
(
level
=
"INFO"
,
message
=
"IP fragment detected"
,
explanation
=
"Packet in is an IP fragment. Controller forwards "
+
"it using IP header only. Transport headers are ignored."
,
recommendation
=
LogMessageDoc
.
GENERIC_ACTION
)
@Override
public
IPacket
deserialize
(
byte
[]
data
,
int
offset
,
int
length
)
{
ByteBuffer
bb
=
ByteBuffer
.
wrap
(
data
,
offset
,
length
);
...
...
@@ -368,8 +371,8 @@ public class IPv4 extends BasePacket {
}
IPacket
payload
;
boolean
is_frag
=
((
this
.
flags
&
0x1
)
!=
0
)
||
(
this
.
fragmentOffset
!=
0
);
if
(!
is
_f
rag
&&
IPv4
.
protocolClassMap
.
containsKey
(
this
.
protocol
))
{
isFragment
=
((
this
.
flags
&
0x1
)
!=
0
)
||
(
this
.
fragmentOffset
!=
0
);
if
(!
is
F
rag
ment
&&
IPv4
.
protocolClassMap
.
containsKey
(
this
.
protocol
))
{
Class
<?
extends
IPacket
>
clazz
=
IPv4
.
protocolClassMap
.
get
(
this
.
protocol
);
try
{
payload
=
clazz
.
newInstance
();
...
...
@@ -377,8 +380,8 @@ public class IPv4 extends BasePacket {
throw
new
RuntimeException
(
"Error parsing payload for IPv4 packet"
,
e
);
}
}
else
{
if
(
is_frag
)
{
log
.
info
(
"IPv4 fragment detected {}->{}, forward using IP header only"
,
if
(
log
.
isTraceEnabled
()
&&
isFragment
)
{
log
.
trace
(
"IPv4 fragment detected {}->{}, forward using IP header only"
,
fromIPv4Address
(
this
.
sourceAddress
),
fromIPv4Address
(
this
.
destinationAddress
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment