Configuration option respondToUnknownHosts.
Set this option to true to respond to arp requests
for unknown hosts [Default Value = True].
Change-Id: Ia2f10b2fae22b65cd2ec12a04accd9ad0ec15109
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 52ca18e..2417231 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -239,6 +239,10 @@
+ "when all uplinks are gone")
boolean singleHomedDown = false;
+ @Property(name = "respondToUnknownHosts", boolValue = true,
+ label = "Enable this to respond to ARP/NDP requests from unknown hosts.")
+ boolean respondToUnknownHosts = true;
+
ArpHandler arpHandler = null;
IcmpHandler icmpHandler = null;
IpHandler ipHandler = null;
@@ -589,8 +593,8 @@
return;
}
- String strActiveProving = Tools.get(properties, "activeProbing");
- boolean expectActiveProbing = Boolean.parseBoolean(strActiveProving);
+ String strActiveProbing = Tools.get(properties, "activeProbing");
+ boolean expectActiveProbing = Boolean.parseBoolean(strActiveProbing);
if (expectActiveProbing != activeProbing) {
activeProbing = expectActiveProbing;
log.info("{} active probing", activeProbing ? "Enabling" : "Disabling");
@@ -614,6 +618,13 @@
+ "downed ports for single-homed hosts");
}
}
+
+ String strRespondToUnknownHosts = Tools.get(properties, "respondToUnknownHosts");
+ boolean expectRespondToUnknownHosts = Boolean.parseBoolean(strRespondToUnknownHosts);
+ if (expectRespondToUnknownHosts != respondToUnknownHosts) {
+ respondToUnknownHosts = expectRespondToUnknownHosts;
+ log.info("{} responding to ARPs/NDPs from unknown hosts", respondToUnknownHosts ? "Enabling" : "Disabling");
+ }
}
@Override
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java
index 5752bfa..200a190 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java
@@ -107,6 +107,15 @@
}
/**
+ * Reads the boolean configuration for responding to unknown hosts.
+ *
+ * @return respondToUnknownHosts boolean.
+ */
+ protected boolean respondToUnknownHosts() {
+ return srManager.respondToUnknownHosts;
+ }
+
+ /**
* Utility to send a ND reply using the supplied information.
*
* @param pkt the request
@@ -114,14 +123,17 @@
* @param hostService the host service
*/
protected void sendResponse(NeighbourMessageContext pkt, MacAddress targetMac, HostService hostService) {
- short vlanId = pkt.packet().getQinQVID();
- HostId dstId = HostId.hostId(pkt.srcMac(), vlanId == Ethernet.VLAN_UNTAGGED
- ? pkt.vlan() : VlanId.vlanId(vlanId));
- Host dst = hostService.getHost(dstId);
- if (dst == null) {
- log.warn("Cannot send {} response to host {} - does not exist in the store",
- pkt.protocol(), dstId);
- return;
+ // if this is false, check if host exists in the store
+ if (!respondToUnknownHosts()) {
+ short vlanId = pkt.packet().getQinQVID();
+ HostId dstId = HostId.hostId(pkt.srcMac(), vlanId == Ethernet.VLAN_UNTAGGED
+ ? pkt.vlan() : VlanId.vlanId(vlanId));
+ Host dst = hostService.getHost(dstId);
+ if (dst == null) {
+ log.warn("Cannot send {} response to host {} - does not exist in the store",
+ pkt.protocol(), dstId);
+ return;
+ }
}
pkt.reply(targetMac);
}