mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-17 08:38:42 +00:00
Whitespace cleanup in OSPF.
This commit is contained in:
parent
a7a7372aa7
commit
742029eb78
@ -56,7 +56,7 @@ ospf_dbdes_body(struct ospf_proto *p, struct ospf_packet *pkt,
|
|||||||
*body = ((void *) pkt) + hlen;
|
*body = ((void *) pkt) + hlen;
|
||||||
*count = (plen - hlen) / sizeof(struct ospf_lsa_header);
|
*count = (plen - hlen) / sizeof(struct ospf_lsa_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ospf_dump_dbdes(struct ospf_proto *p, struct ospf_packet *pkt)
|
ospf_dump_dbdes(struct ospf_proto *p, struct ospf_packet *pkt)
|
||||||
{
|
{
|
||||||
@ -231,7 +231,7 @@ ospf_send_dbdes(struct ospf_proto *p, struct ospf_neighbor *n, int next)
|
|||||||
tm_start(n->rxmt_timer, n->ifa->rxmtint);
|
tm_start(n->rxmt_timer, n->ifa->rxmtint);
|
||||||
|
|
||||||
if (!(n->myimms & DBDES_MS))
|
if (!(n->myimms & DBDES_MS))
|
||||||
if (!(n->myimms & DBDES_M) &&
|
if (!(n->myimms & DBDES_M) &&
|
||||||
!(n->imms & DBDES_M))
|
!(n->imms & DBDES_M))
|
||||||
ospf_neigh_sm(n, INM_EXDONE);
|
ospf_neigh_sm(n, INM_EXDONE);
|
||||||
break;
|
break;
|
||||||
@ -358,7 +358,7 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
rcv_imms = ps->imms;
|
rcv_imms = ps->imms;
|
||||||
rcv_ddseq = ntohl(ps->ddseq);
|
rcv_ddseq = ntohl(ps->ddseq);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (n->state)
|
switch (n->state)
|
||||||
{
|
{
|
||||||
case NEIGHBOR_DOWN:
|
case NEIGHBOR_DOWN:
|
||||||
@ -397,7 +397,7 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
|
|
||||||
if (!(rcv_imms & DBDES_I) &&
|
if (!(rcv_imms & DBDES_I) &&
|
||||||
!(rcv_imms & DBDES_MS) &&
|
!(rcv_imms & DBDES_MS) &&
|
||||||
(n->rid < p->router_id) &&
|
(n->rid < p->router_id) &&
|
||||||
(n->dds == rcv_ddseq))
|
(n->dds == rcv_ddseq))
|
||||||
{
|
{
|
||||||
/* I'm master! */
|
/* I'm master! */
|
||||||
|
@ -114,7 +114,7 @@ ospf_send_hello(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn)
|
|||||||
{
|
{
|
||||||
if (i == max)
|
if (i == max)
|
||||||
{
|
{
|
||||||
log(L_WARN "%s: Too many neighbors on interface %s", p->p.name, ifa->ifname);
|
log(L_WARN "%s: Too many neighbors on interface %s", p->p.name, ifa->ifname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
neighbors[i] = htonl(neigh->rid);
|
neighbors[i] = htonl(neigh->rid);
|
||||||
@ -143,7 +143,7 @@ ospf_send_hello(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn)
|
|||||||
|
|
||||||
int to_all = ifa->state > OSPF_IS_DROTHER;
|
int to_all = ifa->state > OSPF_IS_DROTHER;
|
||||||
int me_elig = ifa->priority > 0;
|
int me_elig = ifa->priority > 0;
|
||||||
|
|
||||||
if (kind == OHS_POLL) /* Poll timer */
|
if (kind == OHS_POLL) /* Poll timer */
|
||||||
{
|
{
|
||||||
WALK_LIST(nb, ifa->nbma_list)
|
WALK_LIST(nb, ifa->nbma_list)
|
||||||
@ -357,7 +357,7 @@ ospf_receive_hello(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
if (ifa->type == OSPF_IT_NBMA)
|
if (ifa->type == OSPF_IT_NBMA)
|
||||||
if ((ifa->priority == 0) && (n->priority > 0))
|
if ((ifa->priority == 0) && (n->priority > 0))
|
||||||
ospf_send_hello(n->ifa, OHS_HELLO, n);
|
ospf_send_hello(n->ifa, OHS_HELLO, n);
|
||||||
|
|
||||||
|
|
||||||
/* Examine list of neighbors */
|
/* Examine list of neighbors */
|
||||||
for (i = 0; i < neigh_count; i++)
|
for (i = 0; i < neigh_count; i++)
|
||||||
|
@ -47,7 +47,7 @@ wait_timer_hook(timer * timer)
|
|||||||
static inline uint
|
static inline uint
|
||||||
ifa_tx_length(struct ospf_iface *ifa)
|
ifa_tx_length(struct ospf_iface *ifa)
|
||||||
{
|
{
|
||||||
return ifa->cf->tx_length ?: ifa->iface->mtu;
|
return ifa->cf->tx_length ?: ifa->iface->mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint
|
static inline uint
|
||||||
@ -129,7 +129,7 @@ ospf_sk_open(struct ospf_iface *ifa)
|
|||||||
ifa->des_routers = IPA_NONE;
|
ifa->des_routers = IPA_NONE;
|
||||||
|
|
||||||
if (sk_setup_broadcast(sk) < 0)
|
if (sk_setup_broadcast(sk) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -137,10 +137,10 @@ ospf_sk_open(struct ospf_iface *ifa)
|
|||||||
ifa->des_routers = ospf_is_v2(p) ? IP4_OSPF_DES_ROUTERS : IP6_OSPF_DES_ROUTERS;
|
ifa->des_routers = ospf_is_v2(p) ? IP4_OSPF_DES_ROUTERS : IP6_OSPF_DES_ROUTERS;
|
||||||
|
|
||||||
if (sk_setup_multicast(sk) < 0)
|
if (sk_setup_multicast(sk) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (sk_join_group(sk, ifa->all_routers) < 0)
|
if (sk_join_group(sk, ifa->all_routers) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +703,7 @@ ospf_iface_reconfigure(struct ospf_iface *ifa, struct ospf_iface_patt *new)
|
|||||||
|
|
||||||
/* Type could be changed in ospf_iface_new(),
|
/* Type could be changed in ospf_iface_new(),
|
||||||
but if config values are same then also results are same */
|
but if config values are same then also results are same */
|
||||||
int old_type = ospf_iface_classify(old->type, ifa->addr);
|
int old_type = ospf_iface_classify(old->type, ifa->addr);
|
||||||
int new_type = ospf_iface_classify(new->type, ifa->addr);
|
int new_type = ospf_iface_classify(new->type, ifa->addr);
|
||||||
if (old_type != new_type)
|
if (old_type != new_type)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1132,7 +1132,7 @@ ospf_reconfigure_ifaces2(struct ospf_proto *p)
|
|||||||
ospf_iface_shutdown(ifa);
|
ospf_iface_shutdown(ifa);
|
||||||
ospf_iface_remove(ifa);
|
ospf_iface_remove(ifa);
|
||||||
}
|
}
|
||||||
|
|
||||||
ospf_iface_new(s.oa, a, s.ip);
|
ospf_iface_new(s.oa, a, s.ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1307,4 +1307,3 @@ ospf_iface_info(struct ospf_iface *ifa)
|
|||||||
cli_msg(-1015, "\tBackup designed router (IP): %I", ifa->bdrip);
|
cli_msg(-1015, "\tBackup designed router (IP): %I", ifa->bdrip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ lsa_ntoh_body(void *n, void *h, u16 len)
|
|||||||
|
|
||||||
int
|
int
|
||||||
lsa_flooding_allowed(u32 type, u32 domain, struct ospf_iface *ifa)
|
lsa_flooding_allowed(u32 type, u32 domain, struct ospf_iface *ifa)
|
||||||
{
|
{
|
||||||
/* Handle inactive vlinks */
|
/* Handle inactive vlinks */
|
||||||
if (ifa->state == OSPF_IS_DOWN)
|
if (ifa->state == OSPF_IS_DOWN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* 4.5.2 (Case 2) */
|
/* 4.5.2 (Case 2) */
|
||||||
switch (LSA_SCOPE(type))
|
switch (LSA_SCOPE(type))
|
||||||
{
|
{
|
||||||
@ -238,7 +238,7 @@ lsasum_check(struct ospf_lsa_header *h, void *body)
|
|||||||
q = ep;
|
q = ep;
|
||||||
for (p = sp; p < q; p++)
|
for (p = sp; p < q; p++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* I count with bytes from header and than from body
|
* I count with bytes from header and than from body
|
||||||
* but if there is no body, it's appended to header
|
* but if there is no body, it's appended to header
|
||||||
* (probably checksum in update receiving) and I go on
|
* (probably checksum in update receiving) and I go on
|
||||||
@ -432,7 +432,7 @@ lsa_parse_ext(struct top_hash_entry *en, int ospf2, struct ospf_lsa_ext_local *r
|
|||||||
rt->fbit = ext->metric & LSA_EXT3_FBIT;
|
rt->fbit = ext->metric & LSA_EXT3_FBIT;
|
||||||
if (rt->fbit)
|
if (rt->fbit)
|
||||||
buf = lsa_get_ipv6_addr(buf, &rt->fwaddr);
|
buf = lsa_get_ipv6_addr(buf, &rt->fwaddr);
|
||||||
else
|
else
|
||||||
rt->fwaddr = IPA_NONE;
|
rt->fwaddr = IPA_NONE;
|
||||||
|
|
||||||
rt->tag = (ext->metric & LSA_EXT3_TBIT) ? *buf++ : 0;
|
rt->tag = (ext->metric & LSA_EXT3_TBIT) ? *buf++ : 0;
|
||||||
@ -540,7 +540,7 @@ lsa_validate_sum3_net(struct ospf_lsa_header *lsa, struct ospf_lsa_sum3_net *bod
|
|||||||
if (pxl > MAX_PREFIX_LENGTH)
|
if (pxl > MAX_PREFIX_LENGTH)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (lsa->length != (HDRLEN + sizeof(struct ospf_lsa_sum3_net) +
|
if (lsa->length != (HDRLEN + sizeof(struct ospf_lsa_sum3_net) +
|
||||||
IPV6_PREFIX_SPACE(pxl)))
|
IPV6_PREFIX_SPACE(pxl)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ lsa_validate_pxlist(struct ospf_lsa_header *lsa, u32 pxcount, uint offset, u8 *p
|
|||||||
u8 pxl = pxlen((u32 *) (pbuf + offset));
|
u8 pxl = pxlen((u32 *) (pbuf + offset));
|
||||||
if (pxl > MAX_PREFIX_LENGTH)
|
if (pxl > MAX_PREFIX_LENGTH)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
offset += IPV6_PREFIX_SPACE(pxl);
|
offset += IPV6_PREFIX_SPACE(pxl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ ospf_receive_lsreq(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
|
|
||||||
DBG("Processing requested LSA: Type: %04x, Id: %R, Rt: %R\n", type, id, rt);
|
DBG("Processing requested LSA: Type: %04x, Id: %R, Rt: %R\n", type, id, rt);
|
||||||
|
|
||||||
en = ospf_hash_find(p->gr, domain, id, rt, type);
|
en = ospf_hash_find(p->gr, domain, id, rt, type);
|
||||||
if (!en)
|
if (!en)
|
||||||
{
|
{
|
||||||
log(L_WARN "%s: Received LSREQ from %I for missing LSA (Type: %04x, Id: %R, Rt: %R)",
|
log(L_WARN "%s: Received LSREQ from %I for missing LSA (Type: %04x, Id: %R, Rt: %R)",
|
||||||
|
@ -277,7 +277,7 @@ ospf_prepare_lsupd(struct ospf_proto *p, struct ospf_iface *ifa,
|
|||||||
if (ospf_iface_assure_bufsize(ifa, pos + len) < 0)
|
if (ospf_iface_assure_bufsize(ifa, pos + len) < 0)
|
||||||
{
|
{
|
||||||
/* Cannot fit in a tx buffer, skip that */
|
/* Cannot fit in a tx buffer, skip that */
|
||||||
log(L_ERR "%s: LSA too large to send on %s (Type: %04x, Id: %R, Rt: %R)",
|
log(L_ERR "%s: LSA too large to send on %s (Type: %04x, Id: %R, Rt: %R)",
|
||||||
p->p.name, ifa->ifname, en->lsa_type, en->lsa.id, en->lsa.rt);
|
p->p.name, ifa->ifname, en->lsa_type, en->lsa.id, en->lsa.rt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -439,7 +439,7 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
lsa_n = ((void *) pkt) + offset;
|
lsa_n = ((void *) pkt) + offset;
|
||||||
lsa_len = ntohs(lsa_n->length);
|
lsa_len = ntohs(lsa_n->length);
|
||||||
offset += lsa_len;
|
offset += lsa_len;
|
||||||
|
|
||||||
if ((offset > plen) || ((lsa_len % 4) != 0) ||
|
if ((offset > plen) || ((lsa_len % 4) != 0) ||
|
||||||
(lsa_len <= sizeof(struct ospf_lsa_header)))
|
(lsa_len <= sizeof(struct ospf_lsa_header)))
|
||||||
{
|
{
|
||||||
@ -504,7 +504,7 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
/* 13. (4) - ignore maxage LSA if i have no local copy */
|
/* 13. (4) - ignore maxage LSA if i have no local copy */
|
||||||
if ((lsa.age == LSA_MAXAGE) && !en && (p->padj == 0))
|
if ((lsa.age == LSA_MAXAGE) && !en && (p->padj == 0))
|
||||||
{
|
{
|
||||||
/* 13.5. - schedule ACKs (tbl 19, case 5) */
|
/* 13.5. - schedule ACKs (tbl 19, case 5) */
|
||||||
ospf_enqueue_lsack(n, lsa_n, ACKL_DIRECT);
|
ospf_enqueue_lsack(n, lsa_n, ACKL_DIRECT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
/* 13. (5b) - flood new LSA */
|
/* 13. (5b) - flood new LSA */
|
||||||
int flood_back = ospf_flood_lsa(p, en, n);
|
int flood_back = ospf_flood_lsa(p, en, n);
|
||||||
|
|
||||||
/* 13.5. - schedule ACKs (tbl 19, cases 1+2) */
|
/* 13.5. - schedule ACKs (tbl 19, cases 1+2) */
|
||||||
if (! flood_back)
|
if (! flood_back)
|
||||||
if ((ifa->state != OSPF_IS_BACKUP) || (n->rid == ifa->drid))
|
if ((ifa->state != OSPF_IS_BACKUP) || (n->rid == ifa->drid))
|
||||||
ospf_enqueue_lsack(n, lsa_n, ACKL_DELAY);
|
ospf_enqueue_lsack(n, lsa_n, ACKL_DELAY);
|
||||||
@ -593,7 +593,7 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
/* Duplicate LSA, treat as implicit ACK */
|
/* Duplicate LSA, treat as implicit ACK */
|
||||||
int implicit_ack = ospf_lsa_lsrt_down(en, n);
|
int implicit_ack = ospf_lsa_lsrt_down(en, n);
|
||||||
|
|
||||||
/* 13.5. - schedule ACKs (tbl 19, cases 3+4) */
|
/* 13.5. - schedule ACKs (tbl 19, cases 3+4) */
|
||||||
if (implicit_ack)
|
if (implicit_ack)
|
||||||
{
|
{
|
||||||
if ((ifa->state == OSPF_IS_BACKUP) && (n->rid == ifa->drid))
|
if ((ifa->state == OSPF_IS_BACKUP) && (n->rid == ifa->drid))
|
||||||
@ -631,4 +631,3 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|||||||
if ((n->state == NEIGHBOR_LOADING) && n->want_lsreq && !skip_lsreq)
|
if ((n->state == NEIGHBOR_LOADING) && n->want_lsreq && !skip_lsreq)
|
||||||
ospf_send_lsreq(p, n);
|
ospf_send_lsreq(p, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ release_lsrtl(struct ospf_proto *p, struct ospf_neighbor *n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Resets LSA request and retransmit lists.
|
/* Resets LSA request and retransmit lists.
|
||||||
* We do not reset DB summary list iterator here,
|
* We do not reset DB summary list iterator here,
|
||||||
* it is reset during entering EXCHANGE state.
|
* it is reset during entering EXCHANGE state.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -496,7 +496,7 @@ ospf_dr_election(struct ospf_iface *ifa)
|
|||||||
|
|
||||||
u32 old_drid = ifa->drid;
|
u32 old_drid = ifa->drid;
|
||||||
u32 old_bdrid = ifa->bdrid;
|
u32 old_bdrid = ifa->bdrid;
|
||||||
|
|
||||||
ifa->drid = ndr ? ndr->rid : 0;
|
ifa->drid = ndr ? ndr->rid : 0;
|
||||||
ifa->drip = ndr ? ndr->ip : IPA_NONE;
|
ifa->drip = ndr ? ndr->ip : IPA_NONE;
|
||||||
ifa->dr_iface_id = ndr ? ndr->iface_id : 0;
|
ifa->dr_iface_id = ndr ? ndr->iface_id : 0;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* DOC: Open Shortest Path First (OSPF)
|
* DOC: Open Shortest Path First (OSPF)
|
||||||
*
|
*
|
||||||
* The OSPF protocol is quite complicated and its complex implemenation is split
|
* The OSPF protocol is quite complicated and its complex implemenation is split
|
||||||
* to many files. In |ospf.c|, you will find mainly the interface for
|
* to many files. In |ospf.c|, you will find mainly the interface for
|
||||||
* communication with the core (e.g., reconfiguration hooks, shutdown and
|
* communication with the core (e.g., reconfiguration hooks, shutdown and
|
||||||
@ -68,7 +68,7 @@
|
|||||||
* (&ospf_proto->tick). It is responsible for aging and flushing of LSAs in the
|
* (&ospf_proto->tick). It is responsible for aging and flushing of LSAs in the
|
||||||
* database, updating topology information in LSAs and for routing table
|
* database, updating topology information in LSAs and for routing table
|
||||||
* calculation.
|
* calculation.
|
||||||
*
|
*
|
||||||
* To every &ospf_iface, we connect one or more &ospf_neighbor's -- a structure
|
* To every &ospf_iface, we connect one or more &ospf_neighbor's -- a structure
|
||||||
* containing many timers and queues for building adjacency and for exchange of
|
* containing many timers and queues for building adjacency and for exchange of
|
||||||
* routing messages.
|
* routing messages.
|
||||||
@ -179,7 +179,7 @@ ospf_area_remove(struct ospf_area *oa)
|
|||||||
|
|
||||||
/* We suppose that interfaces are already removed */
|
/* We suppose that interfaces are already removed */
|
||||||
ospf_flush_area(p, oa->areaid);
|
ospf_flush_area(p, oa->areaid);
|
||||||
|
|
||||||
fib_free(&oa->rtr);
|
fib_free(&oa->rtr);
|
||||||
fib_free(&oa->net_fib);
|
fib_free(&oa->net_fib);
|
||||||
fib_free(&oa->enet_fib);
|
fib_free(&oa->enet_fib);
|
||||||
@ -207,7 +207,7 @@ static struct ospf_iface *
|
|||||||
ospf_find_vlink(struct ospf_proto *p, u32 voa, u32 vid)
|
ospf_find_vlink(struct ospf_proto *p, u32 voa, u32 vid)
|
||||||
{
|
{
|
||||||
struct ospf_iface *ifa;
|
struct ospf_iface *ifa;
|
||||||
WALK_LIST(ifa, p->iface_list)
|
WALK_LIST(ifa, p->iface_list)
|
||||||
if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa->areaid == voa) && (ifa->vid == vid))
|
if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa->areaid == voa) && (ifa->vid == vid))
|
||||||
return ifa;
|
return ifa;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -291,7 +291,7 @@ ospf_dump(struct proto *P)
|
|||||||
static struct proto *
|
static struct proto *
|
||||||
ospf_init(struct proto_config *c)
|
ospf_init(struct proto_config *c)
|
||||||
{
|
{
|
||||||
struct ospf_config *oc = (struct ospf_config *) c;
|
struct ospf_config *oc = (struct ospf_config *) c;
|
||||||
struct proto *P = proto_new(c, sizeof(struct ospf_proto));
|
struct proto *P = proto_new(c, sizeof(struct ospf_proto));
|
||||||
|
|
||||||
P->accept_ra_types = RA_OPTIMAL;
|
P->accept_ra_types = RA_OPTIMAL;
|
||||||
@ -688,7 +688,7 @@ ospf_reconfigure(struct proto *P, struct proto_config *c)
|
|||||||
ospf_area_remove(oa);
|
ospf_area_remove(oa);
|
||||||
|
|
||||||
ospf_schedule_rtcalc(p);
|
ospf_schedule_rtcalc(p);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,12 +753,12 @@ ospf_sh(struct proto *P)
|
|||||||
if (oa == ifa->oa)
|
if (oa == ifa->oa)
|
||||||
{
|
{
|
||||||
ifano++;
|
ifano++;
|
||||||
WALK_LIST(n, ifa->neigh_list)
|
WALK_LIST(n, ifa->neigh_list)
|
||||||
{
|
{
|
||||||
nno++;
|
nno++;
|
||||||
if (n->state == NEIGHBOR_FULL)
|
if (n->state == NEIGHBOR_FULL)
|
||||||
adjno++;
|
adjno++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,8 +779,8 @@ ospf_sh(struct proto *P)
|
|||||||
anet = (struct area_net *) nftmp;
|
anet = (struct area_net *) nftmp;
|
||||||
if(firstfib)
|
if(firstfib)
|
||||||
{
|
{
|
||||||
cli_msg(-1014, "\t\tArea networks:");
|
cli_msg(-1014, "\t\tArea networks:");
|
||||||
firstfib = 0;
|
firstfib = 0;
|
||||||
}
|
}
|
||||||
cli_msg(-1014, "\t\t\t%1I/%u\t%s\t%s", anet->fn.prefix, anet->fn.pxlen,
|
cli_msg(-1014, "\t\t\t%1I/%u\t%s\t%s", anet->fn.prefix, anet->fn.pxlen,
|
||||||
anet->hidden ? "Hidden" : "Advertise", anet->active ? "Active" : "");
|
anet->hidden ? "Hidden" : "Advertise", anet->active ? "Active" : "");
|
||||||
@ -793,8 +793,8 @@ ospf_sh(struct proto *P)
|
|||||||
anet = (struct area_net *) nftmp;
|
anet = (struct area_net *) nftmp;
|
||||||
if(firstfib)
|
if(firstfib)
|
||||||
{
|
{
|
||||||
cli_msg(-1014, "\t\tArea external networks:");
|
cli_msg(-1014, "\t\tArea external networks:");
|
||||||
firstfib = 0;
|
firstfib = 0;
|
||||||
}
|
}
|
||||||
cli_msg(-1014, "\t\t\t%1I/%u\t%s\t%s", anet->fn.prefix, anet->fn.pxlen,
|
cli_msg(-1014, "\t\t\t%1I/%u\t%s\t%s", anet->fn.prefix, anet->fn.pxlen,
|
||||||
anet->hidden ? "Hidden" : "Advertise", anet->active ? "Active" : "");
|
anet->hidden ? "Hidden" : "Advertise", anet->active ? "Active" : "");
|
||||||
@ -917,7 +917,7 @@ lsa_compare_for_state(const void *p1, const void *p2)
|
|||||||
|
|
||||||
return lsa1->sn - lsa2->sn;
|
return lsa1->sn - lsa2->sn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lsa1->rt < lsa2->rt)
|
if (lsa1->rt < lsa2->rt)
|
||||||
return -1;
|
return -1;
|
||||||
@ -936,7 +936,7 @@ lsa_compare_for_state(const void *p1, const void *p2)
|
|||||||
|
|
||||||
if (px1 != px2)
|
if (px1 != px2)
|
||||||
return px1 - px2;
|
return px1 - px2;
|
||||||
|
|
||||||
return lsa1->sn - lsa2->sn;
|
return lsa1->sn - lsa2->sn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,7 +1004,7 @@ show_lsa_router(struct ospf_proto *p, struct top_hash_entry *he, int verbose)
|
|||||||
struct ospf_lsa_header *net_lsa = &(net_he->lsa);
|
struct ospf_lsa_header *net_lsa = &(net_he->lsa);
|
||||||
struct ospf_lsa_net *net_ln = net_he->lsa_body;
|
struct ospf_lsa_net *net_ln = net_he->lsa_body;
|
||||||
|
|
||||||
cli_msg(-1016, "\t\tnetwork %I/%d metric %u",
|
cli_msg(-1016, "\t\tnetwork %I/%d metric %u",
|
||||||
ipa_from_u32(net_lsa->id & net_ln->optx),
|
ipa_from_u32(net_lsa->id & net_ln->optx),
|
||||||
u32_masklen(net_ln->optx), rtl.metric);
|
u32_masklen(net_ln->optx), rtl.metric);
|
||||||
}
|
}
|
||||||
@ -1085,7 +1085,7 @@ show_lsa_external(struct top_hash_entry *he, int ospf2)
|
|||||||
he->domain = 0; /* Unmark the LSA */
|
he->domain = 0; /* Unmark the LSA */
|
||||||
|
|
||||||
lsa_parse_ext(he, ospf2, &rt);
|
lsa_parse_ext(he, ospf2, &rt);
|
||||||
|
|
||||||
if (rt.fbit)
|
if (rt.fbit)
|
||||||
bsprintf(str_via, " via %I", rt.fwaddr);
|
bsprintf(str_via, " via %I", rt.fwaddr);
|
||||||
|
|
||||||
@ -1145,7 +1145,7 @@ ospf_sh_state(struct proto *P, int verbose, int reachable)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We store interesting area-scoped LSAs in array hea and
|
/* We store interesting area-scoped LSAs in array hea and
|
||||||
global-scoped (LSA_T_EXT) LSAs in array hex */
|
global-scoped (LSA_T_EXT) LSAs in array hex */
|
||||||
|
|
||||||
int num = p->gr->hash_entries;
|
int num = p->gr->hash_entries;
|
||||||
@ -1343,7 +1343,7 @@ lsa_compare_for_lsadb(const void *p1, const void *p2)
|
|||||||
|
|
||||||
if (lsa1->rt != lsa2->rt)
|
if (lsa1->rt != lsa2->rt)
|
||||||
return lsa1->rt - lsa2->rt;
|
return lsa1->rt - lsa2->rt;
|
||||||
|
|
||||||
if (lsa1->id != lsa2->id)
|
if (lsa1->id != lsa2->id)
|
||||||
return lsa1->id - lsa2->id;
|
return lsa1->id - lsa2->id;
|
||||||
|
|
||||||
@ -1390,7 +1390,7 @@ ospf_sh_lsadb(struct lsadb_show_data *ld)
|
|||||||
struct ospf_lsa_header *lsa = &(hea[i]->lsa);
|
struct ospf_lsa_header *lsa = &(hea[i]->lsa);
|
||||||
u16 lsa_type = lsa->type_raw & type_mask;
|
u16 lsa_type = lsa->type_raw & type_mask;
|
||||||
u16 dscope = LSA_SCOPE(hea[i]->lsa_type);
|
u16 dscope = LSA_SCOPE(hea[i]->lsa_type);
|
||||||
|
|
||||||
/* Hack: 1 is used for LSA_SCOPE_LINK, fixed by & 0xf000 */
|
/* Hack: 1 is used for LSA_SCOPE_LINK, fixed by & 0xf000 */
|
||||||
if (ld->scope && (dscope != (ld->scope & 0xf000)))
|
if (ld->scope && (dscope != (ld->scope & 0xf000)))
|
||||||
continue;
|
continue;
|
||||||
@ -1407,7 +1407,7 @@ ospf_sh_lsadb(struct lsadb_show_data *ld)
|
|||||||
|
|
||||||
if (ld->router && (lsa->rt != ld->router))
|
if (ld->router && (lsa->rt != ld->router))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((dscope != last_dscope) || (hea[i]->domain != last_domain))
|
if ((dscope != last_dscope) || (hea[i]->domain != last_domain))
|
||||||
{
|
{
|
||||||
cli_msg(-1017, "");
|
cli_msg(-1017, "");
|
||||||
@ -1456,4 +1456,3 @@ struct protocol proto_ospf = {
|
|||||||
.get_attr = ospf_get_attr,
|
.get_attr = ospf_get_attr,
|
||||||
.get_route_info = ospf_get_route_info
|
.get_route_info = ospf_get_route_info
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ struct ospf_area_config
|
|||||||
u8 translator; /* Translator role, for NSSA ABR */
|
u8 translator; /* Translator role, for NSSA ABR */
|
||||||
u32 transint; /* Translator stability interval */
|
u32 transint; /* Translator stability interval */
|
||||||
list patt_list; /* List of iface configs (struct ospf_iface_patt) */
|
list patt_list; /* List of iface configs (struct ospf_iface_patt) */
|
||||||
list net_list; /* List of aggregate networks for that area */
|
list net_list; /* List of aggregate networks for that area */
|
||||||
list enet_list; /* List of aggregate external (NSSA) networks */
|
list enet_list; /* List of aggregate external (NSSA) networks */
|
||||||
list stubnet_list; /* List of stub networks added to Router LSA */
|
list stubnet_list; /* List of stub networks added to Router LSA */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ struct nbma_node
|
|||||||
node n;
|
node n;
|
||||||
ip_addr ip;
|
ip_addr ip;
|
||||||
byte eligible;
|
byte eligible;
|
||||||
byte found;
|
byte found;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ospf_iface_patt
|
struct ospf_iface_patt
|
||||||
@ -215,7 +215,7 @@ struct ospf_iface_patt
|
|||||||
#define HELLOINT_D 10
|
#define HELLOINT_D 10
|
||||||
#define POLLINT_D 20
|
#define POLLINT_D 20
|
||||||
#define DEADC_D 4
|
#define DEADC_D 4
|
||||||
#define WAIT_DMH 4
|
#define WAIT_DMH 4
|
||||||
/* Value of Wait timer - not found it in RFC * - using 4*HELLO */
|
/* Value of Wait timer - not found it in RFC * - using 4*HELLO */
|
||||||
|
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ struct ospf_iface
|
|||||||
#define OSPF_I_OK 0 /* Everything OK */
|
#define OSPF_I_OK 0 /* Everything OK */
|
||||||
#define OSPF_I_SK 1 /* Socket open failed */
|
#define OSPF_I_SK 1 /* Socket open failed */
|
||||||
#define OSPF_I_LL 2 /* Missing link-local address (OSPFv3) */
|
#define OSPF_I_LL 2 /* Missing link-local address (OSPFv3) */
|
||||||
u8 sk_dr; /* Socket is a member of designated routers group */
|
u8 sk_dr; /* Socket is a member of designated routers group */
|
||||||
u8 marked; /* Used in OSPF reconfigure, 2 for force restart */
|
u8 marked; /* Used in OSPF reconfigure, 2 for force restart */
|
||||||
u16 rxbuf; /* Buffer size */
|
u16 rxbuf; /* Buffer size */
|
||||||
u16 tx_length; /* Soft TX packet length limit, usually MTU */
|
u16 tx_length; /* Soft TX packet length limit, usually MTU */
|
||||||
|
@ -92,7 +92,7 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
|
|||||||
ifa->csn_use = now;
|
ifa->csn_use = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We must have sufficient delay between sending a packet and increasing
|
/* We must have sufficient delay between sending a packet and increasing
|
||||||
CSN to prevent reordering of packets (in a network) with different CSNs */
|
CSN to prevent reordering of packets (in a network) with different CSNs */
|
||||||
if ((now - ifa->csn_use) > 1)
|
if ((now - ifa->csn_use) > 1)
|
||||||
ifa->csn++;
|
ifa->csn++;
|
||||||
@ -253,7 +253,7 @@ ospf_rx_hook(sock *sk, int size)
|
|||||||
struct ospf_iface *ifa = sk->data;
|
struct ospf_iface *ifa = sk->data;
|
||||||
struct ospf_proto *p = ifa->oa->po;
|
struct ospf_proto *p = ifa->oa->po;
|
||||||
|
|
||||||
int src_local, dst_local, dst_mcast;
|
int src_local, dst_local, dst_mcast;
|
||||||
src_local = ipa_in_net(sk->faddr, ifa->addr->prefix, ifa->addr->pxlen);
|
src_local = ipa_in_net(sk->faddr, ifa->addr->prefix, ifa->addr->pxlen);
|
||||||
dst_local = ipa_equal(sk->laddr, ifa->addr->ip);
|
dst_local = ipa_equal(sk->laddr, ifa->addr->ip);
|
||||||
dst_mcast = ipa_equal(sk->laddr, ifa->all_routers) || ipa_equal(sk->laddr, ifa->des_routers);
|
dst_mcast = ipa_equal(sk->laddr, ifa->all_routers) || ipa_equal(sk->laddr, ifa->des_routers);
|
||||||
@ -264,7 +264,7 @@ ospf_rx_hook(sock *sk, int size)
|
|||||||
* In OSPFv2, they might be for other ospf_ifaces (with different IP
|
* In OSPFv2, they might be for other ospf_ifaces (with different IP
|
||||||
* prefix) on the same real iface, so we don't log it. We enforce
|
* prefix) on the same real iface, so we don't log it. We enforce
|
||||||
* that (src_local || dst_local), therefore we are eliminating all
|
* that (src_local || dst_local), therefore we are eliminating all
|
||||||
* such cases.
|
* such cases.
|
||||||
*/
|
*/
|
||||||
if (dst_mcast && !src_local)
|
if (dst_mcast && !src_local)
|
||||||
return 1;
|
return 1;
|
||||||
@ -277,7 +277,7 @@ ospf_rx_hook(sock *sk, int size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* In OSPFv3, src_local and dst_local mean link-local.
|
/* In OSPFv3, src_local and dst_local mean link-local.
|
||||||
* RFC 5340 says that local (non-vlink) packets use
|
* RFC 5340 says that local (non-vlink) packets use
|
||||||
* link-local src address, but does not enforce it. Strange.
|
* link-local src address, but does not enforce it. Strange.
|
||||||
*/
|
*/
|
||||||
@ -385,7 +385,7 @@ ospf_rx_hook(sock *sk, int size)
|
|||||||
struct ospf_iface *iff = NULL;
|
struct ospf_iface *iff = NULL;
|
||||||
WALK_LIST(iff, p->iface_list)
|
WALK_LIST(iff, p->iface_list)
|
||||||
{
|
{
|
||||||
if ((iff->type == OSPF_IT_VLINK) &&
|
if ((iff->type == OSPF_IT_VLINK) &&
|
||||||
(iff->voa == ifa->oa) &&
|
(iff->voa == ifa->oa) &&
|
||||||
(iff->instance_id == instance_id) &&
|
(iff->instance_id == instance_id) &&
|
||||||
(iff->vid == rid))
|
(iff->vid == rid))
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* BIRD -- OSPF
|
* BIRD -- OSPF
|
||||||
*
|
*
|
||||||
* (c) 2000--2004 Ondrej Filip <feela@network.cz>
|
* (c) 2000--2004 Ondrej Filip <feela@network.cz>
|
||||||
* (c) 2009--2014 Ondrej Zajicek <santiago@crfreenet.org>
|
* (c) 2009--2014 Ondrej Zajicek <santiago@crfreenet.org>
|
||||||
* (c) 2009--2014 CZ.NIC z.s.p.o.
|
* (c) 2009--2014 CZ.NIC z.s.p.o.
|
||||||
*
|
*
|
||||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ospf.h"
|
#include "ospf.h"
|
||||||
|
|
||||||
static void add_cand(list * l, struct top_hash_entry *en,
|
static void add_cand(list * l, struct top_hash_entry *en,
|
||||||
struct top_hash_entry *par, u32 dist,
|
struct top_hash_entry *par, u32 dist,
|
||||||
struct ospf_area *oa, int i);
|
struct ospf_area *oa, int i);
|
||||||
static void rt_sync(struct ospf_proto *p);
|
static void rt_sync(struct ospf_proto *p);
|
||||||
@ -270,7 +270,7 @@ orta_compare(const struct ospf_proto *p, const orta *new, const orta *old)
|
|||||||
/* Prefer routes with higher Router ID, just to be more deterministic */
|
/* Prefer routes with higher Router ID, just to be more deterministic */
|
||||||
if (new->rid > old->rid)
|
if (new->rid > old->rid)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +503,7 @@ add_network(struct ospf_area *oa, ip_addr px, int pxlen, int metric, struct top_
|
|||||||
|
|
||||||
if (en == oa->rt)
|
if (en == oa->rt)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Local stub networks does not have proper iface in en->nhi
|
* Local stub networks does not have proper iface in en->nhi
|
||||||
* (because they all have common top_hash_entry en).
|
* (because they all have common top_hash_entry en).
|
||||||
* We have to find iface responsible for that stub network.
|
* We have to find iface responsible for that stub network.
|
||||||
@ -810,7 +810,7 @@ link_back(struct ospf_area *oa, struct top_hash_entry *en, struct top_hash_entry
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* RFC 2328 16.2. calculating inter-area routes */
|
/* RFC 2328 16.2. calculating inter-area routes */
|
||||||
static void
|
static void
|
||||||
ospf_rt_sum(struct ospf_area *oa)
|
ospf_rt_sum(struct ospf_area *oa)
|
||||||
@ -822,7 +822,7 @@ ospf_rt_sum(struct ospf_area *oa)
|
|||||||
ort *abr;
|
ort *abr;
|
||||||
int pxlen = -1, type = -1;
|
int pxlen = -1, type = -1;
|
||||||
u8 pxopts;
|
u8 pxopts;
|
||||||
|
|
||||||
|
|
||||||
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for inter-area (area %R)", oa->areaid);
|
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for inter-area (area %R)", oa->areaid);
|
||||||
|
|
||||||
@ -864,7 +864,7 @@ ospf_rt_sum(struct ospf_area *oa)
|
|||||||
else /* LSA_T_SUM_RT */
|
else /* LSA_T_SUM_RT */
|
||||||
{
|
{
|
||||||
lsa_parse_sum_rt(en, ospf_is_v2(p), &dst_rid, &metric, &options);
|
lsa_parse_sum_rt(en, ospf_is_v2(p), &dst_rid, &metric, &options);
|
||||||
|
|
||||||
/* We don't want local router in ASBR routing table */
|
/* We don't want local router in ASBR routing table */
|
||||||
if (dst_rid == p->router_id)
|
if (dst_rid == p->router_id)
|
||||||
continue;
|
continue;
|
||||||
@ -966,9 +966,9 @@ ospf_rt_sum_tr(struct ospf_area *oa)
|
|||||||
re = fib_find(&bb->rtr, &ip, MAX_PREFIX_LENGTH);
|
re = fib_find(&bb->rtr, &ip, MAX_PREFIX_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 16.3 (1b) */
|
/* 16.3 (1b) */
|
||||||
if (metric == LSINFINITY)
|
if (metric == LSINFINITY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* 16.3 (3) */
|
/* 16.3 (3) */
|
||||||
if (!re || !re->n.type)
|
if (!re || !re->n.type)
|
||||||
@ -989,7 +989,7 @@ ospf_rt_sum_tr(struct ospf_area *oa)
|
|||||||
metric = abr->n.metric1 + metric; /* IAC */
|
metric = abr->n.metric1 + metric; /* IAC */
|
||||||
|
|
||||||
/* 16.3. (5) */
|
/* 16.3. (5) */
|
||||||
if ((metric < re->n.metric1) ||
|
if ((metric < re->n.metric1) ||
|
||||||
((metric == re->n.metric1) && unresolved_vlink(re)))
|
((metric == re->n.metric1) && unresolved_vlink(re)))
|
||||||
{
|
{
|
||||||
/* We want to replace the next-hop even if the metric is equal
|
/* We want to replace the next-hop even if the metric is equal
|
||||||
@ -1075,7 +1075,7 @@ decide_sum_lsa(struct ospf_area *oa, ort *nf, int dest)
|
|||||||
struct area_net *anet = (struct area_net *)
|
struct area_net *anet = (struct area_net *)
|
||||||
fib_route(&nf->n.oa->net_fib, nf->fn.prefix, nf->fn.pxlen);
|
fib_route(&nf->n.oa->net_fib, nf->fn.prefix, nf->fn.pxlen);
|
||||||
|
|
||||||
/* Condensed area network found */
|
/* Condensed area network found */
|
||||||
if (anet)
|
if (anet)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1132,7 +1132,7 @@ decide_nssa_lsa(struct ospf_proto *p, ort *nf, struct ospf_lsa_ext_local *rt)
|
|||||||
if (!rt_is_nssa(nf) || !oa->translate)
|
if (!rt_is_nssa(nf) || !oa->translate)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Condensed area network found */
|
/* Condensed area network found */
|
||||||
if (fib_route(&oa->enet_fib, nf->fn.prefix, nf->fn.pxlen))
|
if (fib_route(&oa->enet_fib, nf->fn.prefix, nf->fn.pxlen))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1141,7 +1141,7 @@ decide_nssa_lsa(struct ospf_proto *p, ort *nf, struct ospf_lsa_ext_local *rt)
|
|||||||
|
|
||||||
/* We do not store needed data in struct orta, we have to parse the LSA */
|
/* We do not store needed data in struct orta, we have to parse the LSA */
|
||||||
lsa_parse_ext(en, ospf_is_v2(p), rt);
|
lsa_parse_ext(en, ospf_is_v2(p), rt);
|
||||||
|
|
||||||
if (rt->pxopts & OPT_PX_NU)
|
if (rt->pxopts & OPT_PX_NU)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1200,18 +1200,18 @@ ospf_check_vlinks(struct ospf_proto *p)
|
|||||||
{
|
{
|
||||||
struct ospf_iface *nhi = ospf_iface_find(p, tmp->nhs->iface);
|
struct ospf_iface *nhi = ospf_iface_find(p, tmp->nhs->iface);
|
||||||
|
|
||||||
if ((ifa->state != OSPF_IS_PTP)
|
if ((ifa->state != OSPF_IS_PTP)
|
||||||
|| (ifa->vifa != nhi)
|
|| (ifa->vifa != nhi)
|
||||||
|| !ipa_equal(ifa->vip, tmp->lb))
|
|| !ipa_equal(ifa->vip, tmp->lb))
|
||||||
{
|
{
|
||||||
OSPF_TRACE(D_EVENTS, "Vlink peer %R found", tmp->lsa.id);
|
OSPF_TRACE(D_EVENTS, "Vlink peer %R found", tmp->lsa.id);
|
||||||
ospf_iface_sm(ifa, ISM_DOWN);
|
ospf_iface_sm(ifa, ISM_DOWN);
|
||||||
ifa->vifa = nhi;
|
ifa->vifa = nhi;
|
||||||
ifa->addr = nhi->addr;
|
ifa->addr = nhi->addr;
|
||||||
ifa->cost = tmp->dist;
|
ifa->cost = tmp->dist;
|
||||||
ifa->vip = tmp->lb;
|
ifa->vip = tmp->lb;
|
||||||
ospf_iface_sm(ifa, ISM_UP);
|
ospf_iface_sm(ifa, ISM_UP);
|
||||||
}
|
}
|
||||||
else if ((ifa->state == OSPF_IS_PTP) && (ifa->cost != tmp->dist))
|
else if ((ifa->state == OSPF_IS_PTP) && (ifa->cost != tmp->dist))
|
||||||
{
|
{
|
||||||
ifa->cost = tmp->dist;
|
ifa->cost = tmp->dist;
|
||||||
@ -1222,11 +1222,11 @@ ospf_check_vlinks(struct ospf_proto *p)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ifa->state > OSPF_IS_DOWN)
|
if (ifa->state > OSPF_IS_DOWN)
|
||||||
{
|
{
|
||||||
OSPF_TRACE(D_EVENTS, "Vlink peer %R lost", ifa->vid);
|
OSPF_TRACE(D_EVENTS, "Vlink peer %R lost", ifa->vid);
|
||||||
ospf_iface_sm(ifa, ISM_DOWN);
|
ospf_iface_sm(ifa, ISM_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1343,7 +1343,7 @@ static void
|
|||||||
translator_timer_hook(timer *timer)
|
translator_timer_hook(timer *timer)
|
||||||
{
|
{
|
||||||
struct ospf_area *oa = timer->data;
|
struct ospf_area *oa = timer->data;
|
||||||
|
|
||||||
if (oa->translate != TRANS_WAIT)
|
if (oa->translate != TRANS_WAIT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1727,7 +1727,7 @@ ospf_rt_spf(struct ospf_proto *p)
|
|||||||
|
|
||||||
rt_sync(p);
|
rt_sync(p);
|
||||||
lp_flush(p->nhpool);
|
lp_flush(p->nhpool);
|
||||||
|
|
||||||
p->calcrt = 0;
|
p->calcrt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1756,7 +1756,7 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en,
|
|||||||
if (inherit_nexthops(pn))
|
if (inherit_nexthops(pn))
|
||||||
return pn;
|
return pn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are three cases:
|
* There are three cases:
|
||||||
* 1) en is a local network (and par is root)
|
* 1) en is a local network (and par is root)
|
||||||
* 2) en is a ptp or ptmp neighbor (and par is root)
|
* 2) en is a ptp or ptmp neighbor (and par is root)
|
||||||
@ -1821,7 +1821,7 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
struct ospf_lsa_link *llsa = lhe->lsa_body;
|
struct ospf_lsa_link *llsa = lhe->lsa_body;
|
||||||
|
|
||||||
if (ipa_zero(llsa->lladdr))
|
if (ipa_zero(llsa->lladdr))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ static inline void lsab_reset(struct ospf_proto *p);
|
|||||||
* ospf_install_lsa - install new LSA into database
|
* ospf_install_lsa - install new LSA into database
|
||||||
* @p: OSPF protocol instance
|
* @p: OSPF protocol instance
|
||||||
* @lsa: LSA header
|
* @lsa: LSA header
|
||||||
* @type: type of LSA
|
* @type: type of LSA
|
||||||
* @domain: domain of LSA
|
* @domain: domain of LSA
|
||||||
* @body: pointer to LSA body
|
* @body: pointer to LSA body
|
||||||
*
|
*
|
||||||
@ -93,7 +93,7 @@ ospf_install_lsa(struct ospf_proto *p, struct ospf_lsa_header *lsa, u32 type, u3
|
|||||||
* @p: OSPF protocol instance
|
* @p: OSPF protocol instance
|
||||||
* @en: current LSA entry or NULL
|
* @en: current LSA entry or NULL
|
||||||
* @lsa: new LSA header
|
* @lsa: new LSA header
|
||||||
* @type: type of LSA
|
* @type: type of LSA
|
||||||
* @domain: domain of LSA
|
* @domain: domain of LSA
|
||||||
* @body: pointer to LSA body
|
* @body: pointer to LSA body
|
||||||
*
|
*
|
||||||
@ -136,7 +136,7 @@ ospf_advance_lsa(struct ospf_proto *p, struct top_hash_entry *en, struct ospf_ls
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Received LSA has maximal sequence number, so we cannot simply override
|
* Received LSA has maximal sequence number, so we cannot simply override
|
||||||
* it. We have to install it to the database, immediately flush it to
|
* it. We have to install it to the database, immediately flush it to
|
||||||
* implement sequence number wrapping, and schedule our current LSA to be
|
* implement sequence number wrapping, and schedule our current LSA to be
|
||||||
@ -181,10 +181,10 @@ ospf_advance_lsa(struct ospf_proto *p, struct top_hash_entry *en, struct ospf_ls
|
|||||||
en = ospf_install_lsa(p, lsa, type, domain, body);
|
en = ospf_install_lsa(p, lsa, type, domain, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We flood the updated LSA. Although in some cases the to-be-flooded LSA is
|
* We flood the updated LSA. Although in some cases the to-be-flooded LSA is
|
||||||
* the same as the received LSA, and therefore we should propagate it as
|
* the same as the received LSA, and therefore we should propagate it as
|
||||||
* regular received LSA (send the acknowledgement instead of the update to
|
* regular received LSA (send the acknowledgement instead of the update to
|
||||||
* the neighbor we received it from), we cheat a bit here.
|
* the neighbor we received it from), we cheat a bit here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ ospf_originate_next_lsa(struct ospf_proto *p, struct top_hash_entry *en)
|
|||||||
|
|
||||||
if (! ospf_do_originate_lsa(p, en, en->next_lsa_body, en->next_lsa_blen, en->next_lsa_opts))
|
if (! ospf_do_originate_lsa(p, en, en->next_lsa_body, en->next_lsa_blen, en->next_lsa_opts))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
en->next_lsa_body = NULL;
|
en->next_lsa_body = NULL;
|
||||||
en->next_lsa_blen = 0;
|
en->next_lsa_blen = 0;
|
||||||
en->next_lsa_opts = 0;
|
en->next_lsa_opts = 0;
|
||||||
@ -776,7 +776,7 @@ prepare_rt2_lsa_body(struct ospf_proto *p, struct ospf_area *oa)
|
|||||||
(ifa->state == OSPF_IS_LOOP) ||
|
(ifa->state == OSPF_IS_LOOP) ||
|
||||||
(ifa->type == OSPF_IT_PTMP))
|
(ifa->type == OSPF_IT_PTMP))
|
||||||
add_rt2_lsa_link(p, LSART_STUB, ipa_to_u32(ifa->addr->ip), 0xffffffff, 0);
|
add_rt2_lsa_link(p, LSART_STUB, ipa_to_u32(ifa->addr->ip), 0xffffffff, 0);
|
||||||
else
|
else
|
||||||
add_rt2_lsa_link(p, LSART_STUB, ipa_to_u32(ifa->addr->prefix), u32_mkmask(ifa->addr->pxlen), ifa->cost);
|
add_rt2_lsa_link(p, LSART_STUB, ipa_to_u32(ifa->addr->prefix), u32_mkmask(ifa->addr->pxlen), ifa->cost);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
@ -789,7 +789,7 @@ prepare_rt2_lsa_body(struct ospf_proto *p, struct ospf_area *oa)
|
|||||||
add_rt2_lsa_link(p, LSART_STUB, ipa_to_u32(sn->px.addr), u32_mkmask(sn->px.len), sn->cost), i++;
|
add_rt2_lsa_link(p, LSART_STUB, ipa_to_u32(sn->px.addr), u32_mkmask(sn->px.len), sn->cost), i++;
|
||||||
|
|
||||||
struct ospf_lsa_rt *rt = p->lsab;
|
struct ospf_lsa_rt *rt = p->lsab;
|
||||||
/* Store number of links in lower half of options */
|
/* Store number of links in lower half of options */
|
||||||
rt->options = get_rt_options(p, oa, bitv) | (u16) i;
|
rt->options = get_rt_options(p, oa, bitv) | (u16) i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1119,7 +1119,7 @@ prepare_ext3_lsa_body(struct ospf_proto *p, ort *nf,
|
|||||||
* If I receive a message that new route is installed, I try to originate an
|
* If I receive a message that new route is installed, I try to originate an
|
||||||
* external LSA. If @oa is an NSSA area, NSSA-LSA is originated instead.
|
* external LSA. If @oa is an NSSA area, NSSA-LSA is originated instead.
|
||||||
* @oa should not be a stub area. @src does not specify whether the LSA
|
* @oa should not be a stub area. @src does not specify whether the LSA
|
||||||
* is external or NSSA, but it specifies the source of origination -
|
* is external or NSSA, but it specifies the source of origination -
|
||||||
* the export from ospf_rt_notify(), or the NSSA-EXT translation.
|
* the export from ospf_rt_notify(), or the NSSA-EXT translation.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@ -1494,7 +1494,7 @@ prefix_same(u32 *b1, u32 *b2)
|
|||||||
int pxl1 = *b1 >> 24;
|
int pxl1 = *b1 >> 24;
|
||||||
int pxl2 = *b2 >> 24;
|
int pxl2 = *b2 >> 24;
|
||||||
int pxs, i;
|
int pxs, i;
|
||||||
|
|
||||||
if (pxl1 != pxl2)
|
if (pxl1 != pxl2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1583,7 +1583,7 @@ prepare_prefix_net_lsa_body(struct ospf_proto *p, struct ospf_iface *ifa)
|
|||||||
|
|
||||||
WALK_LIST(n, ifa->neigh_list)
|
WALK_LIST(n, ifa->neigh_list)
|
||||||
if ((n->state == NEIGHBOR_FULL) &&
|
if ((n->state == NEIGHBOR_FULL) &&
|
||||||
(en = ospf_hash_find(p->gr, ifa->iface_id, n->iface_id, n->rid, LSA_T_LINK)))
|
(en = ospf_hash_find(p->gr, ifa->iface_id, n->iface_id, n->rid, LSA_T_LINK)))
|
||||||
add_link_lsa(p, en->lsa_body, offset, &pxc);
|
add_link_lsa(p, en->lsa_body, offset, &pxc);
|
||||||
|
|
||||||
lp = p->lsab;
|
lp = p->lsab;
|
||||||
@ -1886,7 +1886,7 @@ ospf_hash_get(struct top_graph *f, u32 domain, u32 lsa, u32 rtr, u32 type)
|
|||||||
ee = f->hash_table + ospf_top_hash(f, domain, lsa, rtr, type);
|
ee = f->hash_table + ospf_top_hash(f, domain, lsa, rtr, type);
|
||||||
e = *ee;
|
e = *ee;
|
||||||
|
|
||||||
while (e && (e->lsa.id != lsa || e->lsa.rt != rtr ||
|
while (e && (e->lsa.id != lsa || e->lsa.rt != rtr ||
|
||||||
e->lsa_type != type || e->domain != domain))
|
e->lsa_type != type || e->domain != domain))
|
||||||
e = e->next;
|
e = e->next;
|
||||||
|
|
||||||
@ -1914,7 +1914,7 @@ ospf_hash_get(struct top_graph *f, u32 domain, u32 lsa, u32 rtr, u32 type)
|
|||||||
void
|
void
|
||||||
ospf_hash_delete(struct top_graph *f, struct top_hash_entry *e)
|
ospf_hash_delete(struct top_graph *f, struct top_hash_entry *e)
|
||||||
{
|
{
|
||||||
struct top_hash_entry **ee = f->hash_table +
|
struct top_hash_entry **ee = f->hash_table +
|
||||||
ospf_top_hash(f, e->domain, e->lsa.id, e->lsa.rt, e->lsa_type);
|
ospf_top_hash(f, e->domain, e->lsa.id, e->lsa.rt, e->lsa_type);
|
||||||
|
|
||||||
while (*ee)
|
while (*ee)
|
||||||
@ -1955,7 +1955,7 @@ ospf_dump_lsa(struct top_hash_entry *he, struct proto *p)
|
|||||||
rr = (struct ospf_lsa_rt_link *) (rt + 1);
|
rr = (struct ospf_lsa_rt_link *) (rt + 1);
|
||||||
|
|
||||||
for (i = 0; i < lsa_rt_items(&he->lsa); i++)
|
for (i = 0; i < lsa_rt_items(&he->lsa); i++)
|
||||||
OSPF_TRACE(D_EVENTS, " - %1x %-1R %-1R %5u",
|
OSPF_TRACE(D_EVENTS, " - %1x %-1R %-1R %5u",
|
||||||
rr[i].type, rr[i].id, rr[i].data, rr[i].metric);
|
rr[i].type, rr[i].id, rr[i].data, rr[i].metric);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1964,7 +1964,7 @@ ospf_dump_lsa(struct top_hash_entry *he, struct proto *p)
|
|||||||
rts = (u32 *) (ln + 1);
|
rts = (u32 *) (ln + 1);
|
||||||
|
|
||||||
for (i = 0; i < lsa_net_items(&he->lsa); i++)
|
for (i = 0; i < lsa_net_items(&he->lsa); i++)
|
||||||
OSPF_TRACE(D_EVENTS, " - %-1R", rts[i]);
|
OSPF_TRACE(D_EVENTS, " - %-1R", rts[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -18,7 +18,7 @@ struct top_hash_entry
|
|||||||
in intra-area routing table calculation */
|
in intra-area routing table calculation */
|
||||||
struct top_hash_entry *next; /* Next in hash chain */
|
struct top_hash_entry *next; /* Next in hash chain */
|
||||||
struct ospf_lsa_header lsa;
|
struct ospf_lsa_header lsa;
|
||||||
u16 lsa_type; /* lsa.type processed and converted to common values (LSA_T_*) */
|
u16 lsa_type; /* lsa.type processed and converted to common values (LSA_T_*) */
|
||||||
u16 init_age; /* Initial value for lsa.age during inst_time */
|
u16 init_age; /* Initial value for lsa.age during inst_time */
|
||||||
u32 domain; /* Area ID for area-wide LSAs, Iface ID for link-wide LSAs */
|
u32 domain; /* Area ID for area-wide LSAs, Iface ID for link-wide LSAs */
|
||||||
// struct ospf_area *oa;
|
// struct ospf_area *oa;
|
||||||
|
Loading…
Reference in New Issue
Block a user