BUG5111: host_routes cause dhcpservice exception
[vpnservice.git] / dhcpservice / dhcpservice-impl / src / main / java / org / opendaylight / vpnservice / dhcpservice / DhcpPktHandler.java
index 3d10fa420b53edd9acf77a1233efc722c528194c..6a4539f11f4ab30b5f69e3ab9f1010d9e55bef6e 100644 (file)
@@ -457,8 +457,13 @@ public class DhcpPktHandler implements AutoCloseable, PacketProcessingListener {
         Iterator<HostRoutes> iter = hostRoutes.iterator();
         while(iter.hasNext()) {
             HostRoutes hostRoute = iter.next();
-            String router = hostRoute.getNexthop().toString();
-            String dest = hostRoute.getDestination().toString();
+            if(hostRoute.getNexthop().getIpv4Address() == null ||
+                hostRoute.getDestination().getIpv4Prefix() == null ) {
+                // we only deal with IPv4 addresses
+                return;
+            }
+            String router = hostRoute.getNexthop().getIpv4Address().getValue();
+            String dest = hostRoute.getDestination().getIpv4Prefix().getValue();
             try {
                 result.write(convertToClasslessRouteOption(dest, router));
             } catch (IOException | NullPointerException e) {