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); ...@@ -86,6 +86,7 @@ int filter_same(struct filter *new, struct filter *old);
int i_same(struct f_inst *f1, struct f_inst *f2); 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); int val_compare(struct f_val v1, struct f_val v2);
void val_print(struct f_val v); void val_print(struct f_val v);
......
...@@ -272,7 +272,7 @@ static int ...@@ -272,7 +272,7 @@ static int
trie_node_print(struct f_trie_node *t, char *buf, int blen) trie_node_print(struct f_trie_node *t, char *buf, int blen)
{ {
if (t == NULL) if (t == NULL)
return; return 0;
int old_blen = blen; int old_blen = blen;
int wb = 0; // bsnprintf(buf, blen, "%I/%d accept %I\n", t->addr, t->plen, t->accept); 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) ...@@ -136,6 +136,60 @@ ipv6_compare(ip_addr X, ip_addr Y)
return 0; 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. * Conversion of IPv6 address to presentation format and vice versa.
* Heavily inspired by routines written by Paul Vixie for the BIND project * Heavily inspired by routines written by Paul Vixie for the BIND project
......
/* /*
* BIRD -- IP Addresses et Cetera for IPv6 * BIRD -- IP Addresses et Cetera for IPv6
* *
......
...@@ -298,7 +298,7 @@ parse_path(struct adata *path, struct pm_pos *pos) ...@@ -298,7 +298,7 @@ parse_path(struct adata *path, struct pm_pos *pos)
u8 *p = path->data; u8 *p = path->data;
u8 *q = p + path->length; u8 *q = p + path->length;
struct pm_pos *opos = pos; struct pm_pos *opos = pos;
int i, j, len; int i, len;
while (p < q) while (p < q)
......
...@@ -71,7 +71,6 @@ ea__find(ea_list *e, unsigned id) ...@@ -71,7 +71,6 @@ ea__find(ea_list *e, unsigned id)
while (e) while (e)
{ {
/*
if (e->flags & EALF_BISECT) if (e->flags & EALF_BISECT)
{ {
l = 0; l = 0;
...@@ -89,7 +88,6 @@ ea__find(ea_list *e, unsigned id) ...@@ -89,7 +88,6 @@ ea__find(ea_list *e, unsigned id)
} }
} }
else else
*/
for(m=0; m<e->count; m++) for(m=0; m<e->count; m++)
if (e->attrs[m].id == id) if (e->attrs[m].id == id)
return &e->attrs[m]; return &e->attrs[m];
......
...@@ -1131,6 +1131,8 @@ as4_aggregator_valid(struct adata *aggr) ...@@ -1131,6 +1131,8 @@ as4_aggregator_valid(struct adata *aggr)
if ((a[0] == 0) || (a[1] == 0)) if ((a[0] == 0) || (a[1] == 0))
return 0; return 0;
return 1;
} }
......
...@@ -488,7 +488,6 @@ bgp_parse_capabilities(struct bgp_conn *conn, byte *opt, int len) ...@@ -488,7 +488,6 @@ bgp_parse_capabilities(struct bgp_conn *conn, byte *opt, int len)
{ {
struct bgp_proto *p = conn->bgp; struct bgp_proto *p = conn->bgp;
int cl; int cl;
u32 as;
while (len > 0) while (len > 0)
{ {
......
...@@ -85,8 +85,9 @@ ospf_dbdes_send(struct ospf_neighbor *n, int next) ...@@ -85,8 +85,9 @@ ospf_dbdes_send(struct ospf_neighbor *n, int next)
struct proto *p = &po->proto; struct proto *p = &po->proto;
u16 length, i, j; u16 length, i, j;
/* FIXME ??? */
if ((oa->rt == NULL) || (EMPTY_LIST(po->lsal))) if ((oa->rt == NULL) || (EMPTY_LIST(po->lsal)))
originate_rt_lsa(oa); update_rt_lsa(oa);
switch (n->state) switch (n->state)
{ {
...@@ -227,13 +228,14 @@ ospf_dbdes_reqladd(struct ospf_dbdes_packet *ps, struct ospf_neighbor *n) ...@@ -227,13 +228,14 @@ ospf_dbdes_reqladd(struct ospf_dbdes_packet *ps, struct ospf_neighbor *n)
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
{ {
ntohlsah(plsa + i, &lsa); 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)) (lsa_comp(&lsa, &(he->lsa)) == 1))
{ {
/* Is this condition necessary? */ /* 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)); ntohlsah(plsa + i, &(sn->lsa));
s_add_tail(&(n->lsrql), SNODE sn); s_add_tail(&(n->lsrql), SNODE sn);
} }
......
...@@ -48,7 +48,6 @@ ospf_hello_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -48,7 +48,6 @@ ospf_hello_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
struct ospf_hello_packet *ps = (void *) ps_i; struct ospf_hello_packet *ps = (void *) ps_i;
u32 *pnrid; u32 *pnrid;
u32 olddr, oldbdr, oldiface_id, tmp; u32 olddr, oldbdr, oldiface_id, tmp;
ip_addr mask;
char *beg = "Bad OSPF hello packet from ", *rec = " received: "; char *beg = "Bad OSPF hello packet from ", *rec = " received: ";
struct proto *p = (struct proto *) ifa->oa->po; struct proto *p = (struct proto *) ifa->oa->po;
unsigned int size = ntohs(ps->ospf_packet.length), i, twoway, oldpriority, eligible = 0, peers; 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, ...@@ -420,6 +420,23 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface,
#ifdef OSPFv3 #ifdef OSPFv3
ifa->instance_id = ip->instance_id; 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 #endif
ifa->rxbuf = ip->rxbuf; ifa->rxbuf = ip->rxbuf;
......
...@@ -177,7 +177,8 @@ ospf_lsack_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -177,7 +177,8 @@ ospf_lsack_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
for (i = 0; i < nolsa; i++) for (i = 0; i < nolsa; i++)
{ {
ntohlsah(ps->lsh + i, &lsa); 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 */ continue; /* pg 155 */
if (lsa_comp(&lsa, &en->lsa) != CMP_SAME) /* pg 156 */ 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, ...@@ -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. */ /* LSA can be temporarrily, but body must be mb_allocated. */
int change = 0; int change = 0;
unsigned i;
struct top_hash_entry *en; 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; change = 1;
} }
else else
......
...@@ -127,7 +127,7 @@ ospf_lsreq_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -127,7 +127,7 @@ ospf_lsreq_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
llsh->lsh.rt = hrt; llsh->lsh.rt = hrt;
llsh->lsh.type = htype; llsh->lsh.type = htype;
add_tail(&uplist, NODE llsh); 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 log(L_WARN
"Received bad LS req from: %I looking: Type: %u, ID: %R, RT: %R", "Received bad LS req from: %I looking: Type: %u, ID: %R, RT: %R",
......
...@@ -156,7 +156,7 @@ ospf_lsupd_flood(struct proto_ospf *po, ...@@ -156,7 +156,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
/* 13.3 (1b) */ /* 13.3 (1b) */
if (nn->state < NEIGHBOR_FULL) 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); DBG("That LSA found in lsreq list for neigh %R\n", nn->rid);
...@@ -203,9 +203,9 @@ ospf_lsupd_flood(struct proto_ospf *po, ...@@ -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 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 */ 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 else
{ {
...@@ -217,7 +217,7 @@ ospf_lsupd_flood(struct proto_ospf *po, ...@@ -217,7 +217,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
} }
else 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); s_rem_node(SNODE en);
if (en->lsa_body != NULL) if (en->lsa_body != NULL)
...@@ -274,7 +274,7 @@ ospf_lsupd_flood(struct proto_ospf *po, ...@@ -274,7 +274,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
htonlsah(hh, lh); htonlsah(hh, lh);
help = (u8 *) (lh + 1); 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 htonlsab(en->lsa_body, help, hh->type, hh->length
- sizeof(struct ospf_lsa_header)); - sizeof(struct ospf_lsa_header));
} }
...@@ -347,7 +347,7 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l) ...@@ -347,7 +347,7 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l)
WALK_LIST(llsh, *l) WALK_LIST(llsh, *l)
{ {
u32 domain = ospf_lsa_domain(llsh->lsh.type, n->ifa); 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) llsh->lsh.rt, llsh->lsh.type)) == NULL)
continue; /* Probably flushed LSA */ continue; /* Probably flushed LSA */
/* FIXME This is a bug! I cannot flush LSA that is in lsrt */ /* 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, ...@@ -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); lsatmp.type, lsatmp.id, lsatmp.rt, lsatmp.sn, lsatmp.age, lsatmp.checksum);
u32 domain = ospf_lsa_domain(lsatmp.type, ifa); 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 #ifdef LOCAL_DEBUG
if (lsadb) if (lsadb)
...@@ -508,7 +508,6 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -508,7 +508,6 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
{ {
struct ospf_iface *ift = NULL; struct ospf_iface *ift = NULL;
void *body; void *body;
struct ospf_iface *nifa;
int self = (lsatmp.rt == p->cf->global->router_id); int self = (lsatmp.rt == p->cf->global->router_id);
DBG("PG143(5): Received LSA is newer\n"); DBG("PG143(5): Received LSA is newer\n");
...@@ -517,6 +516,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -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 */ /* 13.4 - check self-originated LSAs of NET type */
if ((!self) && (lsatmp.type == LSA_T_NET)) if ((!self) && (lsatmp.type == LSA_T_NET))
{ {
struct ospf_iface *nifa;
WALK_LIST(nifa, po->iface_list) WALK_LIST(nifa, po->iface_list)
{ {
if (!nifa->iface) if (!nifa->iface)
...@@ -551,7 +551,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -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! */ lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */
lsatmp.checksum = ntohs(lsa->checksum); lsatmp.checksum = ntohs(lsa->checksum);
ospf_lsupd_flood(po, NULL, lsa, &lsatmp, domain, 0); 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 */ { /* FIXME verify hacks */
ospf_lsupd_flood(po, NULL, NULL, &en->lsa, domain, 1); 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, ...@@ -586,7 +586,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
{ {
struct top_hash_entry *en; struct top_hash_entry *en;
if (ntmp->state > NEIGHBOR_EXSTART) 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); s_rem_node(SNODE en);
if (en->lsa_body != NULL) if (en->lsa_body != NULL)
...@@ -622,7 +622,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, ...@@ -622,7 +622,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
{ {
struct top_hash_entry *en; struct top_hash_entry *en;
DBG("PG145(7) Got the same LSA\n"); 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) */ /* pg145 (7a) */
s_rem_node(SNODE en); s_rem_node(SNODE en);
......
...@@ -173,16 +173,16 @@ electbdr(list nl) ...@@ -173,16 +173,16 @@ electbdr(list nl)
struct ospf_neighbor *neigh, *n1, *n2; struct ospf_neighbor *neigh, *n1, *n2;
u32 nid; u32 nid;
#ifdef OSPFv2
nid = ipa_to_u32(neigh->ip);
#else /* OSPFv3 */
nid = neigh->rid;
#endif
n1 = NULL; n1 = NULL;
n2 = NULL; n2 = NULL;
WALK_LIST(neigh, nl) /* First try those decl. themselves */ 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->state >= NEIGHBOR_2WAY) /* Higher than 2WAY */
if (neigh->priority > 0) /* Eligible */ if (neigh->priority > 0) /* Eligible */
if (neigh->dr != nid) /* And not decl. itself DR */ if (neigh->dr != nid) /* And not decl. itself DR */
...@@ -231,15 +231,15 @@ electdr(list nl) ...@@ -231,15 +231,15 @@ electdr(list nl)
struct ospf_neighbor *neigh, *n; struct ospf_neighbor *neigh, *n;
u32 nid; u32 nid;
n = NULL;
WALK_LIST(neigh, nl) /* And now DR */
{
#ifdef OSPFv2 #ifdef OSPFv2
nid = ipa_to_u32(neigh->ip); nid = ipa_to_u32(neigh->ip);
#else /* OSPFv3 */ #else /* OSPFv3 */
nid = neigh->rid; nid = neigh->rid;
#endif #endif
n = NULL;
WALK_LIST(neigh, nl) /* And now DR */
{
if (neigh->state >= NEIGHBOR_2WAY) /* Higher than 2WAY */ if (neigh->state >= NEIGHBOR_2WAY) /* Higher than 2WAY */
if (neigh->priority > 0) /* Eligible */ if (neigh->priority > 0) /* Eligible */
if (neigh->dr == nid) /* And declaring itself DR */ if (neigh->dr == nid) /* And declaring itself DR */
......
...@@ -337,7 +337,7 @@ schedule_rtcalc(struct proto_ospf *po) ...@@ -337,7 +337,7 @@ schedule_rtcalc(struct proto_ospf *po)
* @oa: ospf area * @oa: ospf area
* *
* It invokes aging and when @ospf_area->origrt is set to 1, start * 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 void
area_disp(struct ospf_area *oa) area_disp(struct ospf_area *oa)
...@@ -347,13 +347,18 @@ area_disp(struct ospf_area *oa) ...@@ -347,13 +347,18 @@ area_disp(struct ospf_area *oa)
/* Now try to originage rt_lsa */ /* Now try to originage rt_lsa */
if (oa->origrt) if (oa->origrt)
originate_rt_lsa(oa); update_rt_lsa(oa);
/* Now try to originate network LSA's */ /* Now try to originate network LSA's */
WALK_LIST(ifa, po->iface_list) 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)) if (ifa->orignet && (ifa->oa == oa))
originate_net_lsa(ifa); update_net_lsa(ifa);
} }
} }
...@@ -376,7 +381,7 @@ ospf_disp(timer * timer) ...@@ -376,7 +381,7 @@ ospf_disp(timer * timer)
/* Calculate routing table */ /* Calculate routing table */
if (po->calcrt) if (po->calcrt)
ospf_rt_spf (po); ospf_rt_spf(po);
} }
...@@ -1019,6 +1024,7 @@ ospf_sh_iface(struct proto *p, char *iff) ...@@ -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 * according to originating router id (to get all LSA needed to represent one
* router node together). Then, according to LSA type, ID and age. * router node together). Then, according to LSA type, ID and age.
*/ */
/*
static int static int
he_compare(const void *p1, const void *p2) he_compare(const void *p1, const void *p2)
{ {
...@@ -1057,6 +1063,7 @@ 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; return lsa1->age - lsa2->age;
} }
} }
*/
/* /*
static inline void static inline void
show_lsa_router(struct top_hash_entry *he) show_lsa_router(struct top_hash_entry *he)
...@@ -1074,7 +1081,7 @@ 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) if (rr[i].type == LSART_NET)
{ {
struct proto_ospf *po = he->oa->po; 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) if (net_he)
{ {
struct ospf_lsa_header *net_lsa = &(net_he->lsa); struct ospf_lsa_header *net_lsa = &(net_he->lsa);
...@@ -1152,12 +1159,13 @@ show_lsa_external(struct top_hash_entry *he) ...@@ -1152,12 +1159,13 @@ show_lsa_external(struct top_hash_entry *he)
void void
ospf_sh_state(struct proto *p, int verbose) ospf_sh_state(struct proto *p, int verbose)
{ {
/*
struct proto_ospf *po = (struct proto_ospf *) p; struct proto_ospf *po = (struct proto_ospf *) p;
struct top_graph *f = po->gr; struct top_graph *f = po->gr;
unsigned int i, j; unsigned int i, j;
u32 last_rt = 0xFFFFFFFF; u32 last_rt = 0xFFFFFFFF;
u32 last_area = 0xFFFFFFFF; u32 last_area = 0xFFFFFFFF;
/*
if (p->proto_state != PS_UP) if (p->proto_state != PS_UP)
{ {
cli_msg(-1016, "%s: is not up", p->name); cli_msg(-1016, "%s: is not up", p->name);
......
...@@ -194,6 +194,7 @@ struct ospf_iface ...@@ -194,6 +194,7 @@ struct ospf_iface
u32 dr_iface_id; /* if drid is valid, this is iface_id of DR (for connecting network) */ 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 u8 instance_id; /* Used to differentiate between more OSPF
instances on one interface */ instances on one interface */
ip_addr lladdr; /* Used link-local addr */
#endif #endif
u8 type; /* OSPF view of type */ u8 type; /* OSPF view of type */
...@@ -371,8 +372,8 @@ struct ospf_lsa_header ...@@ -371,8 +372,8 @@ struct ospf_lsa_header
u32 id; u32 id;
u32 rt; /* Advertising router */ u32 rt; /* Advertising router */
s32 sn; /* LS Sequence number */ s32 sn; /* LS Sequence number */
#define LSA_INITSEQNO 0x80000001 #define LSA_INITSEQNO ((s32) 0x80000001)
#define LSA_MAXSEQNO 0x7fffffff #define LSA_MAXSEQNO ((s32) 0x7fffffff)
u16 checksum; u16 checksum;
u16 length; u16 length;
}; };
......
...@@ -278,7 +278,7 @@ ospf_rx_hook(sock * sk, int size) ...@@ -278,7 +278,7 @@ ospf_rx_hook(sock * sk, int size)
if (ifa->stub) if (ifa->stub)
return (1); 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) if (ps == NULL)
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -47,27 +47,27 @@ struct top_graph ...@@ -47,27 +47,27 @@ struct top_graph
struct top_graph *ospf_top_new(pool *); struct top_graph *ospf_top_new(pool *);
void ospf_top_free(struct top_graph *); void ospf_top_free(struct top_graph *);
void ospf_top_dump(struct top_graph *, struct proto *); void ospf_top_dump(struct top_graph *, struct proto *);
struct top_hash_entry *ospfxx_hash_find_header(struct top_graph *f, u32 areaid, u32 ospf_lsa_domain(u32 type, struct ospf_iface *ifa);
struct top_hash_entry *ospf_hash_find_header(struct top_graph *f, u32 domain,
struct ospf_lsa_header *h); struct ospf_lsa_header *h);
struct top_hash_entry *ospfxx_hash_get_header(struct top_graph *f, u32 domain, struct top_hash_entry *ospf_hash_get_header(struct top_graph *f, u32 domain,
struct ospf_lsa_header *h); struct ospf_lsa_header *h);
struct top_hash_entry *ospfxx_hash_find_smart(struct top_graph *f, struct ospf_iface *ifa, struct top_hash_entry *ospf_hash_find(struct top_graph *, u32 domain, u32 lsa, u32 rtr,
struct ospf_lsa_header *h);
struct top_hash_entry *ospfxx_hash_get_smart(struct top_graph *f, struct ospf_iface *ifa,
struct ospf_lsa_header *h);
struct top_hash_entry *ospfxx_hash_find(struct top_graph *, u32 domain, u32 lsa, u32 rtr,
u32 type); u32 type);
struct top_hash_entry *ospfxx_hash_get(struct top_graph *, u32 domain, u32 lsa, u32 rtr, struct top_hash_entry *ospf_hash_get(struct top_graph *, u32 domain, u32 lsa, u32 rtr,
u32 type); u32 type);
void ospf_hash_delete(struct top_graph *, struct top_hash_entry *); void ospf_hash_delete(struct top_graph *, struct top_hash_entry *);
void originate_rt_lsa(struct ospf_area *oa); void originate_rt_lsa(struct ospf_area *oa);
void update_rt_lsa(struct ospf_area *oa);
void originate_net_lsa(struct ospf_iface *ifa); void originate_net_lsa(struct ospf_iface *ifa);
void update_net_lsa(struct ospf_iface *ifa);
void update_link_lsa(struct ospf_iface *ifa);
int can_flush_lsa(struct proto_ospf *po); int can_flush_lsa(struct proto_ospf *po);
int max_ext_lsa(unsigned pxlen); int max_ext_lsa(unsigned pxlen);
void originate_ext_lsa(net * n, rte * e, struct proto_ospf *po, void originate_ext_lsa(net * n, rte * e, struct proto_ospf *po,
struct ea_list *attrs); struct ea_list *attrs);
void flush_ext_lsa(net *n, struct proto_ospf *po);
void check_sum_lsa(struct proto_ospf *po, ort *nf, int); void check_sum_lsa(struct proto_ospf *po, ort *nf, int);
void originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metric, u32 options); void originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metric, u32 options);
void flush_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type); void flush_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type);
......
...@@ -390,7 +390,6 @@ nl_parse_addr(struct nlmsghdr *h) ...@@ -390,7 +390,6 @@ nl_parse_addr(struct nlmsghdr *h)
else else
{