Jonathan Hart
Committed by Gerrit Code Review

Omit zero-prefix IP match in Softrouter driver

Change-Id: I613c6a2aedc7274c9006be26d81e3ea9ab98b6a7
...@@ -17,6 +17,7 @@ package org.onosproject.driver.pipeline; ...@@ -17,6 +17,7 @@ package org.onosproject.driver.pipeline;
17 17
18 import org.onlab.osgi.ServiceDirectory; 18 import org.onlab.osgi.ServiceDirectory;
19 import org.onlab.packet.Ethernet; 19 import org.onlab.packet.Ethernet;
20 +import org.onlab.packet.IpPrefix;
20 import org.onlab.packet.VlanId; 21 import org.onlab.packet.VlanId;
21 import org.onlab.util.KryoNamespace; 22 import org.onlab.util.KryoNamespace;
22 import org.onosproject.core.ApplicationId; 23 import org.onosproject.core.ApplicationId;
...@@ -52,13 +53,13 @@ import org.onosproject.net.flowobjective.Objective; ...@@ -52,13 +53,13 @@ import org.onosproject.net.flowobjective.Objective;
52 import org.onosproject.net.flowobjective.ObjectiveError; 53 import org.onosproject.net.flowobjective.ObjectiveError;
53 import org.onosproject.store.serializers.KryoNamespaces; 54 import org.onosproject.store.serializers.KryoNamespaces;
54 import org.slf4j.Logger; 55 import org.slf4j.Logger;
55 -import static org.onlab.util.Tools.delay;
56 56
57 import java.util.ArrayList; 57 import java.util.ArrayList;
58 import java.util.Collection; 58 import java.util.Collection;
59 import java.util.Collections; 59 import java.util.Collections;
60 import java.util.Objects; 60 import java.util.Objects;
61 61
62 +import static org.onlab.util.Tools.delay;
62 import static org.slf4j.LoggerFactory.getLogger; 63 import static org.slf4j.LoggerFactory.getLogger;
63 64
64 /** 65 /**
...@@ -394,12 +395,15 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -394,12 +395,15 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
394 return Collections.emptySet(); 395 return Collections.emptySet();
395 } 396 }
396 397
397 - TrafficSelector filteredSelector = 398 + IpPrefix ipPrefix = ((IPCriterion)
398 - DefaultTrafficSelector.builder() 399 + selector.getCriterion(Criterion.Type.IPV4_DST)).ip();
399 - .matchEthType(Ethernet.TYPE_IPV4) 400 +
400 - .matchIPDst(((IPCriterion) 401 + TrafficSelector.Builder filteredSelector = DefaultTrafficSelector.builder()
401 - selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) 402 + .matchEthType(Ethernet.TYPE_IPV4);
402 - .build(); 403 +
404 + if (ipPrefix.prefixLength() != 0) {
405 + filteredSelector.matchIPDst(ipPrefix);
406 + }
403 407
404 TrafficTreatment tt = null; 408 TrafficTreatment tt = null;
405 if (fwd.nextId() != null) { 409 if (fwd.nextId() != null) {
...@@ -419,7 +423,7 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -419,7 +423,7 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
419 .fromApp(fwd.appId()) 423 .fromApp(fwd.appId())
420 .withPriority(fwd.priority()) 424 .withPriority(fwd.priority())
421 .forDevice(deviceId) 425 .forDevice(deviceId)
422 - .withSelector(filteredSelector); 426 + .withSelector(filteredSelector.build());
423 427
424 if (tt != null) { 428 if (tt != null) {
425 ruleBuilder.withTreatment(tt); 429 ruleBuilder.withTreatment(tt);
......