From 54bedb55d9f4185e35307a4178ad8d73a9a8857d Mon Sep 17 00:00:00 2001 From: hasso Date: Wed, 17 Aug 2005 13:31:47 +0000 Subject: * ospf_vty.c: Check carefully if interface exists before trying to print info about it. Fixes bugzilla #213. [backport candidate] --- ospfd/ChangeLog | 5 +++++ ospfd/ospf_vty.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'ospfd') diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index cb164590..b546bbd1 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,8 @@ +2005-08-17 Hasso Tepper + + * ospf_vty.c: Check carefully if interface exists before trying to + print info about it. + 2005-08-05 Hasso Tepper * 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 179464cc..0f2a0fce 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6533,7 +6533,7 @@ show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) 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 @@ show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) 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 @@ show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) 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", -- cgit v1.2.1