Skip to content

Commit a6320d4

Browse files
committed
Add try/catch for ethernet packet deserialize -- will throw an
error here.
1 parent 6061b0b commit a6320d4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: src/main/java/net/floodlightcontroller/core/internal/Controller.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,18 @@ public void handleMessage(IOFSwitch sw, OFMessage m,
368368
}
369369

370370
if (alwaysDecodeEth) {
371-
eth = new Ethernet();
372-
eth.deserialize(pi.getData(), 0, pi.getData().length);
371+
try {
372+
eth = new Ethernet();
373+
eth.deserialize(pi.getData(), 0, pi.getData().length);
374+
}
375+
catch (RuntimeException e) {
376+
if (log.isDebugEnabled()) {
377+
log.debug("Failed to deserialize ethernet packet {} -> {}",
378+
eth.getSourceMACAddress(), eth.getDestinationMACAddress());
379+
}
380+
throw new RuntimeException("Error in deserialize ethernet packet", e);
381+
}
382+
373383
}
374384
// fall through to default case...
375385

0 commit comments

Comments
 (0)