Avoid processing IPv6 messages in ProxyArp if it is disabled (ONOS-1313)
Change-Id: I1eed21434d5d1e1cdeb175312b527c3b4c3942c5
diff --git a/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java b/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
index 6be06a5..8c467bf 100644
--- a/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
+++ b/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
@@ -30,6 +30,7 @@
import org.onosproject.core.CoreService;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.packet.InboundPacket;
import org.onosproject.net.packet.PacketContext;
import org.onosproject.net.packet.PacketPriority;
import org.onosproject.net.packet.PacketProcessor;
@@ -69,7 +70,7 @@
@Property(name = "ipv6NeighborDiscovery", boolValue = false,
label = "Enable IPv6 Neighbor Discovery; default is false")
- private boolean ipv6NeighborDiscovery = false;
+ protected boolean ipv6NeighborDiscovery = false;
@Activate
public void activate(ComponentContext context) {
@@ -171,7 +172,15 @@
if (context.isHandled()) {
return;
}
-
+ // If IPv6 NDP is disabled, don't handle IPv6 frames.
+ InboundPacket pkt = context.inPacket();
+ Ethernet ethPkt = pkt.parsed();
+ if (ethPkt == null) {
+ return;
+ }
+ if (!ipv6NeighborDiscovery && (ethPkt.getEtherType() == Ethernet.TYPE_IPV6)) {
+ return;
+ }
//handle the arp packet.
proxyArpService.handlePacket(context);
}