Revert "Use DAD to probe if interface MAC is not supplied"
This reverts commit a9458535b0510932734e20e666fab3e9a3a1ecd4.
This doesn't work when the target host has multiple interfaces with different VLANs. When receiving a DAD packet on an interface, the host will reply even when the probed IP is configured on another interface with a different VLAN. ONOS will thus learn a host in a wrong VLAN with the same IP.
Change-Id: I1ee427f1390ce36f26450b62e53c926ffad46ebf
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 2150bf1..034ef77 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
@@ -18,8 +18,6 @@
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;
@@ -196,25 +194,16 @@
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, sourceIp,
+ sendProbe(intf.connectPoint(), targetIp, ia.ipAddress(),
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, sourceIp,
+ sendProbe(intf.connectPoint(), targetIp, ia.ipAddress(),
intf.mac(), tag);
});
}