Fix NPE of DHCP relay
Throws NPE when server not resolved.
Change-Id: I27cf7b5c93d60855d2c734ee6b9cff52742d7b07
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
index d809d53..05c639c 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
@@ -1308,7 +1308,10 @@
} else {
return null;
}
-
+ if (dhcpServerConnectPoint == null || dhcpConnectVlan == null) {
+ log.info("Default DHCP server {} not resolve yet", serverInfo.getDhcpGatewayIp6());
+ return null;
+ }
return interfaceService.getInterfacesByPort(dhcpServerConnectPoint)
.stream()
.filter(iface -> interfaceContainsVlan(iface, dhcpConnectVlan))
@@ -1335,7 +1338,10 @@
} else {
return getServerInterface();
}
-
+ if (indirectDhcpServerConnectPoint == null || indirectDhcpConnectVlan == null) {
+ log.info("Indirect DHCP server {} not resolve yet", serverInfo.getDhcpGatewayIp6());
+ return null;
+ }
return interfaceService.getInterfacesByPort(indirectDhcpServerConnectPoint)
.stream()
.filter(iface -> interfaceContainsVlan(iface, indirectDhcpConnectVlan))