- Added more null check in IcmpHandler
- "isEdgeRouter" field is added in params of network configuration file
Change-Id: I749499dd7c63a8f9e732a144d705bcf3e09af02d
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/IcmpHandler.java b/src/main/java/net/onrc/onos/apps/segmentrouting/IcmpHandler.java
index 9366a2e..bca4bd5 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/IcmpHandler.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/IcmpHandler.java
@@ -105,8 +105,8 @@
if (ipv4.getProtocol() == IPv4.PROTOCOL_ICMP) {
- log.debug("ICMPHandler: Received a ICMP packet {} from sw {} ",
- payload.toString(), sw.getDpid());
+ log.debug("Received an ICMP packet from sw {} ",
+ sw.getDpid());
IPv4Address destinationAddress =
IPv4Address.of(ipv4.getDestinationAddress());
@@ -120,7 +120,7 @@
if (((ICMP) ipv4.getPayload()).getIcmpType() == ICMP_TYPE_ECHO &&
(destinationAddress.getInt() == switchIpAddress.getInt() ||
gatewayIps.contains(destinationAddress.toString()))) {
- log.debug("ICMPHandler: ICMP packet for sw {} and "
+ log.debug("ICMP packet for sw {} and "
+ "sending ICMP response ", sw.getDpid());
sendICMPResponse(sw, inPort, payload);
srManager.getIpPacketFromQueue(destinationAddress.getBytes());
@@ -166,8 +166,8 @@
}
}
/* ICMP for an unknown host */
- log.debug("ICMPHandler: ICMP request for unknown host {}"
- + " and sending ARP request", destinationAddress);
+ log.debug("ICMPHandler: ICMP request for unknown host {}",
+ destinationAddress);
srManager.sendArpRequest(sw, destinationAddress.getInt(), inPort);
}
@@ -283,6 +283,9 @@
// and the destination is not the neighbor switch, then add MPLS
// label
String targetMac = getRouterMACFromConfig(targetAddress);
+ if (targetMac == null) {
+ return; // targetMac should be always available
+ }
if (!sameSubnet && !targetMac.equals(destMacAddress)) {
int mplsLabel = getMplsLabelFromConfig(targetAddress);
if (mplsLabel > 0) {