* ospf_vty.c: Check carefully if interface exists before trying to
	  print info about it.

	Fixes bugzilla #213. [backport candidate]
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index cb16459..b546bbd 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-17 Hasso Tepper <hasso at quagga.net>
+
+	* ospf_vty.c: Check carefully if interface exists before trying to
+	  print info about it.
+
 2005-08-05 Hasso Tepper <hasso at quagga.net>
 
 	* ospf_zebra.c: Don't assert/stop before type == ZEBRA_ROUTE_MAX if
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 179464c..0f2a0fc 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -6533,7 +6533,7 @@
         if (or->type == OSPF_DESTINATION_NETWORK)
           for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path))
             {
-              if (path->oi != NULL)
+              if (path->oi != NULL && ospf_if_exists(path->oi))
                 {
                   if (path->nexthop.s_addr == 0)
                     vty_out (vty, "%24s   directly attached to %s%s",
@@ -6583,13 +6583,16 @@
                   
                   for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
                     {
-                      if (path->nexthop.s_addr == 0)
-                        vty_out (vty, "%24s   directly attached to %s%s",
-                                 "", path->oi->ifp->name, VTY_NEWLINE);
-                      else
-                        vty_out (vty, "%24s   via %s, %s%s", "",
-                                 inet_ntoa (path->nexthop), path->oi->ifp->name,
-                                            VTY_NEWLINE);
+		      if (path->oi != NULL && ospf_if_exists(path->oi))
+			{
+			  if (path->nexthop.s_addr == 0)
+			    vty_out (vty, "%24s   directly attached to %s%s",
+				     "", path->oi->ifp->name, VTY_NEWLINE);
+			  else
+			    vty_out (vty, "%24s   via %s, %s%s", "",
+				     inet_ntoa (path->nexthop),
+				     path->oi->ifp->name, VTY_NEWLINE);
+			}
                     }
           }
       }
@@ -6627,7 +6630,7 @@
 
         for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path))
           {
-            if (path->oi != NULL)
+            if (path->oi != NULL && ospf_if_exists(path->oi))
               {
                 if (path->nexthop.s_addr == 0)
                   vty_out (vty, "%24s   directly attached to %s%s",