Skip to content
Snippets Groups Projects
Commit b77d7519 authored by Controller's avatar Controller
Browse files

fix race conditions in LinkDiscoveryManager module

parent 7f5bedb6
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,7 @@ public interface ILinkDiscoveryService extends IFloodlightService { ...@@ -62,7 +62,7 @@ public interface ILinkDiscoveryService extends IFloodlightService {
* to switchport (sw, port). PacketOut does not contain actions. * to switchport (sw, port). PacketOut does not contain actions.
* PacketOut length includes the minimum length and data length. * PacketOut length includes the minimum length and data length.
*/ */
public OFPacketOut generateLLDPMessage(DatapathId sw, OFPort port, public OFPacketOut generateLLDPMessage(IOFSwitch iofSwitch, OFPort port,
boolean isStandard, boolean isStandard,
boolean isReverse); boolean isReverse);
......
...@@ -288,10 +288,9 @@ IFloodlightModule, IInfoProvider { ...@@ -288,10 +288,9 @@ IFloodlightModule, IInfoProvider {
//********************* //*********************
@Override @Override
public OFPacketOut generateLLDPMessage(DatapathId sw, OFPort port, public OFPacketOut generateLLDPMessage(IOFSwitch iofSwitch, OFPort port,
boolean isStandard, boolean isReverse) { boolean isStandard, boolean isReverse) {
IOFSwitch iofSwitch = switchService.getSwitch(sw);
OFPortDesc ofpPort = iofSwitch.getPort(port); OFPortDesc ofpPort = iofSwitch.getPort(port);
if (log.isTraceEnabled()) { if (log.isTraceEnabled()) {
...@@ -1160,6 +1159,8 @@ IFloodlightModule, IInfoProvider { ...@@ -1160,6 +1159,8 @@ IFloodlightModule, IInfoProvider {
return; return;
IOFSwitch iofSwitch = switchService.getSwitch(sw); IOFSwitch iofSwitch = switchService.getSwitch(sw);
if (iofSwitch == null) //fix dereference violations in case race conditions
return;
OFPortDesc ofpPort = iofSwitch.getPort(port); OFPortDesc ofpPort = iofSwitch.getPort(port);
if (log.isTraceEnabled()) { if (log.isTraceEnabled()) {
...@@ -1687,6 +1688,8 @@ IFloodlightModule, IInfoProvider { ...@@ -1687,6 +1688,8 @@ IFloodlightModule, IInfoProvider {
@Override @Override
public void switchActivated(DatapathId switchId) { public void switchActivated(DatapathId switchId) {
IOFSwitch sw = switchService.getSwitch(switchId); IOFSwitch sw = switchService.getSwitch(switchId);
if (sw == null) //fix dereference violation in case race conditions
return;
if (sw.getEnabledPortNumbers() != null) { if (sw.getEnabledPortNumbers() != null) {
for (OFPort p : sw.getEnabledPortNumbers()) { for (OFPort p : sw.getEnabledPortNumbers()) {
processNewPort(sw.getId(), p); processNewPort(sw.getId(), p);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment