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 eb33804..c67915b 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
@@ -1310,7 +1310,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))
@@ -1337,7 +1340,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))