Ayaka Koshibe
Committed by Gerrit Code Review

Avoid processing IPv6 messages in ProxyArp if it is disabled (ONOS-1313)

Change-Id: I1eed21434d5d1e1cdeb175312b527c3b4c3942c5
...@@ -30,6 +30,7 @@ import org.onosproject.core.ApplicationId; ...@@ -30,6 +30,7 @@ import org.onosproject.core.ApplicationId;
30 import org.onosproject.core.CoreService; 30 import org.onosproject.core.CoreService;
31 import org.onosproject.net.flow.DefaultTrafficSelector; 31 import org.onosproject.net.flow.DefaultTrafficSelector;
32 import org.onosproject.net.flow.TrafficSelector; 32 import org.onosproject.net.flow.TrafficSelector;
33 +import org.onosproject.net.packet.InboundPacket;
33 import org.onosproject.net.packet.PacketContext; 34 import org.onosproject.net.packet.PacketContext;
34 import org.onosproject.net.packet.PacketPriority; 35 import org.onosproject.net.packet.PacketPriority;
35 import org.onosproject.net.packet.PacketProcessor; 36 import org.onosproject.net.packet.PacketProcessor;
...@@ -69,7 +70,7 @@ public class ProxyArp { ...@@ -69,7 +70,7 @@ public class ProxyArp {
69 70
70 @Property(name = "ipv6NeighborDiscovery", boolValue = false, 71 @Property(name = "ipv6NeighborDiscovery", boolValue = false,
71 label = "Enable IPv6 Neighbor Discovery; default is false") 72 label = "Enable IPv6 Neighbor Discovery; default is false")
72 - private boolean ipv6NeighborDiscovery = false; 73 + protected boolean ipv6NeighborDiscovery = false;
73 74
74 @Activate 75 @Activate
75 public void activate(ComponentContext context) { 76 public void activate(ComponentContext context) {
...@@ -171,7 +172,15 @@ public class ProxyArp { ...@@ -171,7 +172,15 @@ public class ProxyArp {
171 if (context.isHandled()) { 172 if (context.isHandled()) {
172 return; 173 return;
173 } 174 }
174 - 175 + // If IPv6 NDP is disabled, don't handle IPv6 frames.
176 + InboundPacket pkt = context.inPacket();
177 + Ethernet ethPkt = pkt.parsed();
178 + if (ethPkt == null) {
179 + return;
180 + }
181 + if (!ipv6NeighborDiscovery && (ethPkt.getEtherType() == Ethernet.TYPE_IPV6)) {
182 + return;
183 + }
175 //handle the arp packet. 184 //handle the arp packet.
176 proxyArpService.handlePacket(context); 185 proxyArpService.handlePacket(context);
177 } 186 }
......