Brian O'Connor
Committed by Gerrit Code Review

Fix ProxyArp

Only handle packets that we are explicitly listening for

Change-Id: I4f3121bbd94568b420eb1c6d15ba73fbcc8690ef
...@@ -23,6 +23,8 @@ import org.apache.felix.scr.annotations.Property; ...@@ -23,6 +23,8 @@ import org.apache.felix.scr.annotations.Property;
23 import org.apache.felix.scr.annotations.Reference; 23 import org.apache.felix.scr.annotations.Reference;
24 import org.apache.felix.scr.annotations.ReferenceCardinality; 24 import org.apache.felix.scr.annotations.ReferenceCardinality;
25 import org.onlab.packet.Ethernet; 25 import org.onlab.packet.Ethernet;
26 +import org.onlab.packet.ICMP6;
27 +import org.onlab.packet.IPv6;
26 import org.onosproject.cfg.ComponentConfigService; 28 import org.onosproject.cfg.ComponentConfigService;
27 import org.onosproject.core.ApplicationId; 29 import org.onosproject.core.ApplicationId;
28 import org.onosproject.core.CoreService; 30 import org.onosproject.core.CoreService;
...@@ -214,31 +216,35 @@ public class ProxyArp { ...@@ -214,31 +216,35 @@ public class ProxyArp {
214 if (context.isHandled()) { 216 if (context.isHandled()) {
215 return; 217 return;
216 } 218 }
217 - // If IPv6 NDP is disabled, don't handle IPv6 frames. 219 +
218 InboundPacket pkt = context.inPacket(); 220 InboundPacket pkt = context.inPacket();
219 Ethernet ethPkt = pkt.parsed(); 221 Ethernet ethPkt = pkt.parsed();
220 if (ethPkt == null) { 222 if (ethPkt == null) {
221 return; 223 return;
222 } 224 }
223 - if (!ipv6NeighborDiscovery && (ethPkt.getEtherType() == TYPE_IPV6)) { 225 +
224 - return; 226 + if (ethPkt.getEtherType() == TYPE_ARP) {
227 + //handle the arp packet.
228 + proxyArpService.handlePacket(context);
229 + } else if (ipv6NeighborDiscovery && ethPkt.getEtherType() == TYPE_IPV6) {
230 + IPv6 ipv6Pkt = (IPv6) ethPkt.getPayload();
231 + if (ipv6Pkt.getNextHeader() == IPv6.PROTOCOL_ICMP6) {
232 + ICMP6 icmp6Pkt = (ICMP6) ipv6Pkt.getPayload();
233 + if (icmp6Pkt.getIcmpType() == NEIGHBOR_SOLICITATION ||
234 + icmp6Pkt.getIcmpType() == NEIGHBOR_ADVERTISEMENT) {
235 + // handle ICMPv6 solicitations and advertisements
236 + proxyArpService.handlePacket(context);
237 + }
238 + }
225 } 239 }
226 240
241 + // FIXME why were we listening to IPv4 frames at all?
227 // Do not ARP for multicast packets. Let mfwd handle them. 242 // Do not ARP for multicast packets. Let mfwd handle them.
228 if (ethPkt.getEtherType() == Ethernet.TYPE_IPV4) { 243 if (ethPkt.getEtherType() == Ethernet.TYPE_IPV4) {
229 if (ethPkt.getDestinationMAC().isMulticast()) { 244 if (ethPkt.getDestinationMAC().isMulticast()) {
230 return; 245 return;
231 } 246 }
232 } 247 }
233 -
234 - if (ethPkt.getEtherType() != TYPE_ARP && ethPkt.getEtherType() != TYPE_IPV6) {
235 - return;
236 - }
237 -
238 - //handle the arp packet.
239 - proxyArpService.handlePacket(context);
240 } 248 }
241 } 249 }
242 } 250 }
243 -
244 -
......