Set R-bit in neighbor advertisement if replying as a router
Change-Id: Ic51140cf7ab88064df0bc87fb4d1fbc976ce7bc7
diff --git a/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java b/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
index af62525..cfef0f1 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
@@ -107,7 +107,7 @@
pkt.inPort().deviceId(), pkt.sender());
return;
}
- sendResponse(pkt, targetMac, hostService);
+ sendResponse(pkt, targetMac, hostService, true);
} else {
// NOTE: Ignore ARP packets except those target for the router
// We will reconsider enabling this when we have host learning support
diff --git a/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java b/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
index 3ec8b23..cb604a7 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
@@ -333,7 +333,7 @@
pkt.inPort().deviceId(), pkt.sender());
return;
}
- sendResponse(pkt, routerMac, hostService);
+ sendResponse(pkt, routerMac, hostService, true);
} else {
// Process NDP targets towards EUI-64 address.
@@ -343,7 +343,7 @@
Optional<Ip6Address> linkLocalIp = getLinkLocalIp(pkt.inPort());
if (linkLocalIp.isPresent() && pkt.target().equals(linkLocalIp.get())) {
MacAddress routerMac = config.getDeviceMac(deviceId);
- sendResponse(pkt, routerMac, hostService);
+ sendResponse(pkt, routerMac, hostService, true);
}
} catch (DeviceConfigNotFoundException e) {
log.warn(e.getMessage() + " Unable to handle NDP packet to {}. Aborting.", pkt.target());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java
index 200a190..8ef8e7e 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourHandler.java
@@ -121,8 +121,10 @@
* @param pkt the request
* @param targetMac the target mac
* @param hostService the host service
+ * @param isRouter true if this reply is sent on behalf of a router
*/
- protected void sendResponse(NeighbourMessageContext pkt, MacAddress targetMac, HostService hostService) {
+ protected void sendResponse(NeighbourMessageContext pkt, MacAddress targetMac, HostService hostService,
+ boolean isRouter) {
// if this is false, check if host exists in the store
if (!respondToUnknownHosts()) {
short vlanId = pkt.packet().getQinQVID();
@@ -135,6 +137,7 @@
return;
}
}
+ pkt.setIsRouter(isRouter);
pkt.reply(targetMac);
}