diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 62b330ed..2b076157 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -56,7 +56,7 @@ ospf_dbdes_body(struct ospf_proto *p, struct ospf_packet *pkt, *body = ((void *) pkt) + hlen; *count = (plen - hlen) / sizeof(struct ospf_lsa_header); } - + static void 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); if (!(n->myimms & DBDES_MS)) - if (!(n->myimms & DBDES_M) && + if (!(n->myimms & DBDES_M) && !(n->imms & DBDES_M)) ospf_neigh_sm(n, INM_EXDONE); break; @@ -358,7 +358,7 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa, rcv_imms = ps->imms; rcv_ddseq = ntohl(ps->ddseq); } - + switch (n->state) { case NEIGHBOR_DOWN: @@ -397,7 +397,7 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa, if (!(rcv_imms & DBDES_I) && !(rcv_imms & DBDES_MS) && - (n->rid < p->router_id) && + (n->rid < p->router_id) && (n->dds == rcv_ddseq)) { /* I'm master! */ diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index 50cd8609..3aeb9f9a 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -114,7 +114,7 @@ ospf_send_hello(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn) { 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; } 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 me_elig = ifa->priority > 0; - + if (kind == OHS_POLL) /* Poll timer */ { 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->priority == 0) && (n->priority > 0)) ospf_send_hello(n->ifa, OHS_HELLO, n); - + /* Examine list of neighbors */ for (i = 0; i < neigh_count; i++) diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 312e626a..892e8a77 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -47,7 +47,7 @@ wait_timer_hook(timer * timer) static inline uint 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 @@ -129,7 +129,7 @@ ospf_sk_open(struct ospf_iface *ifa) ifa->des_routers = IPA_NONE; if (sk_setup_broadcast(sk) < 0) - goto err; + goto err; } 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; if (sk_setup_multicast(sk) < 0) - goto err; + goto err; 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(), 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); if (old_type != new_type) return 0; @@ -1132,7 +1132,7 @@ ospf_reconfigure_ifaces2(struct ospf_proto *p) ospf_iface_shutdown(ifa); ospf_iface_remove(ifa); } - + 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); } } - diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index e1af9f46..579d13e8 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -63,11 +63,11 @@ lsa_ntoh_body(void *n, void *h, u16 len) int lsa_flooding_allowed(u32 type, u32 domain, struct ospf_iface *ifa) -{ +{ /* Handle inactive vlinks */ if (ifa->state == OSPF_IS_DOWN) return 0; - + /* 4.5.2 (Case 2) */ switch (LSA_SCOPE(type)) { @@ -238,7 +238,7 @@ lsasum_check(struct ospf_lsa_header *h, void *body) q = ep; for (p = sp; p < q; p++) { - /* + /* * I count with bytes from header and than from body * but if there is no body, it's appended to header * (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; if (rt->fbit) buf = lsa_get_ipv6_addr(buf, &rt->fwaddr); - else + else rt->fwaddr = IPA_NONE; 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) 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))) 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)); if (pxl > MAX_PREFIX_LENGTH) return 0; - + offset += IPV6_PREFIX_SPACE(pxl); } diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c index 1685ef13..a6c0cf24 100644 --- a/proto/ospf/lsreq.c +++ b/proto/ospf/lsreq.c @@ -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); - en = ospf_hash_find(p->gr, domain, id, rt, type); + en = ospf_hash_find(p->gr, domain, id, rt, type); if (!en) { log(L_WARN "%s: Received LSREQ from %I for missing LSA (Type: %04x, Id: %R, Rt: %R)", diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 37c89a24..13ae54d1 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -277,7 +277,7 @@ ospf_prepare_lsupd(struct ospf_proto *p, struct ospf_iface *ifa, if (ospf_iface_assure_bufsize(ifa, pos + len) < 0) { /* 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); break; } @@ -439,7 +439,7 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa, lsa_n = ((void *) pkt) + offset; lsa_len = ntohs(lsa_n->length); offset += lsa_len; - + if ((offset > plen) || ((lsa_len % 4) != 0) || (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 */ 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); continue; } @@ -575,7 +575,7 @@ ospf_receive_lsupd(struct ospf_packet *pkt, struct ospf_iface *ifa, /* 13. (5b) - flood new LSA */ 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 ((ifa->state != OSPF_IS_BACKUP) || (n->rid == ifa->drid)) 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 */ 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 ((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) ospf_send_lsreq(p, n); } - diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index c182f0d2..ee1e8d0f 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -56,7 +56,7 @@ release_lsrtl(struct ospf_proto *p, struct ospf_neighbor *n) } /* 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. */ static void @@ -496,7 +496,7 @@ ospf_dr_election(struct ospf_iface *ifa) u32 old_drid = ifa->drid; u32 old_bdrid = ifa->bdrid; - + ifa->drid = ndr ? ndr->rid : 0; ifa->drip = ndr ? ndr->ip : IPA_NONE; ifa->dr_iface_id = ndr ? ndr->iface_id : 0; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index df5fe472..d65dba3b 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -10,7 +10,7 @@ /** * DOC: Open Shortest Path First (OSPF) - * + * * 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 * 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 * database, updating topology information in LSAs and for routing table * calculation. - * + * * 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 * routing messages. @@ -179,7 +179,7 @@ ospf_area_remove(struct ospf_area *oa) /* We suppose that interfaces are already removed */ ospf_flush_area(p, oa->areaid); - + fib_free(&oa->rtr); fib_free(&oa->net_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) { 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)) return ifa; return NULL; @@ -291,7 +291,7 @@ ospf_dump(struct proto *P) static struct proto * 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)); P->accept_ra_types = RA_OPTIMAL; @@ -688,7 +688,7 @@ ospf_reconfigure(struct proto *P, struct proto_config *c) ospf_area_remove(oa); ospf_schedule_rtcalc(p); - + return 1; } @@ -753,12 +753,12 @@ ospf_sh(struct proto *P) if (oa == ifa->oa) { ifano++; - WALK_LIST(n, ifa->neigh_list) - { + WALK_LIST(n, ifa->neigh_list) + { nno++; if (n->state == NEIGHBOR_FULL) adjno++; - } + } } } @@ -779,8 +779,8 @@ ospf_sh(struct proto *P) anet = (struct area_net *) nftmp; if(firstfib) { - cli_msg(-1014, "\t\tArea networks:"); - firstfib = 0; + cli_msg(-1014, "\t\tArea networks:"); + firstfib = 0; } 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" : ""); @@ -793,8 +793,8 @@ ospf_sh(struct proto *P) anet = (struct area_net *) nftmp; if(firstfib) { - cli_msg(-1014, "\t\tArea external networks:"); - firstfib = 0; + cli_msg(-1014, "\t\tArea external networks:"); + firstfib = 0; } 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" : ""); @@ -917,7 +917,7 @@ lsa_compare_for_state(const void *p1, const void *p2) return lsa1->sn - lsa2->sn; } - else + else { if (lsa1->rt < lsa2->rt) return -1; @@ -936,7 +936,7 @@ lsa_compare_for_state(const void *p1, const void *p2) if (px1 != px2) return px1 - px2; - + 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_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), 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 */ lsa_parse_ext(he, ospf2, &rt); - + if (rt.fbit) bsprintf(str_via, " via %I", rt.fwaddr); @@ -1145,7 +1145,7 @@ ospf_sh_state(struct proto *P, int verbose, int reachable) 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 */ 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) return lsa1->rt - lsa2->rt; - + if (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); u16 lsa_type = lsa->type_raw & type_mask; u16 dscope = LSA_SCOPE(hea[i]->lsa_type); - + /* Hack: 1 is used for LSA_SCOPE_LINK, fixed by & 0xf000 */ if (ld->scope && (dscope != (ld->scope & 0xf000))) continue; @@ -1407,7 +1407,7 @@ ospf_sh_lsadb(struct lsadb_show_data *ld) if (ld->router && (lsa->rt != ld->router)) continue; - + if ((dscope != last_dscope) || (hea[i]->domain != last_domain)) { cli_msg(-1017, ""); @@ -1456,4 +1456,3 @@ struct protocol proto_ospf = { .get_attr = ospf_get_attr, .get_route_info = ospf_get_route_info }; - diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index e5713628..7e5996f6 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -127,8 +127,8 @@ struct ospf_area_config u8 translator; /* Translator role, for NSSA ABR */ u32 transint; /* Translator stability interval */ list patt_list; /* List of iface configs (struct ospf_iface_patt) */ - list net_list; /* List of aggregate networks for that area */ - list enet_list; /* List of aggregate external (NSSA) networks */ + list net_list; /* List of aggregate networks for that area */ + list enet_list; /* List of aggregate external (NSSA) networks */ list stubnet_list; /* List of stub networks added to Router LSA */ }; @@ -163,7 +163,7 @@ struct nbma_node node n; ip_addr ip; byte eligible; - byte found; + byte found; }; struct ospf_iface_patt @@ -215,7 +215,7 @@ struct ospf_iface_patt #define HELLOINT_D 10 #define POLLINT_D 20 #define DEADC_D 4 -#define WAIT_DMH 4 +#define WAIT_DMH 4 /* 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_SK 1 /* Socket open failed */ #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 */ u16 rxbuf; /* Buffer size */ u16 tx_length; /* Soft TX packet length limit, usually MTU */ diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c index 96351178..d64d7d6b 100644 --- a/proto/ospf/packet.c +++ b/proto/ospf/packet.c @@ -92,7 +92,7 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt) 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 */ if ((now - ifa->csn_use) > 1) ifa->csn++; @@ -253,7 +253,7 @@ ospf_rx_hook(sock *sk, int size) struct ospf_iface *ifa = sk->data; 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); 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); @@ -264,7 +264,7 @@ ospf_rx_hook(sock *sk, int size) * 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 * that (src_local || dst_local), therefore we are eliminating all - * such cases. + * such cases. */ if (dst_mcast && !src_local) return 1; @@ -277,7 +277,7 @@ ospf_rx_hook(sock *sk, int size) } 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 * 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; WALK_LIST(iff, p->iface_list) { - if ((iff->type == OSPF_IT_VLINK) && + if ((iff->type == OSPF_IT_VLINK) && (iff->voa == ifa->oa) && (iff->instance_id == instance_id) && (iff->vid == rid)) diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 9d146ce2..16453b87 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1,16 +1,16 @@ /* * BIRD -- OSPF - * + * * (c) 2000--2004 Ondrej Filip * (c) 2009--2014 Ondrej Zajicek * (c) 2009--2014 CZ.NIC z.s.p.o. - * + * * Can be freely distributed and used under the terms of the GNU GPL. */ #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 ospf_area *oa, int i); 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 */ if (new->rid > old->rid) 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) { - /* + /* * Local stub networks does not have proper iface in en->nhi * (because they all have common top_hash_entry en). * 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; } - + /* RFC 2328 16.2. calculating inter-area routes */ static void ospf_rt_sum(struct ospf_area *oa) @@ -822,7 +822,7 @@ ospf_rt_sum(struct ospf_area *oa) ort *abr; int pxlen = -1, type = -1; u8 pxopts; - + 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 */ { lsa_parse_sum_rt(en, ospf_is_v2(p), &dst_rid, &metric, &options); - + /* We don't want local router in ASBR routing table */ if (dst_rid == p->router_id) continue; @@ -966,9 +966,9 @@ ospf_rt_sum_tr(struct ospf_area *oa) re = fib_find(&bb->rtr, &ip, MAX_PREFIX_LENGTH); } - /* 16.3 (1b) */ - if (metric == LSINFINITY) - continue; + /* 16.3 (1b) */ + if (metric == LSINFINITY) + continue; /* 16.3 (3) */ if (!re || !re->n.type) @@ -989,7 +989,7 @@ ospf_rt_sum_tr(struct ospf_area *oa) metric = abr->n.metric1 + metric; /* IAC */ /* 16.3. (5) */ - if ((metric < re->n.metric1) || + if ((metric < re->n.metric1) || ((metric == re->n.metric1) && unresolved_vlink(re))) { /* 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 *) fib_route(&nf->n.oa->net_fib, nf->fn.prefix, nf->fn.pxlen); - /* Condensed area network found */ + /* Condensed area network found */ if (anet) 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) return 0; - /* Condensed area network found */ + /* Condensed area network found */ if (fib_route(&oa->enet_fib, nf->fn.prefix, nf->fn.pxlen)) 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 */ lsa_parse_ext(en, ospf_is_v2(p), rt); - + if (rt->pxopts & OPT_PX_NU) return 0; @@ -1200,18 +1200,18 @@ ospf_check_vlinks(struct ospf_proto *p) { 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) || !ipa_equal(ifa->vip, tmp->lb)) - { - OSPF_TRACE(D_EVENTS, "Vlink peer %R found", tmp->lsa.id); - ospf_iface_sm(ifa, ISM_DOWN); + { + OSPF_TRACE(D_EVENTS, "Vlink peer %R found", tmp->lsa.id); + ospf_iface_sm(ifa, ISM_DOWN); ifa->vifa = nhi; ifa->addr = nhi->addr; ifa->cost = tmp->dist; - ifa->vip = tmp->lb; - ospf_iface_sm(ifa, ISM_UP); - } + ifa->vip = tmp->lb; + ospf_iface_sm(ifa, ISM_UP); + } else if ((ifa->state == OSPF_IS_PTP) && (ifa->cost != tmp->dist)) { ifa->cost = tmp->dist; @@ -1222,11 +1222,11 @@ ospf_check_vlinks(struct ospf_proto *p) } else { - if (ifa->state > OSPF_IS_DOWN) - { - OSPF_TRACE(D_EVENTS, "Vlink peer %R lost", ifa->vid); + if (ifa->state > OSPF_IS_DOWN) + { + OSPF_TRACE(D_EVENTS, "Vlink peer %R lost", ifa->vid); ospf_iface_sm(ifa, ISM_DOWN); - } + } } } } @@ -1343,7 +1343,7 @@ static void translator_timer_hook(timer *timer) { struct ospf_area *oa = timer->data; - + if (oa->translate != TRANS_WAIT) return; @@ -1727,7 +1727,7 @@ ospf_rt_spf(struct ospf_proto *p) rt_sync(p); lp_flush(p->nhpool); - + p->calcrt = 0; } @@ -1756,7 +1756,7 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, if (inherit_nexthops(pn)) return pn; - /* + /* * There are three cases: * 1) en is a local network (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; struct ospf_lsa_link *llsa = lhe->lsa_body; - + if (ipa_zero(llsa->lladdr)) return NULL; diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index bc2de79f..4e3da0de 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -31,7 +31,7 @@ static inline void lsab_reset(struct ospf_proto *p); * ospf_install_lsa - install new LSA into database * @p: OSPF protocol instance * @lsa: LSA header - * @type: type of LSA + * @type: type of LSA * @domain: domain of LSA * @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 * @en: current LSA entry or NULL * @lsa: new LSA header - * @type: type of LSA + * @type: type of LSA * @domain: domain of LSA * @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 { - /* + /* * Received LSA has maximal sequence number, so we cannot simply override * it. We have to install it to the database, immediately flush it to * 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); } - /* + /* * 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 - * 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. */ @@ -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)) return; - + en->next_lsa_body = NULL; en->next_lsa_blen = 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->type == OSPF_IT_PTMP)) 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); 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++; 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; } @@ -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 * 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 - * 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. */ void @@ -1494,7 +1494,7 @@ prefix_same(u32 *b1, u32 *b2) int pxl1 = *b1 >> 24; int pxl2 = *b2 >> 24; int pxs, i; - + if (pxl1 != pxl2) 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) 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); 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); 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 = e->next; @@ -1914,7 +1914,7 @@ ospf_hash_get(struct top_graph *f, u32 domain, u32 lsa, u32 rtr, u32 type) void 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); 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); 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); break; @@ -1964,7 +1964,7 @@ ospf_dump_lsa(struct top_hash_entry *he, struct proto *p) rts = (u32 *) (ln + 1); 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; default: diff --git a/proto/ospf/topology.h b/proto/ospf/topology.h index b34689e2..e2d6c773 100644 --- a/proto/ospf/topology.h +++ b/proto/ospf/topology.h @@ -18,7 +18,7 @@ struct top_hash_entry in intra-area routing table calculation */ struct top_hash_entry *next; /* Next in hash chain */ 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 */ u32 domain; /* Area ID for area-wide LSAs, Iface ID for link-wide LSAs */ // struct ospf_area *oa;