summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_abr.c13
-rw-r--r--ospfd/ospf_ase.c3
-rw-r--r--ospfd/ospf_route.c11
-rw-r--r--ospfd/ospf_route.h2
-rw-r--r--ospfd/ospf_spf.c5
-rw-r--r--ospfd/ospf_vty.c23
-rw-r--r--ospfd/ospf_zebra.c8
7 files changed, 34 insertions, 31 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 88636f1a..7e32195b 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -814,15 +814,12 @@ ospf_abr_nexthops_belong_to_area (struct ospf_route *or,
{
struct listnode *node, *nnode;
struct ospf_path *path;
+ struct ospf_interface *oi;
- for (ALL_LIST_ELEMENTS (or->paths, node, nnode, path))
- {
- struct ospf_interface *oi = path->oi;
-
- if (oi != NULL)
- if (oi->area == area)
- return 1;
- }
+ for (ALL_LIST_ELEMENTS_RO (or->paths, node, path))
+ for (ALL_LIST_ELEMENTS_RO (area->oiflist, nnode, oi))
+ if (oi->ifp && oi->ifp->ifindex == path->ifindex)
+ return 1;
return 0;
}
diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c
index 044f97c6..7bddf3f4 100644
--- a/ospfd/ospf_ase.c
+++ b/ospfd/ospf_ase.c
@@ -135,6 +135,7 @@ ospf_ase_complete_direct_routes (struct ospf_route *ro, struct in_addr nexthop)
{
struct listnode *node;
struct ospf_path *op;
+ struct interface *ifp;
for (ALL_LIST_ELEMENTS_RO (ro->paths, node, op))
if (op->nexthop.s_addr == 0)
@@ -593,7 +594,7 @@ ospf_ase_route_match_same (struct route_table *rt, struct prefix *prefix,
if (! IPV4_ADDR_SAME (&op->nexthop, &newop->nexthop))
return 0;
- if (op->oi->ifp->ifindex != newop->oi->ifp->ifindex)
+ if (op->ifindex != newop->ifindex)
return 0;
}
return 1;
diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c
index 0829e8ea..267237b8 100644
--- a/ospfd/ospf_route.c
+++ b/ospfd/ospf_route.c
@@ -165,7 +165,7 @@ ospf_route_match_same (struct route_table *rt, struct prefix_ipv4 *prefix,
if (! IPV4_ADDR_SAME (&op->nexthop, &newop->nexthop))
return 0;
- if (op->oi->ifp->ifindex != newop->oi->ifp->ifindex)
+ if (op->ifindex != newop->ifindex)
return 0;
}
return 1;
@@ -640,7 +640,7 @@ ospf_intra_add_stub (struct route_table *rt, struct router_lsa_link *link,
path = ospf_path_new ();
path->nexthop.s_addr = 0;
- path->oi = oi;
+ path->ifindex = oi->ifp->ifindex;
listnode_add (or->paths, path);
}
else
@@ -788,7 +788,8 @@ ospf_path_exist (struct list *plist, struct in_addr nexthop,
struct ospf_path *path;
for (ALL_LIST_ELEMENTS (plist, node, nnode, path))
- if (IPV4_ADDR_SAME (&path->nexthop, &nexthop) && path->oi == oi)
+ if (IPV4_ADDR_SAME (&path->nexthop, &nexthop) &&
+ path->ifindex == oi->ifp->ifindex)
return 1;
return 0;
@@ -815,7 +816,7 @@ ospf_route_copy_nexthops_from_vertex (struct ospf_route *to,
{
path = ospf_path_new ();
path->nexthop = nexthop->router;
- path->oi = nexthop->oi;
+ path->ifindex = nexthop->oi->ifp->ifindex;
listnode_add (to->paths, path);
}
}
@@ -834,7 +835,7 @@ ospf_path_lookup (struct list *plist, struct ospf_path *path)
continue;
if (!IPV4_ADDR_SAME (&op->adv_router, &path->adv_router))
continue;
- if (op->oi->ifp->ifindex != path->oi->ifp->ifindex)
+ if (op->ifindex != path->ifindex)
continue;
return op;
}
diff --git a/ospfd/ospf_route.h b/ospfd/ospf_route.h
index 0d37436d..17ab68e5 100644
--- a/ospfd/ospf_route.h
+++ b/ospfd/ospf_route.h
@@ -39,7 +39,7 @@ struct ospf_path
{
struct in_addr nexthop;
struct in_addr adv_router;
- struct ospf_interface *oi;
+ unsigned int ifindex;
};
/* Below is the structure linked to every
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 12afe5d9..95668435 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -1077,13 +1077,14 @@ ospf_rtrs_print (struct route_table *rtrs)
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug (" directly attached to %s\r\n",
- IF_NAME (path->oi));
+ ifindex2ifname (path->ifindex));
}
else
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug (" via %s, %s\r\n",
- inet_ntoa (path->nexthop), IF_NAME (path->oi));
+ inet_ntoa (path->nexthop),
+ ifindex2ifname (path->ifindex));
}
}
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 2e4b6078..7c3dec8c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7138,15 +7138,15 @@ 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 && ospf_if_exists(path->oi))
+ if (if_lookup_by_index(path->ifindex))
{
if (path->nexthop.s_addr == 0)
vty_out (vty, "%24s directly attached to %s%s",
- "", path->oi->ifp->name, VTY_NEWLINE);
+ "", ifindex2ifname (path->ifindex), VTY_NEWLINE);
else
vty_out (vty, "%24s via %s, %s%s", "",
- inet_ntoa (path->nexthop), path->oi->ifp->name,
- VTY_NEWLINE);
+ inet_ntoa (path->nexthop),
+ ifindex2ifname (path->ifindex), VTY_NEWLINE);
}
}
}
@@ -7188,15 +7188,17 @@ show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs)
for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
{
- if (path->oi != NULL && ospf_if_exists(path->oi))
+ if (if_lookup_by_index(path->ifindex))
{
if (path->nexthop.s_addr == 0)
vty_out (vty, "%24s directly attached to %s%s",
- "", path->oi->ifp->name, VTY_NEWLINE);
+ "", ifindex2ifname (path->ifindex),
+ VTY_NEWLINE);
else
vty_out (vty, "%24s via %s, %s%s", "",
inet_ntoa (path->nexthop),
- path->oi->ifp->name, VTY_NEWLINE);
+ ifindex2ifname (path->ifindex),
+ VTY_NEWLINE);
}
}
}
@@ -7235,14 +7237,15 @@ 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 && ospf_if_exists(path->oi))
+ if (if_lookup_by_index(path->ifindex))
{
if (path->nexthop.s_addr == 0)
vty_out (vty, "%24s directly attached to %s%s",
- "", path->oi->ifp->name, VTY_NEWLINE);
+ "", ifindex2ifname (path->ifindex), VTY_NEWLINE);
else
vty_out (vty, "%24s via %s, %s%s", "",
- inet_ntoa (path->nexthop), path->oi->ifp->name,
+ inet_ntoa (path->nexthop),
+ ifindex2ifname (path->ifindex),
VTY_NEWLINE);
}
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 8f624a4d..52b23fe8 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -378,8 +378,8 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct ospf_route *or)
else
{
stream_putc (s, ZEBRA_NEXTHOP_IFINDEX);
- if (path->oi)
- stream_putl (s, path->oi->ifp->ifindex);
+ if (path->ifindex)
+ stream_putl (s, path->ifindex);
else
stream_putl (s, 0);
}
@@ -439,11 +439,11 @@ ospf_zebra_delete (struct prefix_ipv4 *p, struct ospf_route *or)
nexthop = &path->nexthop;
api.nexthop = &nexthop;
}
- else if (ospf_if_exists(path->oi) && (path->oi->ifp))
+ else if (if_lookup_by_index(path->ifindex))
{
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
api.ifindex_num = 1;
- api.ifindex = &path->oi->ifp->ifindex;
+ api.ifindex = &path->ifindex;
}
else if ( IS_DEBUG_OSPF(zebra,ZEBRA_REDISTRIBUTE) )
{