alshabib

block packet context after handling lldp

...@@ -277,7 +277,7 @@ public class LinkDiscovery implements TimerTask { ...@@ -277,7 +277,7 @@ public class LinkDiscovery implements TimerTask {
277 * Handles an incoming LLDP packet. Creates link in topology and sends ACK 277 * Handles an incoming LLDP packet. Creates link in topology and sends ACK
278 * to port where LLDP originated. 278 * to port where LLDP originated.
279 */ 279 */
280 - public void handleLLDP(final byte[] pkt, Integer inPort) { 280 + public boolean handleLLDP(final byte[] pkt, Integer inPort) {
281 281
282 short ethType = ONLabLddp.isOVXLLDP(pkt); 282 short ethType = ONLabLddp.isOVXLLDP(pkt);
283 if (ethType == Ethernet.TYPE_LLDP || ethType == Ethernet.TYPE_BSN) { 283 if (ethType == Ethernet.TYPE_LLDP || ethType == Ethernet.TYPE_BSN) {
...@@ -286,7 +286,7 @@ public class LinkDiscovery implements TimerTask { ...@@ -286,7 +286,7 @@ public class LinkDiscovery implements TimerTask {
286 final OpenFlowSwitch srcSwitch = ctrl.getSwitch(new Dpid(dp.getDpid())); 286 final OpenFlowSwitch srcSwitch = ctrl.getSwitch(new Dpid(dp.getDpid()));
287 final Integer srcPort = dp.getPort(); 287 final Integer srcPort = dp.getPort();
288 if (srcSwitch == null) { 288 if (srcSwitch == null) {
289 - return; 289 + return true;
290 } 290 }
291 this.ackProbe(srcPort); 291 this.ackProbe(srcPort);
292 ConnectPoint src = new ConnectPoint( 292 ConnectPoint src = new ConnectPoint(
...@@ -303,8 +303,10 @@ public class LinkDiscovery implements TimerTask { ...@@ -303,8 +303,10 @@ public class LinkDiscovery implements TimerTask {
303 ld = new DefaultLinkDescription(src, dst, Type.DIRECT); 303 ld = new DefaultLinkDescription(src, dst, Type.DIRECT);
304 } 304 }
305 linkProvider.linkDetected(ld); 305 linkProvider.linkDetected(ld);
306 + return true;
306 } else { 307 } else {
307 this.log.debug("Ignoring unknown LLDP"); 308 this.log.debug("Ignoring unknown LLDP");
309 + return false;
308 } 310 }
309 } 311 }
310 312
......
...@@ -87,8 +87,9 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid ...@@ -87,8 +87,9 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid
87 if (ld == null) { 87 if (ld == null) {
88 return; 88 return;
89 } 89 }
90 - ld.handleLLDP(pktCtx.unparsed(), 90 + if (ld.handleLLDP(pktCtx.unparsed(), pktCtx.inPort())) {
91 - pktCtx.inPort()); 91 + pktCtx.block();
92 + }
92 93
93 } 94 }
94 95
......