BUG5111: host_routes cause dhcpservice exception 17/33617/1
authorVishal Thapar <vishal.thapar@ericsson.com>
Wed, 27 Jan 2016 07:27:07 +0000 (12:57 +0530)
committerVishal Thapar <vishal.thapar@ericsson.com>
Wed, 27 Jan 2016 11:39:46 +0000 (11:39 +0000)
Change-Id: Ia2d6592d3801fa1d86ce157c8655c34cc80ef562
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
(cherry picked from commit 07f6cb98a8259e1d69a8fdbb9634f6ecb15362e3)

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) {