Disable ARP/NDP forwarding/flooding
In the scenario where subnets and hosts are configured,
flows for forwarding/flooding should be provisioned.
A copy from the control plane will only cause duplication.
Therefore we are turning that off for now.
We might want to revisit this if we want to support ARP/NDP learning in the future.
Change-Id: I5d8d73c4bacdeabe969ce1ea4e24a4268d853df0
diff --git a/src/main/java/org/onosproject/segmentrouting/ArpHandler.java b/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
index 8f0b7d3..649f52e 100644
--- a/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
@@ -25,8 +25,6 @@
import org.onosproject.incubator.net.neighbour.NeighbourMessageContext;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.net.HostId;
import org.onosproject.net.host.HostService;
import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
import org.onosproject.segmentrouting.config.SegmentRoutingAppConfig;
@@ -106,6 +104,9 @@
MacAddress targetMac = config.getRouterMacForAGatewayIp(pkt.target().getIp4Address());
sendResponse(pkt, targetMac, hostService);
} else {
+ // NOTE: Ignore ARP packets except those target for the router
+ // We will reconsider enabling this when we have host learning support
+ /*
Set<Host> hosts = hostService.getHostsByIp(pkt.target());
if (hosts.size() > 1) {
log.warn("More than one host with the same ip {}", pkt.target());
@@ -118,6 +119,7 @@
} else {
flood(pkt);
}
+ */
}
}
@@ -127,6 +129,9 @@
Ip4Address hostIpAddress = pkt.sender().getIp4Address();
srManager.ipHandler.forwardPackets(pkt.inPort().deviceId(), hostIpAddress);
} else {
+ // NOTE: Ignore ARP packets except those target for the router
+ // We will reconsider enabling this when we have host learning support
+ /*
HostId targetHostId = HostId.hostId(pkt.dstMac(), pkt.vlan());
Host targetHost = hostService.getHost(targetHostId);
// ARP reply for known hosts. Forward to the host.
@@ -140,6 +145,7 @@
}
flood(pkt);
}
+ */
}
}
diff --git a/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java b/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
index 16784c2..a1327c0 100644
--- a/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
@@ -32,8 +32,6 @@
import org.onosproject.incubator.net.neighbour.NeighbourMessageType;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.net.HostId;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.host.HostService;
@@ -328,41 +326,32 @@
* @param hostService the host service
*/
private void handleNdpRequest(NeighbourMessageContext pkt, HostService hostService) {
- /*
- * ND request for the gateway. We have to reply on behalf
- * of the gateway.
- */
+ // ND request for the gateway. We have to reply on behalf of the gateway.
if (isNdpForGateway(pkt)) {
log.debug("Sending NDP reply on behalf of the router");
sendResponse(pkt, config.getRouterMacForAGatewayIp(pkt.target()), hostService);
} else {
+ // NOTE: Ignore NDP packets except those target for the router
+ // We will reconsider enabling this when we have host learning support
/*
- * ND request for an host. We do a search by Ip.
- */
+ // ND request for an host. We do a search by Ip.
Set<Host> hosts = hostService.getHostsByIp(pkt.target());
- /*
- * Possible misconfiguration ? In future this case
- * should be handled we can have same hosts in different
- * vlans.
- */
+ // Possible misconfiguration ? In future this case
+ // should be handled we can have same hosts in different VLANs.
if (hosts.size() > 1) {
log.warn("More than one host with IP {}", pkt.target());
}
Host targetHost = hosts.stream().findFirst().orElse(null);
- /*
- * If we know the host forward to its attachment
- * point.
- */
+ // If we know the host forward to its attachment point.
if (targetHost != null) {
log.debug("Forward NDP request to the target host");
pkt.forward(targetHost.location());
} else {
- /*
- * Flood otherwise.
- */
+ // Flood otherwise.
log.debug("Flood NDP request to the target subnet");
flood(pkt);
}
+ */
}
}
@@ -378,21 +367,23 @@
Ip6Address hostIpAddress = pkt.sender().getIp6Address();
srManager.ipHandler.forwardPackets(pkt.inPort().deviceId(), hostIpAddress);
} else {
+ // NOTE: Ignore NDP packets except those target for the router
+ // We will reconsider enabling this when we have host learning support
+ /*
HostId hostId = HostId.hostId(pkt.dstMac(), pkt.vlan());
Host targetHost = hostService.getHost(hostId);
if (targetHost != null) {
log.debug("Forwarding the reply to the host");
pkt.forward(targetHost.location());
} else {
- /*
- * We don't have to flood towards spine facing ports.
- */
+ // We don't have to flood towards spine facing ports.
if (pkt.vlan().equals(SegmentRoutingManager.INTERNAL_VLAN)) {
return;
}
log.debug("Flooding the reply to the subnet");
flood(pkt);
}
+ */
}
}