Use DAD to probe if interface MAC is not supplied
Such that probed host will not learn the ONOS dummy MAC from the probe.
Change-Id: I0c4505c8908da2370eed3c2617d1bcf9d921872f
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
index 2ef6355..e365236 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
@@ -20,6 +20,8 @@
import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv6;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
@@ -195,16 +197,25 @@
intf.ipAddressesList().stream()
.filter(ia -> ia.subnetAddress().contains(targetIp))
.forEach(ia -> {
+ // Use DAD to probe when interface MAC is not supplied,
+ // such that host will not learn ONOS dummy MAC from the probe.
+ IpAddress sourceIp;
+ if (!MacAddress.NONE.equals(intf.mac())) {
+ sourceIp = ia.ipAddress();
+ } else {
+ sourceIp = targetIp.isIp4() ? Ip4Address.ZERO : Ip6Address.ZERO;
+ }
+
log.debug("Sending probe for target:{} out of intf:{} vlan:{}",
targetIp, intf.connectPoint(), intf.vlan());
- sendProbe(intf.connectPoint(), targetIp, ia.ipAddress(),
+ sendProbe(intf.connectPoint(), targetIp, sourceIp,
intf.mac(), intf.vlan());
// account for use-cases where tagged-vlan config is used
if (!intf.vlanTagged().isEmpty()) {
intf.vlanTagged().forEach(tag -> {
log.debug("Sending probe for target:{} out of intf:{} vlan:{}",
targetIp, intf.connectPoint(), tag);
- sendProbe(intf.connectPoint(), targetIp, ia.ipAddress(),
+ sendProbe(intf.connectPoint(), targetIp, sourceIp,
intf.mac(), tag);
});
}