return match;
}
+/* Lookup interface by prefix */
+struct interface *
+if_lookup_prefix (struct prefix *prefix)
+{
+ struct listnode *node;
+ struct prefix addr;
+ int bestlen = 0;
+ struct listnode *cnode;
+ struct interface *ifp;
+ struct connected *c;
+
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ {
+ for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
+ {
+ if (prefix_cmp(c->address, prefix) == 0)
+ {
+ return ifp;
+ }
+ }
+ }
+ return NULL;
+}
+
/* Get interface by name if given name interface doesn't exist create
one. */
struct interface *
extern struct interface *if_lookup_by_index (unsigned int);
extern struct interface *if_lookup_exact_address (struct in_addr);
extern struct interface *if_lookup_address (struct in_addr);
+extern struct interface *if_lookup_prefix (struct prefix *prefix);
/* These 2 functions are to be used when the ifname argument is terminated
by a '\0' character: */
struct ospf6_prefix *op;
char *start, *current, *end;
char buf[64];
+ struct interface *ifp;
+ int direct_connect = 0;
if (OSPF6_LSA_IS_MAXAGE (lsa))
return;
return;
}
+ if (intra_prefix_lsa->ref_adv_router == oa->ospf6->router_id)
+ {
+ /* the intra-prefix are directly connected */
+ direct_connect = 1;
+ }
+
prefix_num = ntohs (intra_prefix_lsa->prefix_num);
start = (caddr_t) intra_prefix_lsa +
sizeof (struct ospf6_intra_prefix_lsa);
route->path.cost = ls_entry->path.cost +
ntohs (op->prefix_metric);
- for (i = 0; ospf6_nexthop_is_set (&ls_entry->nexthop[i]) &&
- i < OSPF6_MULTI_PATH_LIMIT; i++)
- ospf6_nexthop_copy (&route->nexthop[i], &ls_entry->nexthop[i]);
+ if (direct_connect)
+ {
+ ifp = if_lookup_prefix(&route->prefix);
+ if (ifp)
+ route->nexthop[0].ifindex = ifp->ifindex;
+ }
+ else
+ {
+ for (i = 0; ospf6_nexthop_is_set (&ls_entry->nexthop[i]) &&
+ i < OSPF6_MULTI_PATH_LIMIT; i++)
+ ospf6_nexthop_copy (&route->nexthop[i], &ls_entry->nexthop[i]);
+ }
if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
{