static int ospf6_vertex_id_cmp (void *a, void *b) { struct ospf6_vertex *va = (struct ospf6_vertex *) a; struct ospf6_vertex *vb = (struct ospf6_vertex *) b; int ret = 0; ret = ntohl (ospf6_linkstate_prefix_adv_router (&va->vertex_id)) - ntohl (ospf6_linkstate_prefix_adv_router (&vb->vertex_id)); if (ret) return ret; ret = ntohl (ospf6_linkstate_prefix_id (&va->vertex_id)) - ntohl (ospf6_linkstate_prefix_id (&vb->vertex_id)); return ret; }
void ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry) { struct ospf6_lsa *lsa; u_int16_t type; u_int32_t router; if (! CHECK_FLAG (asbr_entry->flag, OSPF6_ROUTE_BEST)) { char buf[16]; inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&asbr_entry->prefix), buf, sizeof (buf)); zlog_info ("ignore non-best path: lsentry %s add", buf); return; } type = htons (OSPF6_LSTYPE_AS_EXTERNAL); router = ospf6_linkstate_prefix_adv_router (&asbr_entry->prefix); for (lsa = ospf6_lsdb_type_router_head (type, router, ospf6->lsdb); lsa; lsa = ospf6_lsdb_type_router_next (type, router, lsa)) { if (! OSPF6_LSA_IS_MAXAGE (lsa)) ospf6_asbr_lsa_add (lsa); } }
void ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry) { struct ospf6_lsa *lsa; u_int16_t type; u_int32_t router; type = htons (OSPF6_LSTYPE_AS_EXTERNAL); router = ospf6_linkstate_prefix_adv_router (&asbr_entry->prefix); for (lsa = ospf6_lsdb_type_router_head (type, router, ospf6->lsdb); lsa; lsa = ospf6_lsdb_type_router_next (type, router, lsa)) ospf6_asbr_lsa_remove (lsa); }