Commit b49e6f5a authored by Ondřej Zajíček's avatar Ondřej Zajíček

Temporary OSPFv3 development commit

parent c3226991
......@@ -86,6 +86,7 @@ int filter_same(struct filter *new, struct filter *old);
int i_same(struct f_inst *f1, struct f_inst *f2);
void f_prefix_get_bounds(struct f_prefix *px, int *l, int *h);
int val_compare(struct f_val v1, struct f_val v2);
void val_print(struct f_val v);
......
......@@ -272,7 +272,7 @@ static int
trie_node_print(struct f_trie_node *t, char *buf, int blen)
{
if (t == NULL)
return;
return 0;
int old_blen = blen;
int wb = 0; // bsnprintf(buf, blen, "%I/%d accept %I\n", t->addr, t->plen, t->accept);
......
......@@ -136,6 +136,60 @@ ipv6_compare(ip_addr X, ip_addr Y)
return 0;
}
/* From Linux include/net/ipv6.h */
#define NEXTHDR_HOP 0 /* Hop-by-hop option header. */
#define NEXTHDR_ROUTING 43 /* Routing header. */
#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
#define NEXTHDR_DEST 60 /* Destination options header. */
#define NEXTHDR_NONE 59 /* No next header */
#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
#define NEXTHDR_AUTH 51 /* Authentication header. */
byte *
ipv6_skip_header(byte *pkt, int *len)
{
int l = *len;
int q;
u8 nh;
if (l < 40 || (*pkt & 0xf0) != 0x60)
return NULL;
/* Skip IPv6 header */
nh = pkt[6];
pkt += 40;
while ()
{
switch (nw)
{
case NEXTHDR_FRAGMENT:
case NEXTHDR_HOP:
case NEXTHDR_ROUTING:
case NEXTHDR_DEST:
case NEXTHDR_AUTH:
break;
case NEXTHDR_NONE:
return NULL;
default:
return pkt;
}
}
q = (*pkt & 0x0f) * 4;
if (q > l)
return NULL;
*len -= q;
return pkt + q;
}
/*
* Conversion of IPv6 address to presentation format and vice versa.
* Heavily inspired by routines written by Paul Vixie for the BIND project
......
/*
* BIRD -- IP Addresses et Cetera for IPv6
*
......
......@@ -298,7 +298,7 @@ parse_path(struct adata *path, struct pm_pos *pos)
u8 *p = path->data;
u8 *q = p + path->length;
struct pm_pos *opos = pos;
int i, j, len;
int i, len;
while (p < q)
......
......@@ -71,7 +71,6 @@ ea__find(ea_list *e, unsigned id)
while (e)
{
/*
if (e->flags & EALF_BISECT)
{
l = 0;
......@@ -89,7 +88,6 @@ ea__find(ea_list *e, unsigned id)
}
}
else
*/
for(m=0; m<e->count; m++)
if (e->attrs[m].id == id)
return &e->attrs[m];
......
......@@ -1131,6 +1131,8 @@ as4_aggregator_valid(struct adata *aggr)
if ((a[0] == 0) || (a[1] == 0))
return 0;
return 1;
}
......
......@@ -488,7 +488,6 @@ bgp_parse_capabilities(struct bgp_conn *conn, byte *opt, int len)
{
struct bgp_proto *p = conn->bgp;
int cl;
u32 as;
while (len > 0)
{
......
......@@ -85,8 +85,9 @@ ospf_dbdes_send(struct ospf_neighbor *n, int next)
struct proto *p = &po->proto;
u16 length, i, j;
/* FIXME ??? */
if ((oa->rt == NULL) || (EMPTY_LIST(po->lsal)))
originate_rt_lsa(oa);
update_rt_lsa(oa);
switch (n->state)
{
......@@ -227,13 +228,14 @@ ospf_dbdes_reqladd(struct ospf_dbdes_packet *ps, struct ospf_neighbor *n)
for (i = 0; i < j; i++)
{
ntohlsah(plsa + i, &lsa);
if (((he = ospfxx_hash_find_smart(gr, n->ifa, &lsa)) == NULL) ||
u32 dom = ospf_lsa_domain(lsa.type, n->ifa);
if (((he = ospf_hash_find_header(gr, dom, &lsa)) == NULL) ||
(lsa_comp(&lsa, &(he->lsa)) == 1))
{
/* Is this condition necessary? */
if (ospfxx_hash_find_smart(n->lsrqh, n->ifa, &lsa) == NULL)
if (ospf_hash_find_header(n->lsrqh, dom, &lsa) == NULL)
{
sn = ospfxx_hash_get_smart(n->lsrqh, n->ifa, &lsa);
sn = ospf_hash_get_header(n->lsrqh, dom, &lsa);
ntohlsah(plsa + i, &(sn->lsa));
s_add_tail(&(n->lsrql), SNODE sn);
}
......
......@@ -48,7 +48,6 @@ ospf_hello_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
struct ospf_hello_packet *ps = (void *) ps_i;
u32 *pnrid;
u32 olddr, oldbdr, oldiface_id, tmp;
ip_addr mask;
char *beg = "Bad OSPF hello packet from ", *rec = " received: ";
struct proto *p = (struct proto *) ifa->oa->po;
unsigned int size = ntohs(ps->ospf_packet.length), i, twoway, oldpriority, eligible = 0, peers;
......
......@@ -420,6 +420,23 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface,
#ifdef OSPFv3
ifa->instance_id = ip->instance_id;
ifa->lladdr = IPA_NONE;
/* Find link-local address */
if (ifa->type != OSPF_IT_VLINK)
{
struct ifa *a;
WALK_LIST(a, iface->addrs)
if (a->scope == SCOPE_LINK)
{
ifa->lladdr = a->ip;
break;
}
if (! ipa_nonzero(ifa->lladdr))
log(L_WARN "%s: Missing link local address on interface %s", p->name, iface->name);
}
#endif
ifa->rxbuf = ip->rxbuf;
......
......@@ -177,7 +177,8 @@ ospf_lsack_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
for (i = 0; i < nolsa; i++)
{
ntohlsah(ps->lsh + i, &lsa);
if ((en = ospfxx_hash_find_smart(n->lsrth, n->ifa, &lsa)) == NULL)
u32 dom = ospf_lsa_domain(lsa.type, n->ifa);
if ((en = ospf_hash_find_header(n->lsrth, dom, &lsa)) == NULL)
continue; /* pg 155 */
if (lsa_comp(&lsa, &en->lsa) != CMP_SAME) /* pg 156 */
......
......@@ -384,12 +384,11 @@ lsa_install_new(struct proto_ospf *po, struct ospf_lsa_header *lsa, u32 domain,
{
/* LSA can be temporarrily, but body must be mb_allocated. */
int change = 0;
unsigned i;
struct top_hash_entry *en;
if ((en = ospfxx_hash_find_header(po->gr, domain, lsa)) == NULL)
if ((en = ospf_hash_find_header(po->gr, domain, lsa)) == NULL)
{
en = ospfxx_hash_get_header(po->gr, domain, lsa);
en = ospf_hash_get_header(po->gr, domain, lsa);
change = 1;
}
else
......
......@@ -127,7 +127,7 @@ ospf_lsreq_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
llsh->lsh.rt = hrt;
llsh->lsh.type = htype;
add_tail(&uplist, NODE llsh);
if (ospfxx_hash_find(po->gr, dom, hid, hrt, htype) == NULL)
if (ospf_hash_find(po->gr, dom, hid, hrt, htype) == NULL)
{
log(L_WARN
"Received bad LS req from: %I looking: Type: %u, ID: %R, RT: %R",
......
......@@ -156,7 +156,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
/* 13.3 (1b) */
if (nn->state < NEIGHBOR_FULL)
{
if ((en = ospfxx_hash_find_header(nn->lsrqh, domain, hh)) != NULL)
if ((en = ospf_hash_find_header(nn->lsrqh, domain, hh)) != NULL)
{
DBG("That LSA found in lsreq list for neigh %R\n", nn->rid);
......@@ -203,9 +203,9 @@ ospf_lsupd_flood(struct proto_ospf *po,
that type of LSA (for LSA types with U-bit == 0). But as we does not support
any optional LSA types, this is not needed yet */
if ((en = ospfxx_hash_find_header(nn->lsrth, domain, hh)) == NULL)
if ((en = ospf_hash_find_header(nn->lsrth, domain, hh)) == NULL)
{
en = ospfxx_hash_get_header(nn->lsrth, domain, hh);
en = ospf_hash_get_header(nn->lsrth, domain, hh);
}
else
{
......@@ -217,7 +217,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
}
else
{
if ((en = ospfxx_hash_find_header(nn->lsrth, domain, hh)) != NULL)
if ((en = ospf_hash_find_header(nn->lsrth, domain, hh)) != NULL)
{
s_rem_node(SNODE en);
if (en->lsa_body != NULL)
......@@ -274,7 +274,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
htonlsah(hh, lh);
help = (u8 *) (lh + 1);
en = ospfxx_hash_find_header(po->gr, domain, hh);
en = ospf_hash_find_header(po->gr, domain, hh);
htonlsab(en->lsa_body, help, hh->type, hh->length
- sizeof(struct ospf_lsa_header));
}
......@@ -347,7 +347,7 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l)
WALK_LIST(llsh, *l)
{
u32 domain = ospf_lsa_domain(llsh->lsh.type, n->ifa);
if ((en = ospfxx_hash_find(po->gr, domain, llsh->lsh.id,
if ((en = ospf_hash_find(po->gr, domain, llsh->lsh.id,
llsh->lsh.rt, llsh->lsh.type)) == NULL)
continue; /* Probably flushed LSA */
/* FIXME This is a bug! I cannot flush LSA that is in lsrt */
......@@ -487,7 +487,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
lsatmp.type, lsatmp.id, lsatmp.rt, lsatmp.sn, lsatmp.age, lsatmp.checksum);
u32 domain = ospf_lsa_domain(lsatmp.type, ifa);
lsadb = ospfxx_hash_find_header(po->gr, domain, &lsatmp);
lsadb = ospf_hash_find_header(po->gr, domain, &lsatmp);
#ifdef LOCAL_DEBUG
if (lsadb)
......@@ -508,7 +508,6 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
{
struct ospf_iface *ift = NULL;
void *body;
struct ospf_iface *nifa;
int self = (lsatmp.rt == p->cf->global->router_id);
DBG("PG143(5): Received LSA is newer\n");
......@@ -517,6 +516,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
/* 13.4 - check self-originated LSAs of NET type */
if ((!self) && (lsatmp.type == LSA_T_NET))
{
struct ospf_iface *nifa;
WALK_LIST(nifa, po->iface_list)
{
if (!nifa->iface)
......@@ -551,7 +551,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */
lsatmp.checksum = ntohs(lsa->checksum);
ospf_lsupd_flood(po, NULL, lsa, &lsatmp, domain, 0);
if (en = ospfxx_hash_find_header(po->gr, domain, &lsatmp))
if (en = ospf_hash_find_header(po->gr, domain, &lsatmp))
{ /* FIXME verify hacks */
ospf_lsupd_flood(po, NULL, NULL, &en->lsa, domain, 1);
}
......@@ -586,7 +586,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
{
struct top_hash_entry *en;
if (ntmp->state > NEIGHBOR_EXSTART)
if ((en = ospfxx_hash_find_header(ntmp->lsrth, domain, &lsadb->lsa)) != NULL)
if ((en = ospf_hash_find_header(ntmp->lsrth, domain, &lsadb->lsa)) != NULL)
{
s_rem_node(SNODE en);
if (en->lsa_body != NULL)
......@@ -622,7 +622,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
{
struct top_hash_entry *en;
DBG("PG145(7) Got the same LSA\n");
if ((en = ospfxx_hash_find_header(n->lsrth, lsadb->domain, &lsadb->lsa)) != NULL)
if ((en = ospf_hash_find_header(n->lsrth, lsadb->domain, &lsadb->lsa)) != NULL)
{
/* pg145 (7a) */
s_rem_node(SNODE en);
......
......@@ -173,16 +173,16 @@ electbdr(list nl)
struct ospf_neighbor *neigh, *n1, *n2;
u32 nid;
#ifdef OSPFv2
nid = ipa_to_u32(neigh->ip);
#else /* OSPFv3 */
nid = neigh->rid;
#endif
n1 = NULL;
n2 = NULL;
WALK_LIST(neigh, nl) /* First try those decl. themselves */
{
#ifdef OSPFv2
nid = ipa_to_u32(neigh->ip);
#else /* OSPFv3 */
nid = neigh->rid;
#endif
if (neigh->state >= NEIGHBOR_2WAY) /* Higher than 2WAY */
if (neigh->priority > 0) /* Eligible */
if (neigh->dr != nid) /* And not decl. itself DR */
......@@ -231,15 +231,15 @@ electdr(list nl)
struct ospf_neighbor *neigh, *n;
u32 nid;
n = NULL;
WALK_LIST(neigh, nl) /* And now DR */
{
#ifdef OSPFv2
nid = ipa_to_u32(neigh->ip);
nid = ipa_to_u32(neigh->ip);
#else /* OSPFv3 */
nid = neigh->rid;
nid = neigh->rid;
#endif
n = NULL;
WALK_LIST(neigh, nl) /* And now DR */
{
if (neigh->state >= NEIGHBOR_2WAY) /* Higher than 2WAY */
if (neigh->priority > 0) /* Eligible */
if (neigh->dr == nid) /* And declaring itself DR */
......
......@@ -337,7 +337,7 @@ schedule_rtcalc(struct proto_ospf *po)
* @oa: ospf area
*
* It invokes aging and when @ospf_area->origrt is set to 1, start
* function for origination of router LSA and network LSAs.
* function for origination of router, network LSAs.
*/
void
area_disp(struct ospf_area *oa)
......@@ -347,13 +347,18 @@ area_disp(struct ospf_area *oa)
/* Now try to originage rt_lsa */
if (oa->origrt)
originate_rt_lsa(oa);
update_rt_lsa(oa);
/* Now try to originate network LSA's */
WALK_LIST(ifa, po->iface_list)
{
#ifdef OSPFv3
if (ifa->origlink && (ifa->oa == oa))
update_link_lsa(ifa);
#endif
if (ifa->orignet && (ifa->oa == oa))
originate_net_lsa(ifa);
update_net_lsa(ifa);
}
}
......@@ -376,7 +381,7 @@ ospf_disp(timer * timer)
/* Calculate routing table */
if (po->calcrt)
ospf_rt_spf (po);
ospf_rt_spf(po);
}
......@@ -1019,6 +1024,7 @@ ospf_sh_iface(struct proto *p, char *iff)
* according to originating router id (to get all LSA needed to represent one
* router node together). Then, according to LSA type, ID and age.
*/
/*
static int
he_compare(const void *p1, const void *p2)
{
......@@ -1057,6 +1063,7 @@ he_compare(const void *p1, const void *p2)
return lsa1->age - lsa2->age;
}
}
*/
/*
static inline void
show_lsa_router(struct top_hash_entry *he)
......@@ -1074,7 +1081,7 @@ show_lsa_router(struct top_hash_entry *he)
if (rr[i].type == LSART_NET)
{
struct proto_ospf *po = he->oa->po;
struct top_hash_entry *net_he = ospfxx_hash_find(po->gr, he->oa->areaid, rr[i].id, rr[i].id, LSA_T_NET);
struct top_hash_entry *net_he = ospf_hash_find(po->gr, he->oa->areaid, rr[i].id, rr[i].id, LSA_T_NET);
if (net_he)
{
struct ospf_lsa_header *net_lsa = &(net_he->lsa);
......@@ -1152,12 +1159,13 @@ show_lsa_external(struct top_hash_entry *he)
void
ospf_sh_state(struct proto *p, int verbose)
{
/*
struct proto_ospf *po = (struct proto_ospf *) p;
struct top_graph *f = po->gr;
unsigned int i, j;
u32 last_rt = 0xFFFFFFFF;
u32 last_area = 0xFFFFFFFF;
/*
if (p->proto_state != PS_UP)
{
cli_msg(-1016, "%s: is not up", p->name);
......
......@@ -194,6 +194,7 @@ struct ospf_iface
u32 dr_iface_id; /* if drid is valid, this is iface_id of DR (for connecting network) */
u8 instance_id; /* Used to differentiate between more OSPF
instances on one interface */
ip_addr lladdr; /* Used link-local addr */
#endif
u8 type; /* OSPF view of type */
......@@ -371,8 +372,8 @@ struct ospf_lsa_header
u32 id;
u32 rt; /* Advertising router */
s32 sn; /* LS Sequence number */
#define LSA_INITSEQNO 0x80000001
#define LSA_MAXSEQNO 0x7fffffff
#define LSA_INITSEQNO ((s32) 0x80000001)
#define LSA_MAXSEQNO ((s32) 0x7fffffff)
u16 checksum;
u16 length;
};
......
......@@ -278,7 +278,7 @@ ospf_rx_hook(sock * sk, int size)
if (ifa->stub)
return (1);
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
ps = (struct ospf_packet *) ip_skip_header(sk->rbuf, &size);
if (ps == NULL)
{
......
......@@ -8,12 +8,12 @@
#include "ospf.h"
static void
add_cand(list * l, struct top_hash_entry *en,
struct top_hash_entry *par, u32 dist, struct ospf_area *oa);
static void
calc_next_hop(struct top_hash_entry *en,
struct top_hash_entry *par, struct ospf_area *oa);
static void add_cand(list * l, struct top_hash_entry *en,
struct top_hash_entry *par, u32 dist,
struct ospf_area *oa);
static void calc_next_hop(struct ospf_area *oa,
struct top_hash_entry *en,
struct top_hash_entry *par);
static void ospf_ext_spf(struct proto_ospf *po);
static void rt_sync(struct proto_ospf *po);
......@@ -27,10 +27,11 @@ static void rt_sync(struct proto_ospf *po);
static inline u32 *
get_ipv6_prefix(u32 *buf, ip_addr *addr, int *pxlen, u8 *pxopts)
get_ipv6_prefix(u32 *buf, ip_addr *addr, int *pxlen, u8 *pxopts, u16 *rest)
{
u8 pxl = (*buf >> 24);
*pxopts = (*buf >> 16);
*rest = *buf;
*pxlen = pxl;
buf++;
......@@ -174,6 +175,79 @@ ri_install(struct proto_ospf *po, ip_addr prefix, int pxlen, int dest,
}
}
static void
add_network(struct ospf_area *oa, ip_addr px, int pxlen, int metric, struct top_hash_entry *en)
{
orta nf;
nf.type = RTS_OSPF;
nf.options = 0;
nf.metric1 = metric;
nf.metric2 = LSINFINITY;
nf.tag = 0;
nf.oa = oa;
nf.ar = en;
nf.nh = en->nh;
nf.ifa = en->nhi;
/* FIXME check nf.ifa on stubs */
ri_install(oa->po, px, pxlen, ORT_NET, &nf, NULL);
}
#ifdef OSPFv3
static void
process_prefixes(struct ospf_area *oa)
{
struct proto_ospf *po = oa->po;
struct proto *p = &po->proto;
struct top_hash_entry *en, *src;
struct ospf_lsa_prefix *px;
ip_addr pxa;
int pxlen;
u8 pxopts;
u16 metric;
u32 *buf;
int i;
WALK_SLIST(en, po->lsal)
{
if (en->lsa.type != LSA_T_PREFIX)
continue;
if (en->domain != oa->areaid)
continue;
if (en->lsa.age == LSA_MAXAGE)
continue;
px = en->lsa_body;
/* FIXME: for router LSA, we should find the first one */
src = ospf_hash_find(po->gr, oa->areaid,
((px->ref_type == LSA_T_RT) ? px->ref_rt : px->ref_id),
px->ref_rt, px->ref_type);
if (!src)
continue;
if (src->lsa.age == LSA_MAXAGE)
continue;
if ((src->lsa.type != LSA_T_RT) && (src->lsa.type != LSA_T_NET))
continue;
buf = px->rest;
for (i = 0; i < px->pxcount; i++)
{
buf = get_ipv6_prefix(buf, &pxa, &pxlen, &pxopts, &metric);
if (pxopts & OPT_PX_NU)
continue;
add_network(oa, pxa, pxlen, src->dist + metric, src);
}
}
}
#endif
static void
ospf_rt_spfa(struct ospf_area *oa)
{
......@@ -188,7 +262,6 @@ ospf_rt_spfa(struct ospf_area *oa)
struct top_hash_entry *act, *tmp;
node *n;
if (oa->rt == NULL)
return;
......@@ -226,20 +299,22 @@ ospf_rt_spfa(struct ospf_area *oa)
rt = (struct ospf_lsa_rt *) act->lsa_body;
if (rt->options & OPT_RT_V)
oa->trcap = 1;
/* FIXME - in OSPFv3, should we add all routers, or just ABRs an ASBRs? */
if ((rt->options & OPT_RT_V) || (rt->options & OPT_RT_E))
{
nf.type = RTS_OSPF;
nf.options = rt->options;
nf.metric1 = act->dist;
nf.metric2 = LSINFINITY;
nf.tag = 0;
nf.oa = oa;
nf.ar = act;
nf.nh = act->nh;
nf.ifa = act->nhi;
ri_install(po, ipa_from_rid(act->lsa.rt), 32, ORT_ROUTER, &nf, NULL);
}
{
nf.type = RTS_OSPF;
nf.options = rt->options;
nf.metric1 = act->dist;
nf.metric2 = LSINFINITY;
nf.tag = 0;
nf.oa = oa;
nf.ar = act;
nf.nh = act->nh;
nf.ifa = act->nhi;
ri_install(po, ipa_from_rid(act->lsa.rt), 32, ORT_ROUTER, &nf, NULL);
}
rr = (struct ospf_lsa_rt_link *) (rt + 1);
DBG(" Number of links: %u\n", rt->links);
for (i = 0; i < lsa_rt_count(&act->lsa); i++)
......@@ -253,7 +328,6 @@ ospf_rt_spfa(struct ospf_area *oa)
case LSART_STUB:
/*
* This violates rfc2328! But it is mostly harmless.
* But it causes that the cost of the stub is ignored.
*/
DBG("\n");
......@@ -293,9 +367,9 @@ ospf_rt_spfa(struct ospf_area *oa)
case LSART_NET:
#ifdef OSPFv2
/* In OSPFv2, rtl->id is IP addres of DR, router ID is not known */
tmp = ospfxx_hash_find(po->gr, oa->areaid, rtl->id, 0, LSA_T_NET);
tmp = ospf_hash_find(po->gr, oa->areaid, rtl->id, 0, LSA_T_NET);
#else /* OSPFv3 */
tmp = ospfxx_hash_find(po->gr, oa->areaid, rtl->nif, rtl->id, LSA_T_NET);
tmp = ospf_hash_find(po->gr, oa->areaid, rtl->nif, rtl->id, LSA_T_NET);
#endif
if (tmp == NULL)
DBG("Not found!\n");
......@@ -305,8 +379,9 @@ ospf_rt_spfa(struct ospf_area *oa)
case LSART_VLNK:
case LSART_PTP:
/* FIXME - in OSPFv3, find any LSA ID */
tmp = ospfxx_hash_find(po->gr, oa->areaid, rtl->id, rtl->id, LSA_T_RT);
/* FIXME - in OSPFv3, find lowest LSA ID */
tmp = ospf_hash_find(po->gr, oa->areaid, rtl->id, rtl->id, LSA_T_RT);
DBG("PTP found.\n");
break;
default:
......@@ -321,24 +396,18 @@ ospf_rt_spfa(struct ospf_area *oa)
break;
case LSA_T_NET:
ln = act->lsa_body;
nf.type = RTS_OSPF;
nf.options = 0;
nf.metric1 = act->dist;
nf.metric2 = LSINFINITY;
nf.tag = 0;
nf.oa = oa;
nf.ar = act;
nf.nh = act->nh;
nf.ifa = act->nhi;
ri_install(po, ipa_and(ipa_from_u32(act->lsa.id), ln->netmask),
ipa_mklen(ln->netmask), ORT_NET, &nf, NULL);
#ifdef OSPFv2
add_network(oa, ipa_and(ipa_from_u32(act->lsa.id), ln->netmask),
ipa_mklen(ln->netmask), act->dist, act);
#endif
rts = (u32 *) (ln + 1);
for (i = 0; i < lsa_net_count(&act->lsa); i++)
{
DBG(" Working on router %R ", rts[i]);
/* FIXME - in OSPFv3, find any LSA ID */
tmp = ospfxx_hash_find(po->gr, oa->areaid, rts[i], rts[i], LSA_T_RT);
tmp = ospf_hash_find(po->gr, oa->areaid, rts[i], rts[i], LSA_T_RT);
if (tmp != NULL)
DBG("Found :-)\n");
else
......@@ -349,13 +418,17 @@ ospf_rt_spfa(struct ospf_area *oa)
}
}
#ifdef OSPFv3
process_prefixes(oa);
#endif
/* Find new/lost VLINK peers */
WALK_LIST(iface, po->iface_list)
{
if ((iface->type == OSPF_IT_VLINK) && (iface->voa == oa))
{
/* FIXME in OSPFv3, different LSAID */
if ((tmp = ospfxx_hash_find(po->gr, oa->areaid, iface->vid, iface->vid, LSA_T_RT)) &&
if ((tmp = ospf_hash_find(po->gr, oa->areaid, iface->vid, iface->vid, LSA_T_RT)) &&
(!ipa_equal(tmp->lb, IPA_NONE)))
{
if ((iface->state != OSPF_IS_PTP) || (iface->iface != tmp->nhi->iface) || (!ipa_equal(iface->vip, tmp->lb)))
......@@ -379,6 +452,7 @@ ospf_rt_spfa(struct ospf_area *oa)
}
}
#if 0
static int
link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entry *pre)
{
......@@ -403,7 +477,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
case LSART_STUB:
break;
case LSART_NET:
if (ospfxx_hash_find(po->gr, oa->areaid, rtl->id, rtl->id, LSA_T_NET) == pre)
if (ospf_hash_find(po->gr, oa->areaid, rtl->id, rtl->id, LSA_T_NET) == pre)
{
fol->lb = ipa_from_u32(rtl->data);
return 1;
......@@ -411,7 +485,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
break;
case LSART_VLNK:
case LSART_PTP:
if (ospfxx_hash_find(po->gr, oa->areaid, rtl->id, rtl->id, LSA_T_RT) == pre)
if (ospf_hash_find(po->gr, oa->areaid, rtl->id, rtl->id, LSA_T_RT) == pre)
{
fol->lb = ipa_from_u32(rtl->data);
return 1;
......@@ -428,7 +502,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *fol, struct top_hash_entr
rts = (u32 *) (ln + 1);
for (i = 0; i < lsa_net_count(&fol->lsa); i++)
{
if (ospfxx_hash_find(po->gr, oa->areaid, *(rts + i), *(rts + i), LSA_T_RT) == pre)
if (ospf_hash_find(po->gr, oa->areaid, *(rts + i), *(rts + i), LSA_T_RT) == pre)