summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_abr.c134
-rw-r--r--ospfd/ospf_apiserver.c8
-rw-r--r--ospfd/ospf_interface.c126
-rw-r--r--ospfd/ospf_ism.c18
-rw-r--r--ospfd/ospf_lsa.c346
-rw-r--r--ospfd/ospf_neighbor.c34
6 files changed, 342 insertions, 324 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 01da8808..410d59ac 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -8,12 +8,12 @@
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
- *
+ *
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Zebra; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -50,7 +50,7 @@
#include "ospfd/ospf_ase.h"
#include "ospfd/ospf_zebra.h"
#include "ospfd/ospf_dump.h"
-
+
static struct ospf_area_range *
ospf_area_range_new (struct prefix_ipv4 *p)
{
@@ -122,7 +122,7 @@ ospf_area_range_lookup (struct ospf_area *area, struct prefix_ipv4 *p)
}
struct ospf_area_range *
-ospf_area_range_lookup_next (struct ospf_area *area,
+ospf_area_range_lookup_next (struct ospf_area *area,
struct in_addr *range_net,
int first)
{
@@ -356,21 +356,21 @@ ospf_abr_nssa_am_elected (struct ospf_area *area)
struct ospf_lsa *lsa;
struct router_lsa *rlsa;
struct in_addr *best = NULL;
-
+
LSDB_LOOP ( ROUTER_LSDB (area), rn, lsa)
{
/* sanity checks */
- if (!lsa
- || (lsa->data->type != OSPF_ROUTER_LSA)
+ if (!lsa
+ || (lsa->data->type != OSPF_ROUTER_LSA)
|| IS_LSA_SELF (lsa))
continue;
-
+
rlsa = (struct router_lsa *) lsa->data;
-
+
/* ignore non-ABR routers */
if (!IS_ROUTER_LSA_BORDER (rlsa))
continue;
-
+
/* Router has Nt flag - always translate */
if (IS_ROUTER_LSA_NT (rlsa))
{
@@ -380,21 +380,21 @@ ospf_abr_nssa_am_elected (struct ospf_area *area)
inet_ntoa (lsa->data->id) );
return 0;
}
-
+
if (best == NULL)
best = &lsa->data->id;
else
if ( IPV4_ADDR_CMP (&best, &lsa->data->id) < 0)
best = &lsa->data->id;
}
-
+
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_nssa_am_elected: best electable ABR is: %s",
(best) ? inet_ntoa (*best) : "<none>" );
-
+
if (best == NULL)
return 1;
-
+
if ( IPV4_ADDR_CMP (&best, &area->ospf->router_id) < 0)
return 1;
else
@@ -404,12 +404,12 @@ ospf_abr_nssa_am_elected (struct ospf_area *area)
/* Check NSSA ABR status
* assumes there are nssa areas
*/
-static void
+static void
ospf_abr_nssa_check_status (struct ospf *ospf)
{
struct ospf_area *area;
struct listnode *lnode, *nnode;
-
+
for (ALL_LIST_ELEMENTS (ospf->areas, lnode, nnode, area))
{
u_char old_state = area->NSSATranslatorState;
@@ -425,7 +425,7 @@ ospf_abr_nssa_check_status (struct ospf *ospf)
if (!IS_OSPF_ABR (area->ospf))
{
if (IS_DEBUG_OSPF (nssa, NSSA))
- zlog_debug ("ospf_abr_nssa_check_status: "
+ zlog_debug ("ospf_abr_nssa_check_status: "
"not ABR");
area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED;
}
@@ -469,6 +469,8 @@ ospf_abr_nssa_check_status (struct ospf *ospf)
zlog_debug ("ospf_abr_nssa_check_status: " "not elected");
}
break;
+ default:
+ break ;
}
}
/* RFC3101, 3.1:
@@ -503,10 +505,10 @@ ospf_check_abr_status (struct ospf *ospf)
for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area))
{
- if (listcount (area->oiflist))
+ if (listcount (area->oiflist))
{
areas_configured++;
-
+
if (OSPF_IS_AREA_BACKBONE (area))
bb_configured = 1;
}
@@ -514,7 +516,7 @@ ospf_check_abr_status (struct ospf *ospf)
if (ospf_area_actively_attached (area))
{
areas_act_attached++;
-
+
if (OSPF_IS_AREA_BACKBONE (area))
bb_act_attached = 1;
}
@@ -630,7 +632,7 @@ ospf_abr_check_nssa_range (struct prefix_ipv4 *p, u_int32_t cost,
static int
ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
{
- /* Incoming Type-7 or later aggregated Type-7
+ /* Incoming Type-7 or later aggregated Type-7
*
* LSA is skipped if P-bit is off.
* LSA is aggregated if within range.
@@ -638,7 +640,7 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
* The Type-7 is translated, Installed/Approved as a Type-5 into
* global LSDB, then Flooded through AS
*
- * Later, any Unapproved Translated Type-5's are flushed/discarded
+ * Later, any Unapproved Translated Type-5's are flushed/discarded
*/
struct ospf_lsa *old = NULL,
@@ -651,9 +653,9 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_translate_nssa(): LSA Id %s, P-bit off, NO Translation",
inet_ntoa (lsa->data->id));
- return 1;
+ return 1;
}
-
+
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_translate_nssa(): LSA Id %s, TRANSLATING 7 to 5",
inet_ntoa (lsa->data->id));
@@ -661,7 +663,7 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
ext7 = (struct as_external_lsa *)(lsa->data);
p.prefix = lsa->data->id;
p.prefixlen = ip_masklen (ext7->mask);
-
+
if (ext7->e[0].fwd_addr.s_addr == OSPF_DEFAULT_DESTINATION)
{
if (IS_DEBUG_OSPF_NSSA)
@@ -670,7 +672,7 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
inet_ntoa (lsa->data->id));
return 1;
}
-
+
/* try find existing AS-External LSA for this prefix */
old = ospf_external_info_find_lsa (area->ospf, &p);
@@ -678,10 +680,10 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
if (old)
{
if (IS_DEBUG_OSPF_NSSA)
- zlog_debug ("ospf_abr_translate_nssa(): "
+ zlog_debug ("ospf_abr_translate_nssa(): "
"found old translated LSA Id %s, refreshing",
inet_ntoa (old->data->id));
-
+
/* refresh */
new = ospf_translated_nssa_refresh (area->ospf, lsa, old);
if (!new)
@@ -695,15 +697,15 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
else
{
/* no existing external route for this LSA Id
- * originate translated LSA
+ * originate translated LSA
*/
-
- if ((new = ospf_translated_nssa_originate (area->ospf, lsa))
+
+ if ((new = ospf_translated_nssa_originate (area->ospf, lsa))
== NULL)
{
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_translate_nssa(): Could not translate "
- "Type-7 for %s to Type-5",
+ "Type-7 for %s to Type-5",
inet_ntoa (lsa->data->id));
return 1;
}
@@ -733,7 +735,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_announce_network_to_area(): Start");
- old = ospf_lsa_lookup_by_prefix (area->lsdb, OSPF_SUMMARY_LSA,
+ old = ospf_lsa_lookup_by_prefix (area->lsdb, OSPF_SUMMARY_LSA,
(struct prefix_ipv4 *) p,
area->ospf->router_id);
if (old)
@@ -747,13 +749,13 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
zlog_debug ("ospf_abr_announce_network_to_area(): "
"old metric: %d, new metric: %d",
GET_METRIC (sl->metric), cost);
-
+
if (GET_METRIC (sl->metric) == cost)
{
/* unchanged. simply reapprove it */
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_announce_network_to_area(): "
- "old summary approved");
+ "old summary approved");
SET_FLAG (old->flags, OSPF_LSA_APPROVED);
}
else
@@ -764,11 +766,11 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
"refreshing summary");
set_metric (old, cost);
lsa = ospf_lsa_refresh (area->ospf, old);
-
+
if (!lsa)
{
char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
-
+
prefix2str ((struct prefix *) p, buf, sizeof(buf));
zlog_warn ("%s: Could not refresh %s to %s",
__func__,
@@ -776,7 +778,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
inet_ntoa (area->area_id));
return;
}
-
+
SET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
/* This will flood through area. */
}
@@ -788,11 +790,11 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
"creating new summary");
lsa = ospf_summary_lsa_originate ( (struct prefix_ipv4 *)p, cost, area);
/* This will flood through area. */
-
+
if (!lsa)
{
char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
-
+
prefix2str ((struct prefix *)p, buf, sizeof(buf));
zlog_warn ("%s: Could not originate %s to %s",
__func__,
@@ -800,7 +802,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
inet_ntoa (area->area_id));
return;
}
-
+
SET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_announce_network_to_area(): "
@@ -886,7 +888,7 @@ ospf_abr_announce_network (struct ospf *ospf,
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_announce_network(): Start");
- or_area = ospf_area_lookup_by_area_id (ospf, or->u.std.area_id);
+ or_area = ospf_area_lookup_by_area_id (ospf, or->u.std.area_id);
assert (or_area);
for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
@@ -907,7 +909,7 @@ ospf_abr_announce_network (struct ospf *ospf,
zlog_debug ("ospf_abr_announce_network(): "
"prefix %s/%d was denied by import-list",
inet_ntoa (p->prefix), p->prefixlen);
- continue;
+ continue;
}
if (!ospf_abr_plist_in_check (area, or, p))
@@ -916,7 +918,7 @@ ospf_abr_announce_network (struct ospf *ospf,
zlog_debug ("ospf_abr_announce_network(): "
"prefix %s/%d was denied by prefix-list",
inet_ntoa (p->prefix), p->prefixlen);
- continue;
+ continue;
}
if (area->external_routing != OSPF_AREA_DEFAULT && area->no_summary)
@@ -945,7 +947,7 @@ ospf_abr_announce_network (struct ospf *ospf,
zlog_debug ("ospf_abr_announce_network(): "
"this is intra-area route to %s/%d",
inet_ntoa (p->prefix), p->prefixlen);
- if ((range = ospf_area_range_match (or_area, p))
+ if ((range = ospf_area_range_match (or_area, p))
&& !ospf_area_is_transit (area))
ospf_abr_update_aggregate (range, or);
else
@@ -963,7 +965,7 @@ ospf_abr_should_announce (struct ospf *ospf,
area = ospf_area_lookup_by_area_id (ospf, or->u.std.area_id);
assert (area);
-
+
if (EXPORT_NAME (area))
{
if (EXPORT_LIST (area) == NULL)
@@ -998,18 +1000,18 @@ ospf_abr_process_nssa_translates (struct ospf *ospf)
{
if (! area->NSSATranslatorState)
continue; /* skip if not translator */
-
+
if (area->external_routing != OSPF_AREA_NSSA)
continue; /* skip if not Nssa Area */
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_process_nssa_translates(): "
"looking at area %s", inet_ntoa (area->area_id));
-
+
LSDB_LOOP (NSSA_LSDB (area), rn, lsa)
ospf_abr_translate_nssa (area, lsa);
}
-
+
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_process_nssa_translates(): Stop");
@@ -1147,9 +1149,9 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost,
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_announce_rtr_to_area(): 2.2");
-
- if (old)
- {
+
+ if (old)
+ {
set_metric (old, cost);
lsa = ospf_lsa_refresh (area->ospf, old);
}
@@ -1158,7 +1160,7 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost,
if (!lsa)
{
char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
-
+
prefix2str ((struct prefix *)p, buf, sizeof(buf));
zlog_warn ("%s: Could not refresh/originate %s to %s",
__func__,
@@ -1166,7 +1168,7 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost,
inet_ntoa (area->area_id));
return;
}
-
+
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_announce_rtr_to_area(): "
"flooding new version of summary");
@@ -1287,10 +1289,10 @@ ospf_abr_process_router_rt (struct ospf *ospf, struct route_table *rt)
(struct prefix_ipv4 *) &rn->p);
flag = 1;
}
-
+
if (best == NULL)
continue;
-
+
if (or != best)
{
if (IS_DEBUG_OSPF_EVENT)
@@ -1298,7 +1300,7 @@ ospf_abr_process_router_rt (struct ospf *ospf, struct route_table *rt)
"This route is not the best among possible, skipping");
continue;
}
-
+
if (or->path_type == OSPF_PATH_INTER_AREA &&
!OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id))
{
@@ -1379,14 +1381,14 @@ ospf_abr_unapprove_summaries (struct ospf *ospf)
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_unapprove_summaries(): "
"considering area %s",
- inet_ntoa (area->area_id));
+ inet_ntoa (area->area_id));
LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa)
if (ospf_lsa_is_self_originated (ospf, lsa))
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_unapprove_summaries(): "
"approved unset on summary link id %s",
- inet_ntoa (lsa->data->id));
+ inet_ntoa (lsa->data->id));
UNSET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
}
@@ -1499,7 +1501,7 @@ ospf_abr_announce_aggregates (struct ospf *ospf)
zlog_debug ("ospf_abr_announce_aggregates(): Skipping "
"announcement of BB aggregate into"
" a transit area");
- continue;
+ continue;
}
ospf_abr_announce_network_to_area ((struct prefix_ipv4 *)&p, range->cost, ar);
}
@@ -1693,7 +1695,7 @@ ospf_abr_remove_unapproved_translates (struct ospf *ospf)
LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa)
ospf_abr_remove_unapproved_translates_apply (ospf, lsa);
-
+
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_remove_unapproved_translates(): Stop");
}
@@ -1725,7 +1727,7 @@ ospf_abr_remove_unapproved_summaries (struct ospf *ospf)
if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED))
ospf_lsa_flush_area (lsa, area);
}
-
+
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_abr_remove_unapproved_summaries(): Stop");
}
@@ -1805,7 +1807,7 @@ ospf_abr_nssa_task (struct ospf *ospf) /* called only if any_nssa */
/* For all NSSAs, Type-7s, translate to 5's, INSTALL/FLOOD, or
* Aggregate as Type-7
- * Install or Approve in Type-5 Global LSDB
+ * Install or Approve in Type-5 Global LSDB
*/
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_nssa_task(): process translates");
@@ -1814,19 +1816,19 @@ ospf_abr_nssa_task (struct ospf *ospf) /* called only if any_nssa */
/* Translate/Send any "ranged" aggregates, and also 5-Install and
* Approve
* Scan Type-7's for aggregates, translate to Type-5's,
- * Install/Flood/Approve
+ * Install/Flood/Approve
*/
if (IS_DEBUG_OSPF_NSSA)
zlog_debug("ospf_abr_nssa_task(): send NSSA aggregates");
ospf_abr_send_nssa_aggregates (ospf); /*TURNED OFF FOR NOW */
- /* Send any NSSA defaults as Type-5
+ /* Send any NSSA defaults as Type-5
*if (IS_DEBUG_OSPF_NSSA)
* zlog_debug ("ospf_abr_nssa_task(): announce nssa defaults");
*ospf_abr_announce_nssa_defaults (ospf);
* havnt a clue what above is supposed to do.
*/
-
+
/* Flush any unapproved previous translates from Global Data Base */
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_abr_nssa_task(): remove unapproved translates");
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index a964e690..73ac7d98 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -106,7 +106,7 @@ ospf_apiserver_if_lookup_by_ifp (struct interface *ifp)
struct ospf_interface *oi;
struct ospf *ospf;
- if (!(ospf = ospf_lookup ()));
+ if ((ospf = ospf_lookup ()) == NULL)
return NULL;
for (ALL_LIST_ELEMENTS (ospf->oiflist, node, nnode, oi))
@@ -332,6 +332,8 @@ ospf_apiserver_event (enum event event, int fd,
thread_add_write (master, ospf_apiserver_async_write, apiserv, fd);
}
break;
+ default:
+ break ;
}
}
@@ -1049,6 +1051,8 @@ ospf_apiserver_handle_register_opaque_type (struct ospf_apiserver *apiserv,
case OSPF_OPAQUE_AS_LSA:
ospf_apiserver_notify_ready_type11 (apiserv);
break;
+ default:
+ break ;
}
out:
return rc;
@@ -1754,6 +1758,8 @@ ospf_apiserver_flood_opaque_lsa (struct ospf_lsa *lsa)
/* Flood LSA through AS. */
ospf_flood_through_as (ospf, NULL /*nbr */ , lsa);
break;
+ default:
+ break ;
}
}
}
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index dc0787d5..09f30a44 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -3,7 +3,7 @@
* Copyright (C) 1999, 2000 Toshiaki Takada
*
* This file is part of GNU Zebra.
- *
+ *
* GNU Zebra is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or (at your
@@ -49,7 +49,7 @@
#include "ospfd/ospf_snmp.h"
#endif /* HAVE_SNMP */
-
+
int
ospf_if_get_output_cost (struct ospf_interface *oi)
{
@@ -83,11 +83,11 @@ ospf_if_recalculate_output_cost (struct interface *ifp)
{
u_int32_t newcost;
struct route_node *rn;
-
+
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
{
struct ospf_interface *oi;
-
+
if ( (oi = rn->info) == NULL)
continue;
@@ -102,17 +102,17 @@ ospf_if_recalculate_output_cost (struct interface *ifp)
}
}
-/* Simulate down/up on the interface. This is needed, for example, when
+/* Simulate down/up on the interface. This is needed, for example, when
the MTU changes. */
void
ospf_if_reset(struct interface *ifp)
{
struct route_node *rn;
-
+
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
{
struct ospf_interface *oi;
-
+
if ( (oi = rn->info) == NULL)
continue;
@@ -129,7 +129,7 @@ ospf_if_reset_variables (struct ospf_interface *oi)
if (oi->vl_data)
oi->type = OSPF_IFTYPE_VIRTUALLINK;
- else
+ else
/* preserve network-type */
if (oi->type != OSPF_IFTYPE_NBMA)
oi->type = OSPF_IFTYPE_BROADCAST;
@@ -138,10 +138,10 @@ ospf_if_reset_variables (struct ospf_interface *oi)
oi->crypt_seqnum = 0;
- /* This must be short, (less than RxmtInterval)
+ /* This must be short, (less than RxmtInterval)
- RFC 2328 Section 13.5 para 3. Set to 1 second to avoid Acks being
held back for too long - MAG */
- oi->v_ls_ack = 1;
+ oi->v_ls_ack = 1;
}
/* lookup oi for specified prefix/ifp */
@@ -151,17 +151,17 @@ ospf_if_table_lookup (struct interface *ifp, struct prefix *prefix)
struct prefix p;
struct route_node *rn;
struct ospf_interface *rninfo = NULL;
-
+
p = *prefix;
p.prefixlen = IPV4_MAX_PREFIXLEN;
-
+
/* route_node_get implicitely locks */
if ((rn = route_node_lookup (IF_OIFS (ifp), &p)))
{
rninfo = (struct ospf_interface *) rn->info;
route_unlock_node (rn);
}
-
+
return rninfo;
}
@@ -211,14 +211,14 @@ ospf_if_new (struct ospf *ospf, struct interface *ifp, struct prefix *p)
}
else
return oi;
-
+
/* Set zebra interface pointer. */
oi->ifp = ifp;
oi->address = p;
-
+
ospf_add_to_if (ifp, oi);
listnode_add (ospf->oiflist, oi);
-
+
/* Initialize neighbor list. */
oi->nbrs = route_table_init ();
@@ -246,7 +246,7 @@ ospf_if_new (struct ospf *ospf, struct interface *ifp, struct prefix *p)
#endif /* HAVE_OPAQUE_LSA */
oi->ospf = ospf;
-
+
return oi;
}
@@ -274,7 +274,7 @@ ospf_if_cleanup (struct ospf_interface *oi)
}
nbr_nbma->oi = NULL;
-
+
listnode_delete (oi->nbr_nbma, nbr_nbma);
}
@@ -290,10 +290,10 @@ ospf_if_cleanup (struct ospf_interface *oi)
list_delete_all_node (oi->ls_ack);
oi->crypt_seqnum = 0;
-
+
/* Empty link state update queue */
ospf_ls_upd_queue_empty (oi);
-
+
/* Reset pseudo neighbor. */
ospf_nbr_delete (oi->nbr_self);
oi->nbr_self = ospf_nbr_new (oi);
@@ -313,16 +313,16 @@ ospf_if_free (struct ospf_interface *oi)
/* Free Pseudo Neighbour */
ospf_nbr_delete (oi->nbr_self);
-
+
route_table_finish (oi->nbrs);
route_table_finish (oi->ls_upd_queue);
-
+
/* Free any lists that should be freed */
list_free (oi->nbr_nbma);
-
+
list_free (oi->ls_ack);
list_free (oi->ls_ack_direct.ls_ack);
-
+
ospf_delete_from_if (oi->ifp, oi);
listnode_delete (oi->ospf->oiflist, oi);
@@ -334,7 +334,7 @@ ospf_if_free (struct ospf_interface *oi)
XFREE (MTYPE_OSPF_IF, oi);
}
-
+
/*
* check if interface with given address is configured and
* return it if yes. special treatment for PtP networks.
@@ -377,7 +377,7 @@ ospf_if_is_up (struct ospf_interface *oi)
struct ospf_interface *
ospf_if_exists (struct ospf_interface *oic)
-{
+{
struct listnode *node;
struct ospf *ospf;
struct ospf_interface *oi;
@@ -398,13 +398,13 @@ ospf_if_lookup_by_local_addr (struct ospf *ospf,
{
struct listnode *node;
struct ospf_interface *oi;
-
+
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
if (oi->type != OSPF_IFTYPE_VIRTUALLINK)
{
if (ifp && oi->ifp != ifp)
continue;
-
+
if (IPV4_ADDR_SAME (&address, &oi->address->u.prefix4))
return oi;
}
@@ -417,7 +417,7 @@ ospf_if_lookup_by_prefix (struct ospf *ospf, struct prefix_ipv4 *p)
{
struct listnode *node;
struct ospf_interface *oi;
-
+
/* Check each Interface. */
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
{
@@ -465,7 +465,7 @@ ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src,
if (prefix_match (CONNECTED_PREFIX(oi->connected),
(struct prefix *) &addr))
{
- if ( (match == NULL) ||
+ if ( (match == NULL) ||
(match->address->prefixlen < oi->address->prefixlen)
)
match = oi;
@@ -474,12 +474,12 @@ ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src,
return match;
}
-
+
void
ospf_if_stream_set (struct ospf_interface *oi)
{
/* set output fifo queue. */
- if (oi->obuf == NULL)
+ if (oi->obuf == NULL)
oi->obuf = ospf_fifo_new ();
}
@@ -503,7 +503,7 @@ ospf_if_stream_unset (struct ospf_interface *oi)
}
}
-
+
static struct ospf_if_params *
ospf_new_if_params (void)
{
@@ -528,7 +528,7 @@ ospf_new_if_params (void)
UNSET_IF_PARAM (oip, auth_type);
oip->auth_crypt = list_new ();
-
+
oip->network_lsa_seqnum = htonl(OSPF_INITIAL_SEQUENCE_NUMBER);
return oip;
@@ -557,7 +557,7 @@ ospf_free_if_params (struct interface *ifp, struct in_addr addr)
oip = rn->info;
route_unlock_node (rn);
-
+
if (!OSPF_IF_PARAM_CONFIGURED (oip, output_cost_cmd) &&
!OSPF_IF_PARAM_CONFIGURED (oip, transmit_delay) &&
!OSPF_IF_PARAM_CONFIGURED (oip, retransmit_interval) &&
@@ -589,7 +589,7 @@ ospf_lookup_if_params (struct interface *ifp, struct in_addr addr)
p.prefix = addr;
rn = route_node_lookup (IF_OIFS_PARAMS (ifp), (struct prefix*)&p);
-
+
if (rn)
{
route_unlock_node (rn);
@@ -610,12 +610,12 @@ ospf_get_if_params (struct interface *ifp, struct in_addr addr)
p.prefix = addr;
rn = route_node_get (IF_OIFS_PARAMS (ifp), (struct prefix*)&p);
-
+
if (rn->info == NULL)
rn->info = ospf_new_if_params ();
else
route_unlock_node (rn);
-
+
return rn->info;
}
@@ -624,7 +624,7 @@ ospf_if_update_params (struct interface *ifp, struct in_addr addr)
{
struct route_node *rn;
struct ospf_interface *oi;
-
+
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
{
if ((oi = rn->info) == NULL)
@@ -641,15 +641,15 @@ ospf_if_new_hook (struct interface *ifp)
int rc = 0;
ifp->info = XCALLOC (MTYPE_OSPF_IF_INFO, sizeof (struct ospf_if_info));
-
+
IF_OIFS (ifp) = route_table_init ();
IF_OIFS_PARAMS (ifp) = route_table_init ();
-
+
IF_DEF_PARAMS (ifp) = ospf_new_if_params ();
-
+
SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay);
IF_DEF_PARAMS (ifp)->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
-
+
SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval);
IF_DEF_PARAMS (ifp)->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
@@ -669,10 +669,10 @@ ospf_if_new_hook (struct interface *ifp)
SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_simple);
memset (IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
-
+
SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type);
IF_DEF_PARAMS (ifp)->auth_type = OSPF_AUTH_NOTSET;
-
+
#ifdef HAVE_OPAQUE_LSA
rc = ospf_opaque_new_if (ifp);
#endif /* HAVE_OPAQUE_LSA */
@@ -763,7 +763,7 @@ ospf_if_set_multicast(struct ospf_interface *oi)
/* drop only if last reference */
if (OI_MEMBER_COUNT(oi, MEMBER_DROUTERS) == 1)
ospf_if_drop_alldrouters(oi->ospf, oi->address, oi->ifp->ifindex);
-
+
/* Unset the flag regardless of whether the system call to leave
the group succeeded, since it's much safer to assume that
we are not a member. */
@@ -807,7 +807,7 @@ ospf_if_down (struct ospf_interface *oi)
return 1;
}
-
+
/* Virtual Link related functions. */
struct ospf_vl_data *
@@ -832,7 +832,7 @@ ospf_vl_data_free (struct ospf_vl_data *vl_data)
u_int vlink_count = 0;
-struct ospf_interface *
+struct ospf_interface *
ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data)
{
struct ospf_interface * voi;
@@ -842,7 +842,7 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data)
struct in_addr area_id;
struct connected *co;
struct prefix_ipv4 *p;
-
+
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_vl_new(): Start");
if (vlink_count == OSPF_VL_MAX_COUNT)
@@ -866,9 +866,9 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data)
p->family = AF_INET;
p->prefix.s_addr = 0;
p->prefixlen = 0;
-
+
co->address = (struct prefix *)p;
-
+
voi = ospf_if_new (ospf, vi, co->address);
if (voi == NULL)
{
@@ -924,24 +924,24 @@ ospf_vl_lookup (struct ospf *ospf, struct ospf_area *area,
{
struct ospf_vl_data *vl_data;
struct listnode *node;
-
+
if (IS_DEBUG_OSPF_EVENT)
{
zlog_debug ("%s: Looking for %s", __func__, inet_ntoa (vl_peer));
if (area)
zlog_debug ("%s: in area %s", __func__, inet_ntoa (area->area_id));
}
-
+
for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data))
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("%s: VL %s, peer %s", __func__,
vl_data->vl_oi->ifp->name,
inet_ntoa (vl_data->vl_peer));
-
+
if (area && !IPV4_ADDR_SAME (&vl_data->vl_area_id, &area->area_id))
continue;
-
+
if (IPV4_ADDR_SAME (&vl_data->vl_peer, &vl_peer))
return vl_data;
}
@@ -949,7 +949,7 @@ ospf_vl_lookup (struct ospf *ospf, struct ospf_area *area,
return NULL;
}
-static void
+static void
ospf_vl_shutdown (struct ospf_vl_data *vl_data)
{
struct ospf_interface *oi;
@@ -1002,7 +1002,7 @@ ospf_vl_set_params (struct ospf_vl_data *vl_data, struct vertex *v)
if (voi->output_cost != v->distance)
{
-
+
voi->output_cost = v->distance;
changed = 1;
}
@@ -1011,11 +1011,11 @@ ospf_vl_set_params (struct ospf_vl_data *vl_data, struct vertex *v)
{
vl_data->nexthop.oi = vp->nexthop->oi;
vl_data->nexthop.router = vp->nexthop->router;
-
+
if (!IPV4_ADDR_SAME(&voi->address->u.prefix4,
&vl_data->nexthop.oi->address->u.prefix4))
changed = 1;
-
+
voi->address->u.prefix4 = vl_data->nexthop.oi->address->u.prefix4;
voi->address->prefixlen = vl_data->nexthop.oi->address->prefixlen;
@@ -1055,17 +1055,19 @@ ospf_vl_set_params (struct ospf_vl_data *vl_data, struct vertex *v)
&rl->link[i].link_data))
changed = 1;
vl_data->peer_addr = rl->link[i].link_data;
+ default:
+ break ;
}
}
}
-
+
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("%s: %s peer address: %s, cost: %d,%schanged", __func__,
vl_data->vl_oi->ifp->name,
inet_ntoa(vl_data->peer_addr),
voi->output_cost,
(changed ? " " : " un"));
-
+
return changed;
}
@@ -1176,7 +1178,7 @@ ospf_vls_in_area (struct ospf_area *area)
return c;
}
-
+
struct crypt_key *
ospf_crypt_key_new ()
{
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index db53882d..558c7586 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -1,6 +1,6 @@
/*
* OSPF version 2 Interface State Machine
- * From RFC2328 [OSPF Version 2]
+ * From RFC2328 [OSPF Version 2]
* Copyright (C) 1999, 2000 Toshiaki Takada
*
* This file is part of GNU Zebra.
@@ -44,7 +44,7 @@
#include "ospfd/ospf_flood.h"
#include "ospfd/ospf_abr.h"
#include "ospfd/ospf_snmp.h"
-
+
/* elect DR and BDR. Refer to RFC2319 section 9.4 */
static struct ospf_neighbor *
ospf_dr_election_sub (struct list *routers)
@@ -228,7 +228,7 @@ ospf_dr_election (struct ospf_interface *oi)
!(new_state == ISM_DROther && old_state < ISM_DROther))
{
ospf_elect_bdr (oi, el_list);
- ospf_elect_dr (oi, el_list);
+ ospf_elect_dr (oi, el_list);
new_state = ospf_ism_state (oi);
@@ -246,7 +246,7 @@ ospf_dr_election (struct ospf_interface *oi)
return new_state;
}
-
+
int
ospf_hello_timer (struct thread *thread)
{
@@ -264,7 +264,7 @@ ospf_hello_timer (struct thread *thread)
/* Hello timer set. */
OSPF_HELLO_TIMER_ON (oi);
-
+
return 0;
}
@@ -322,7 +322,7 @@ ism_timer_set (struct ospf_interface *oi)
virtual link. The router attempts to form an adjacency with
neighboring router. Hello packets are also sent. */
/* send first hello immediately */
- OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);
+ OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);
OSPF_ISM_TIMER_OFF (oi->t_wait);
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
break;
@@ -348,6 +348,8 @@ ism_timer_set (struct ospf_interface *oi)
OSPF_ISM_TIMER_OFF (oi->t_wait);
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
break;
+ default:
+ break ;
}
}
@@ -518,7 +520,7 @@ struct {
{ ism_ignore, ISM_DR }, /* UnloopInd */
{ ism_interface_down, ISM_Down }, /* InterfaceDown */
},
-};
+};
static const char *ospf_ism_event_str[] =
{
@@ -549,7 +551,7 @@ ism_change_state (struct ospf_interface *oi, int state)
oi->state_change++;
#ifdef HAVE_SNMP
- /* Terminal state or regression */
+ /* Terminal state or regression */
if ((state == ISM_DR) || (state == ISM_Backup) || (state == ISM_DROther) ||
(state == ISM_PointToPoint) || (state < old_state))
{
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 842df49c..45087de9 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -50,7 +50,7 @@
#include "ospfd/ospf_ase.h"
#include "ospfd/ospf_zebra.h"
-
+
u_int32_t
get_metric (u_char *metric)
{
@@ -61,7 +61,7 @@ get_metric (u_char *metric)
return m;
}
-
+
struct timeval
tv_adjust (struct timeval a)
{
@@ -159,22 +159,22 @@ ospf_lsa_refresh_delay (struct ospf_lsa *lsa)
return delay;
}
-
+
int
get_age (struct ospf_lsa *lsa)
{
int age;
- age = ntohs (lsa->data->ls_age)
+ age = ntohs (lsa->data->ls_age)
+ tv_floor (tv_sub (recent_relative_time (), lsa->tv_recv));
return age;
}
-
+
/* Fletcher Checksum -- Refer to RFC1008. */
-/* All the offsets are zero-based. The offsets in the RFC1008 are
+/* All the offsets are zero-based. The offsets in the RFC1008 are
one-based. */
u_int16_t
ospf_lsa_checksum (struct lsa_header *lsa)
@@ -183,7 +183,7 @@ ospf_lsa_checksum (struct lsa_header *lsa)
int options_offset = buffer - (u_char *) &lsa->ls_age; /* should be 2 */
/* Skip the AGE field */
- u_int16_t len = ntohs(lsa->length) - options_offset;
+ u_int16_t len = ntohs(lsa->length) - options_offset;
/* Checksum offset starts from "options" field, not the beginning of the
lsa_header struct. The offset is 14, rather than 16. */
@@ -193,7 +193,7 @@ ospf_lsa_checksum (struct lsa_header *lsa)
}
-
+
/* Create OSPF LSA. */
struct ospf_lsa *
ospf_lsa_new ()
@@ -208,7 +208,7 @@ ospf_lsa_new ()
new->tv_recv = recent_relative_time ();
new->tv_orig = new->tv_recv;
new->refresh_list = -1;
-
+
return new;
}
@@ -246,7 +246,7 @@ void
ospf_lsa_free (struct ospf_lsa *lsa)
{
assert (lsa->lock == 0);
-
+
if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("LSA: freed %p", lsa);
@@ -256,7 +256,7 @@ ospf_lsa_free (struct ospf_lsa *lsa)
assert (lsa->refresh_list < 0);
- memset (lsa, 0, sizeof (struct ospf_lsa));
+ memset (lsa, 0, sizeof (struct ospf_lsa));
XFREE (MTYPE_OSPF_LSA, lsa);
}
@@ -275,7 +275,7 @@ ospf_lsa_unlock (struct ospf_lsa **lsa)
/* This is sanity check. */
if (!lsa || !*lsa)
return;
-
+
(*lsa)->lock--;
assert ((*lsa)->lock >= 0);
@@ -329,7 +329,7 @@ ospf_lsa_data_free (struct lsa_header *lsah)
XFREE (MTYPE_OSPF_LSA_DATA, lsah);
}
-
+
/* LSA general functions. */
const char *
@@ -381,7 +381,7 @@ lsa_header_set (struct stream *s, u_char options,
stream_forward_endp (s, OSPF_LSA_HEADER_SIZE);
}
-
+
/* router-LSA related functions. */
/* Get router-LSA flags. */
@@ -419,7 +419,7 @@ router_lsa_flags (struct ospf_area *area)
if (IS_OSPF_ABR (area->ospf))
{
SET_FLAG (flags, ROUTER_LSA_BORDER);
- /* If Area is NSSA and we are both ABR and unconditional translator,
+ /* If Area is NSSA and we are both ABR and unconditional translator,
* set Nt bit to inform other routers.
*/
if ( (area->external_routing == OSPF_AREA_NSSA)
@@ -480,7 +480,7 @@ link_info_set (struct stream *s, struct in_addr id,
if (STREAM_WRITEABLE(s) < OSPF_ROUTER_LSA_LINK_SIZE)
{
size_t ret = OSPF_MAX_LSA_SIZE;
-
+
/* Can we enlarge the stream still? */
if (STREAM_SIZE(s) == OSPF_MAX_LSA_SIZE)
{
@@ -495,7 +495,7 @@ link_info_set (struct stream *s, struct in_addr id,
*/
ret = stream_resize (s, OSPF_MAX_PACKET_SIZE - OSPF_MAX_LSA_SIZE);
}
-
+
if (ret == OSPF_MAX_LSA_SIZE)
{
zlog_warn ("%s: Out of space in LSA stream, left %zd, size %zd",
@@ -503,14 +503,14 @@ link_info_set (struct stream *s, struct in_addr id,
return 0;
}
}
-
+
/* TOS based routing is not supported. */
stream_put_ipv4 (s, id.s_addr); /* Link ID. */
stream_put_ipv4 (s, data.s_addr); /* Link Data. */
stream_putc (s, type); /* Link Type. */
stream_putc (s, tos); /* TOS = 0. */
stream_putw (s, cost); /* Link Cost. */
-
+
return 1;
}
@@ -552,7 +552,7 @@ lsa_link_broadcast_set (struct stream *s, struct ospf_interface *oi)
struct ospf_neighbor *dr;
struct in_addr id, mask;
u_int16_t cost = ospf_link_cost (oi);
-
+
/* Describe Type 3 Link. */
if (oi->state == ISM_Waiting)
{
@@ -585,7 +585,7 @@ static int
lsa_link_loopback_set (struct stream *s, struct ospf_interface *oi)
{
struct in_addr id, mask;
-
+
/* Describe Type 3 Link. */
if (oi->state != ISM_Loopback)
return 0;
@@ -615,7 +615,7 @@ lsa_link_virtuallink_set (struct stream *s, struct ospf_interface *oi)
#define lsa_link_nbma_set(S,O) lsa_link_broadcast_set (S, O)
-/* this function add for support point-to-multipoint ,see rfc2328
+/* this function add for support point-to-multipoint ,see rfc2328
12.4.1.4.*/
/* from "edward rrr" <edward_rrr@hotmail.com>
http://marc.theaimsgroup.com/?l=zebra&m=100739222210507&w=2 */
@@ -649,7 +649,7 @@ lsa_link_ptomp_set (struct stream *s, struct ospf_interface *oi)
zlog_debug ("PointToMultipoint: set link to %s",
inet_ntoa(oi->address->u.prefix4));
}
-
+
return links;
}
@@ -689,7 +689,9 @@ router_lsa_link_set (struct stream *s, struct ospf_area *area)
links += lsa_link_virtuallink_set (s, oi);
break;
case OSPF_IFTYPE_LOOPBACK:
- links += lsa_link_loopback_set (s, oi);
+ links += lsa_link_loopback_set (s, oi);
+ default:
+ break ;
}
}
}
@@ -723,26 +725,26 @@ ospf_router_lsa_body_set (struct stream *s, struct ospf_area *area)
/* Set # of links here. */
stream_putw_at (s, putp, cnt);
}
-
+
static int
ospf_stub_router_timer (struct thread *t)
{
struct ospf_area *area = THREAD_ARG (t);
-
+
area->t_stub_router = NULL;
-
+
SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED);
-
+
/* clear stub route state and generate router-lsa refresh, don't
* clobber an administratively set stub-router state though.
*/
if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
return 0;
-
+
UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
-
+
ospf_router_lsa_update_area (area);
-
+
return 0;
}
@@ -758,13 +760,13 @@ ospf_stub_router_check (struct ospf_area *area)
SET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
return;
}
-
+
/* not admin-stubbed, check whether startup stubbing is configured and
* whether it's not been done yet
*/
if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED))
return;
-
+
if (area->ospf->stub_router_startup_time == OSPF_STUB_ROUTER_UNCONFIGURED)
{
/* stub-router is hence done forever for this area, even if someone
@@ -773,14 +775,14 @@ ospf_stub_router_check (struct ospf_area *area)
SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED);
return;
}
-
+
/* startup stub-router configured and not yet done */
SET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
-
+
OSPF_AREA_TIMER_ON (area->t_stub_router, ospf_stub_router_timer,
area->ospf->stub_router_startup_time);
}
-
+
/* Create new router-LSA. */
static struct ospf_lsa *
ospf_router_lsa_new (struct ospf_area *area)
@@ -794,11 +796,11 @@ ospf_router_lsa_new (struct ospf_area *area)
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("LSA[Type1]: Create router-LSA instance");
- /* check whether stub-router is desired, and if this is the first
+ /* check whether stub-router is desired, and if this is the first
* router LSA.
*/
ospf_stub_router_check (area);
-
+
/* Create a stream for LSA. */
s = stream_new (OSPF_MAX_LSA_SIZE);
/* Set LSA common header fields. */
@@ -819,7 +821,7 @@ ospf_router_lsa_new (struct ospf_area *area)
zlog_err ("%s: Unable to create new lsa", __func__);
return NULL;
}
-
+
new->area = area;
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
@@ -836,7 +838,7 @@ static struct ospf_lsa *
ospf_router_lsa_originate (struct ospf_area *area)
{
struct ospf_lsa *new;
-
+
/* Create new router-LSA instance. */
if ( (new = ospf_router_lsa_new (area)) == NULL)
{
@@ -887,14 +889,14 @@ ospf_router_lsa_refresh (struct ospf_lsa *lsa)
/* Unregister LSA from refresh-list */
ospf_refresher_unregister_lsa (area->ospf, lsa);
-
+
/* Create new router-LSA instance. */
if ( (new = ospf_router_lsa_new (area)) == NULL)
{
zlog_err ("%s: ospf_router_lsa_new returned NULL", __func__);
return NULL;
}
-
+
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
ospf_lsa_install (area->ospf, NULL, new);
@@ -982,7 +984,7 @@ ospf_router_lsa_update (struct ospf *ospf)
return 0;
}
-
+
/* network-LSA related functions. */
/* Originate Network-LSA. */
static void
@@ -1019,7 +1021,7 @@ ospf_network_lsa_new (struct ospf_interface *oi)
the router does not originate network-LSA (see RFC 12.4.2) */
if (oi->full_nbrs == 0)
return NULL;
-
+
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("LSA[Type2]: Create network-LSA instance");
@@ -1043,7 +1045,7 @@ ospf_network_lsa_new (struct ospf_interface *oi)
zlog_err ("%s: ospf_lsa_new returned NULL", __func__);
return NULL;
}
-
+
new->area = oi->area;
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
@@ -1051,7 +1053,7 @@ ospf_network_lsa_new (struct ospf_interface *oi)
new->data = ospf_lsa_data_new (length);
memcpy (new->data, lsah, length);
stream_free (s);
-
+
/* Remember prior network LSA sequence numbers, even if we stop
* originating one for this oi, to try avoid re-originating LSAs with a
* prior sequence number, and thus speed up adjency forming & convergence.
@@ -1067,7 +1069,7 @@ ospf_network_lsa_new (struct ospf_interface *oi)
ospf_if_update_params (oi->ifp, oi->address->u.prefix4);
}
oip->network_lsa_seqnum = new->data->ls_seqnum;
-
+
return new;
}
@@ -1076,13 +1078,13 @@ void
ospf_network_lsa_update (struct ospf_interface *oi)
{
struct ospf_lsa *new;
-
+
if (oi->network_lsa_self != NULL)
{
ospf_lsa_refresh (oi->ospf, oi->network_lsa_self);
return;
}
-
+
/* Create new network-LSA instance. */
new = ospf_network_lsa_new (oi);
if (new == NULL)
@@ -1114,9 +1116,9 @@ ospf_network_lsa_refresh (struct ospf_lsa *lsa)
struct ospf_lsa *new, *new2;
struct ospf_if_params *oip;
struct ospf_interface *oi;
-
+
assert (lsa->data);
-
+
/* Retrieve the oi for the network LSA */
oi = ospf_if_lookup_by_local_addr (area->ospf, NULL, lsa->data->id);
if (oi == NULL)
@@ -1135,20 +1137,20 @@ ospf_network_lsa_refresh (struct ospf_lsa *lsa)
/* Unregister LSA from refresh-list */
ospf_refresher_unregister_lsa (area->ospf, lsa);
-
+
/* Create new network-LSA instance. */
new = ospf_network_lsa_new (oi);
if (new == NULL)
return NULL;
-
+
oip = ospf_lookup_if_params (oi->ifp, oi->address->u.prefix4);
assert (oip != NULL);
oip->network_lsa_seqnum = new->data->ls_seqnum = lsa_seqnum_increment (lsa);
new2 = ospf_lsa_install (area->ospf, oi, new);
-
+
assert (new2 == new);
-
+
/* Flood LSA through aera. */
ospf_flood_through_area (area, NULL, new);
@@ -1161,7 +1163,7 @@ ospf_network_lsa_refresh (struct ospf_lsa *lsa)
return new;
}
-
+
static void
stream_put_ospf_metric (struct stream *s, u_int32_t metric_value)
{
@@ -1244,12 +1246,12 @@ ospf_summary_lsa_new (struct ospf_area *area, struct prefix *p,
/* Originate Summary-LSA. */
struct ospf_lsa *
-ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
+ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
struct ospf_area *area)
{
struct ospf_lsa *new;
struct in_addr id;
-
+
id = ospf_lsa_unique_id (area->ospf, area->lsdb, OSPF_SUMMARY_LSA, p);
if (id.s_addr == 0xffffffff)
@@ -1260,7 +1262,7 @@ ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
OSPF_SUMMARY_LSA);
return NULL;
}
-
+
/* Create new summary-LSA instance. */
if ( !(new = ospf_summary_lsa_new (area, (struct prefix *) p, metric, id)))
return NULL;
@@ -1290,7 +1292,7 @@ ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
struct ospf_lsa *new;
struct summary_lsa *sl;
struct prefix p;
-
+
/* Sanity check. */
assert (lsa->data);
@@ -1298,14 +1300,14 @@ ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
p.prefixlen = ip_masklen (sl->mask);
new = ospf_summary_lsa_new (lsa->area, &p, GET_METRIC (sl->metric),
sl->header.id);
-
+
if (!new)
return NULL;
-
+
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
ospf_lsa_install (ospf, NULL, new);
-
+
/* Flood LSA through AS. */
ospf_flood_through_area (new->area, NULL, new);
@@ -1316,11 +1318,11 @@ ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
new->data->type, inet_ntoa (new->data->id));
ospf_lsa_header_dump (new->data);
}
-
+
return new;
}
-
+
/* summary-ASBR-LSA related functions. */
static void
ospf_summary_asbr_lsa_body_set (struct stream *s, struct prefix *p,
@@ -1390,12 +1392,12 @@ ospf_summary_asbr_lsa_new (struct ospf_area *area, struct prefix *p,
/* Originate summary-ASBR-LSA. */
struct ospf_lsa *
-ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
+ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
struct ospf_area *area)
{
struct ospf_lsa *new;
struct in_addr id;
-
+
id = ospf_lsa_unique_id (area->ospf, area->lsdb, OSPF_ASBR_SUMMARY_LSA, p);
if (id.s_addr == 0xffffffff)
@@ -1406,7 +1408,7 @@ ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
OSPF_ASBR_SUMMARY_LSA);
return NULL;
}
-
+
/* Create new summary-LSA instance. */
new = ospf_summary_asbr_lsa_new (area, (struct prefix *) p, metric, id);
if (!new)
@@ -1414,7 +1416,7 @@ ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
/* Install LSA to LSDB. */
new = ospf_lsa_install (area->ospf, NULL, new);
-
+
/* Update LSA origination count. */
area->ospf->lsa_originate_count++;
@@ -1447,11 +1449,11 @@ ospf_summary_asbr_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
sl->header.id);
if (!new)
return NULL;
-
+
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
ospf_lsa_install (ospf, NULL, new);
-
+
/* Flood LSA through area. */
ospf_flood_through_area (new->area, NULL, new);
@@ -1486,7 +1488,7 @@ ospf_external_lsa_nexthop_get (struct ospf *ospf, struct in_addr nexthop)
nh.family = AF_INET;
nh.u.prefix4 = nexthop;
nh.prefixlen = IPV4_MAX_BITLEN;
-
+
/* XXX/SCALE: If there were a lot of oi's on an ifp, then it'd be
* better to make use of the per-ifp table of ois.
*/
@@ -1512,7 +1514,7 @@ ospf_get_ip_from_ifp (struct ospf_interface *oi)
if (if_is_operative (oi->ifp))
return oi->address->u.prefix4;
-
+
return fwd;
}
@@ -1600,7 +1602,7 @@ ospf_external_lsa_body_set (struct stream *s, struct external_info *ei,
/* If prefix is default, specify DEFAULT_ROUTE. */
type = is_prefix_default (&ei->p) ? DEFAULT_ROUTE : ei->type;
-
+
mtype = (ROUTEMAP_METRIC_TYPE (ei) != -1) ?
ROUTEMAP_METRIC_TYPE (ei) : metric_type (ospf, type);
@@ -1612,13 +1614,13 @@ ospf_external_lsa_body_set (struct stream *s, struct external_info *ei,
/* Put 0 metric. TOS metric is not supported. */
stream_put_ospf_metric (s, mvalue);
-
+
/* Get forwarding address to nexthop if on the Connection List, else 0. */
fwd_addr = ospf_external_lsa_nexthop_get (ospf, ei->nexthop);
/* Put forwarding address. */
stream_put_ipv4 (s, fwd_addr.s_addr);
-
+
/* Put route tag -- This value should be introduced from configuration. */
stream_putl (s, 0);
}
@@ -1690,7 +1692,7 @@ ospf_external_lsa_new (struct ospf *ospf,
/* As Type-7 */
static void
-ospf_install_flood_nssa (struct ospf *ospf,
+ospf_install_flood_nssa (struct ospf *ospf,
struct ospf_lsa *lsa, struct external_info *ei)
{
struct ospf_lsa *new;
@@ -1699,12 +1701,12 @@ ospf_install_flood_nssa (struct ospf *ospf,
struct listnode *node, *nnode;
/* LSA may be a Type-5 originated via translation of a Type-7 LSA
- * which originated from an NSSA area. In which case it should not be
+ * which originated from an NSSA area. In which case it should not be
* flooded back to NSSA areas.
*/
if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
return;
-
+
/* NSSA Originate or Refresh (If anyNSSA)
LSA is self-originated. And just installed as Type-5.
@@ -1735,11 +1737,11 @@ ospf_install_flood_nssa (struct ospf *ospf,
if (! IS_OSPF_ABR (ospf))
{
SET_FLAG(new->data->options, OSPF_OPTION_NP);
-
+
/* set non-zero FWD ADDR
-
+
draft-ietf-ospf-nssa-update-09.txt
-
+
if the network between the NSSA AS boundary router and the
adjacent AS is advertised into OSPF as an internal OSPF route,
the forwarding address should be the next op address as is cu
@@ -1750,14 +1752,14 @@ ospf_install_flood_nssa (struct ospf *ospf,
which belong to the NSSA. If no such addresses exist, then
no type-7 LSA's with the P-bit set should originate from this
router. */
-
+
/* kevinm: not updating lsa anymore, just new */
extlsa = (struct as_external_lsa *)(new->data);
-
+
if (extlsa->e[0].fwd_addr.s_addr == 0)
extlsa->e[0].fwd_addr = ospf_get_nssa_ip(area); /* this NSSA area in ifp */
- if (extlsa->e[0].fwd_addr.s_addr == 0)
+ if (extlsa->e[0].fwd_addr.s_addr == 0)
{
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("LSA[Type-7]: Could not build FWD-ADDR");
@@ -1775,17 +1777,17 @@ ospf_install_flood_nssa (struct ospf *ospf,
}
static struct ospf_lsa *
-ospf_lsa_translated_nssa_new (struct ospf *ospf,
+ospf_lsa_translated_nssa_new (struct ospf *ospf,
struct ospf_lsa *type7)
{
struct ospf_lsa *new;
struct as_external_lsa *ext, *extnew;
struct external_info ei;
-
+
ext = (struct as_external_lsa *)(type7->data);
- /* need external_info struct, fill in bare minimum */
+ /* need external_info struct, fill in bare minimum */
ei.p.family = AF_INET;
ei.p.prefix = type7->data->id;
ei.p.prefixlen = ip_masklen (ext->mask);
@@ -1794,18 +1796,18 @@ ospf_lsa_translated_nssa_new (struct ospf *ospf,
ei.route_map_set.metric = -1;
ei.route_map_set.metric_type = -1;
ei.tag = 0;
-
+
if ( (new = ospf_external_lsa_new (ospf, &ei, &type7->data->id)) == NULL)
{
if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_nssa_translate_originate(): Could not originate "
- "Translated Type-5 for %s",
+ "Translated Type-5 for %s",
inet_ntoa (ei.p.prefix));
return NULL;
}
extnew = (struct as_external_lsa *)(new->data);
-
+
/* copy over Type-7 data to new */
extnew->e[0].tos = ext->e[0].tos;
extnew->e[0].route_tag = ext->e[0].route_tag;
@@ -1813,10 +1815,10 @@ ospf_lsa_translated_nssa_new (struct ospf *ospf,
new->data->ls_seqnum = type7->data->ls_seqnum;
/* add translated flag, checksum and lock new lsa */
- SET_FLAG (new->flags, OSPF_LSA_LOCAL_XLT); /* Translated from 7 */
+ SET_FLAG (new->flags, OSPF_LSA_LOCAL_XLT); /* Translated from 7 */
new = ospf_lsa_lock (new);
-
- return new;
+
+ return new;
}
/* Originate Translated Type-5 for supplied Type-7 NSSA LSA */
@@ -1825,11 +1827,11 @@ ospf_translated_nssa_originate (struct ospf *ospf, struct ospf_lsa *type7)
{
struct ospf_lsa *new;
struct as_external_lsa *extnew;
-
+
/* we cant use ospf_external_lsa_originate() as we need to set
* the OSPF_LSA_LOCAL_XLT flag, must originate by hand
*/
-
+
if ( (new = ospf_lsa_translated_nssa_new (ospf, type7)) == NULL)
{
if (IS_DEBUG_OSPF_NSSA)
@@ -1838,9 +1840,9 @@ ospf_translated_nssa_originate (struct ospf *ospf, struct ospf_lsa *type7)
inet_ntoa (type7->data->id));
return NULL;
}
-
+
extnew = (struct as_external_lsa *)new;
-
+
if (IS_DEBUG_OSPF_NSSA)
{
zlog_debug ("ospf_translated_nssa_originate(): "
@@ -1849,16 +1851,16 @@ ospf_translated_nssa_originate (struct ospf *ospf, struct ospf_lsa *type7)
zlog_debug (" Network mask: %d",ip_masklen (extnew->mask));
zlog_debug (" Forward addr: %s", inet_ntoa (extnew->e[0].fwd_addr));
}
-
+
if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL)
{
- if (IS_DEBUG_OSPF_NSSA);
+ if (IS_DEBUG_OSPF_NSSA)
zlog_debug ("ospf_lsa_translated_nssa_originate(): "
"Could not install LSA "
"id %s", inet_ntoa (type7->data->id));
return NULL;
}
-
+
ospf->lsa_originate_count++;
ospf_flood_through_as (ospf, NULL, new);
@@ -1867,11 +1869,11 @@ ospf_translated_nssa_originate (struct ospf *ospf, struct ospf_lsa *type7)
/* Refresh Translated from NSSA AS-external-LSA. */
struct ospf_lsa *
-ospf_translated_nssa_refresh (struct ospf *ospf, struct ospf_lsa *type7,
+ospf_translated_nssa_refresh (struct ospf *ospf, struct ospf_lsa *type7,
struct ospf_lsa *type5)
{
struct ospf_lsa *new = NULL;
-
+
/* Sanity checks. */
assert (type7 || type5);
if (!(type7 || type5))
@@ -1887,8 +1889,8 @@ ospf_translated_nssa_refresh (struct ospf *ospf, struct ospf_lsa *type7,
{
/* find the translated Type-5 for this Type-7 */
struct as_external_lsa *ext = (struct as_external_lsa *)(type7->data);
- struct prefix_ipv4 p =
- {
+ struct prefix_ipv4 p =
+ {
.prefix = type7->data->id,
.prefixlen = ip_masklen (ext->mask),
.family = AF_INET,
@@ -1905,13 +1907,13 @@ ospf_translated_nssa_refresh (struct ospf *ospf, struct ospf_lsa *type7,
struct route_node *rn;
struct ospf_lsa *lsa;
struct ospf_area *area;
-
+
for (ALL_LIST_ELEMENTS (ospf->areas, ln, lnn, area))
{
- if (area->external_routing != OSPF_AREA_NSSA
+ if (area->external_routing != OSPF_AREA_NSSA
&& !type7)
continue;
-
+
LSDB_LOOP (NSSA_LSDB(area), rn, lsa)
{
if (lsa->data->id.s_addr == type5->data->id.s_addr)
@@ -1945,7 +1947,7 @@ ospf_translated_nssa_refresh (struct ospf *ospf, struct ospf_lsa *type7,
/* Delete LSA from neighbor retransmit-list. */
ospf_ls_retransmit_delete_nbr_as (ospf, type5);
-
+
/* create new translated LSA */
if ( (new = ospf_lsa_translated_nssa_new (ospf, type7)) == NULL)
{
@@ -1964,7 +1966,7 @@ ospf_translated_nssa_refresh (struct ospf *ospf, struct ospf_lsa *type7,
inet_ntoa (type7->data->id));
return NULL;
}
-
+
/* Flood LSA through area. */
ospf_flood_through_as (ospf, NULL, new);
@@ -2023,11 +2025,11 @@ ospf_external_lsa_originate (struct ospf *ospf, struct external_info *ei)
flushed from the AS.
*/
-
+
/* Check the AS-external-LSA should be originated. */
if (!ospf_redistribute_check (ospf, ei, NULL))
return NULL;
-
+
/* Create new AS-external-LSA instance. */
if ((new = ospf_external_lsa_new (ospf, ei, NULL)) == NULL)
{
@@ -2082,7 +2084,7 @@ ospf_external_lsa_originate_timer (struct thread *thread)
if (!is_prefix_default ((struct prefix_ipv4 *)&ei->p))
if (!ospf_external_lsa_originate (ospf, ei))
zlog_warn ("LSA: AS-external-LSA was not originated.");
-
+
return 0;
}
@@ -2092,7 +2094,7 @@ ospf_default_external_info (struct ospf *ospf)
int type;
struct route_node *rn;
struct prefix_ipv4 p;
-
+
p.family = AF_INET;
p.prefix.s_addr = 0;
p.prefixlen = 0;
@@ -2121,7 +2123,7 @@ ospf_default_originate_timer (struct thread *thread)
struct in_addr nexthop;
struct external_info *ei;
struct ospf *ospf;
-
+
ospf = THREAD_ARG (thread);
p.family = AF_INET;
@@ -2138,7 +2140,7 @@ ospf_default_originate_timer (struct thread *thread)
if ((ei = ospf_default_external_info (ospf)))
ospf_external_lsa_originate (ospf, ei);
-
+
return 0;
}
@@ -2155,15 +2157,15 @@ ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p)
if (area->external_routing == OSPF_AREA_NSSA)
{
if (!(lsa = ospf_lsa_lookup (area, OSPF_AS_NSSA_LSA, p->prefix,
- ospf->router_id)))
+ ospf->router_id)))
{
- if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
+ if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
zlog_debug ("LSA: There is no such AS-NSSA-LSA %s/%d in LSDB",
inet_ntoa (p->prefix), p->prefixlen);
continue;
}
ospf_ls_retransmit_delete_nbr_area (area, lsa);
- if (!IS_LSA_MAXAGE (lsa))
+ if (!IS_LSA_MAXAGE (lsa))
{
ospf_refresher_unregister_lsa (ospf, lsa);
ospf_lsa_flush_area (lsa, area);
@@ -2193,8 +2195,8 @@ ospf_external_lsa_flush (struct ospf *ospf,
return;
}
- /* If LSA is selforiginated, not a translated LSA, and there is
- * NSSA area, flush Type-7 LSA's at first.
+ /* If LSA is selforiginated, not a translated LSA, and there is
+ * NSSA area, flush Type-7 LSA's at first.
*/
if (IS_LSA_SELF(lsa) && (ospf->anyNSSA)
&& !(CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)))
@@ -2292,13 +2294,13 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
{
struct ospf_lsa *new;
int changed;
-
+
/* Check the AS-external-LSA should be originated. */
if (!ospf_redistribute_check (ospf, ei, &changed))
{
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("LSA[Type%d:%s]: Could not be refreshed, "
- "redist check fail",
+ "redist check fail",
lsa->data->type, inet_ntoa (lsa->data->id));
ospf_external_lsa_flush (ospf, ei->type, &ei->p,
ei->ifindex /*, ei->nexthop */);
@@ -2320,7 +2322,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
ospf_refresher_unregister_lsa (ospf, lsa);
new = ospf_external_lsa_new (ospf, ei, &lsa->data->id);
-
+
if (new == NULL)
{
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
@@ -2328,7 +2330,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
inet_ntoa (lsa->data->id));
return NULL;
}
-
+
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
ospf_lsa_install (ospf, NULL, new); /* As type-5. */
@@ -2340,8 +2342,8 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
if (ospf->anyNSSA && !(CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT)))
ospf_install_flood_nssa (ospf, new, ei); /* Install/Flood per new rules */
- /* Register self-originated LSA to refresh queue.
- * Translated LSAs should not be registered, but refreshed upon
+ /* Register self-originated LSA to refresh queue.
+ * Translated LSAs should not be registered, but refreshed upon
* refresh of the Type-7
*/
if ( !CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT) )
@@ -2358,7 +2360,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
return new;
}
-
+
/* LSA installation functions. */
/* Install router-LSA to an area. */
@@ -2371,7 +2373,7 @@ ospf_router_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
/* RFC 2328 Section 13.2 Router-LSAs and network-LSAs
The entire routing table must be recalculated, starting with
the shortest path calculations for each area (not just the
- area whose link-state database has changed).
+ area whose link-state database has changed).
*/
if (IS_LSA_SELF (new))
@@ -2402,7 +2404,7 @@ ospf_router_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
/* Install network-LSA to an area. */
static struct ospf_lsa *
ospf_network_lsa_install (struct ospf *ospf,
- struct ospf_interface *oi,
+ struct ospf_interface *oi,
struct ospf_lsa *new,
int rt_recalc)
{
@@ -2410,7 +2412,7 @@ ospf_network_lsa_install (struct ospf *ospf,
/* RFC 2328 Section 13.2 Router-LSAs and network-LSAs
The entire routing table must be recalculated, starting with
the shortest path calculations for each area (not just the
- area whose link-state database has changed).
+ area whose link-state database has changed).
*/
if (IS_LSA_SELF (new))
{
@@ -2450,7 +2452,7 @@ ospf_summary_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
#else /* #if 0 */
ospf_spf_calculate_schedule (ospf);
#endif /* #if 0 */
-
+
if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
zlog_debug ("ospf_summary_lsa_install(): SPF scheduled");
}
@@ -2477,7 +2479,7 @@ ospf_summary_asbr_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
#if 0
/* These don't exist yet... */
ospf_summary_incremental_update(new);
- /* Isn't this done by the above call?
+ /* Isn't this done by the above call?
- RFC 2328 Section 16.5 implies it should be */
/* ospf_ase_calculate_schedule(); */
#else /* #if 0 */
@@ -2513,7 +2515,7 @@ ospf_external_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
if (new->data->type == OSPF_AS_NSSA_LSA)
{
/* There is no point to register selforiginate Type-7 LSA for
- * refreshing. We rely on refreshing Type-5 LSA's
+ * refreshing. We rely on refreshing Type-5 LSA's
*/
if (IS_LSA_SELF (new))
return new;
@@ -2521,12 +2523,12 @@ ospf_external_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
{
/* Try refresh type-5 translated LSA for this LSA, if one exists.
* New translations will be taken care of by the abr_task.
- */
+ */
ospf_translated_nssa_refresh (ospf, new, NULL);
}
}
- /* Register self-originated LSA to refresh queue.
+ /* Register self-originated LSA to refresh queue.
* Leave Translated LSAs alone if NSSA is enabled
*/
if (IS_LSA_SELF (new) && !CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT ) )
@@ -2540,7 +2542,7 @@ ospf_discard_from_db (struct ospf *ospf,
struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
{
struct ospf_lsa *old;
-
+
if (!lsdb)
{
zlog_warn ("%s: Called with NULL lsdb!", __func__);
@@ -2551,7 +2553,7 @@ ospf_discard_from_db (struct ospf *ospf,
lsa->data->type, inet_ntoa (lsa->data->id));
return;
}
-
+
old = ospf_lsdb_lookup (lsdb, lsa);
if (!old)
@@ -2662,11 +2664,11 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
if (ospf_lsa_is_self_originated(ospf, lsa))
{
lsa->data->ls_seqnum = htonl(OSPF_MAX_SEQUENCE_NUMBER);
-
+
if (!IS_LSA_MAXAGE(lsa))
lsa->flags |= OSPF_LSA_PREMATURE_AGE;
lsa->data->ls_age = htons (OSPF_LSA_MAXAGE);
-
+
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
{
zlog_debug ("ospf_lsa_install() Premature Aging "
@@ -2723,7 +2725,7 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
if (IS_LSA_SELF (lsa))
lsa->oi = oi; /* Specify outgoing ospf-interface for this LSA. */
else
- ; /* Incoming "oi" for this LSA has set at LSUpd reception. */
+ {;}; /* Incoming "oi" for this LSA has set at LSUpd reception. */
/* Fallthrough */
case OSPF_OPAQUE_AREA_LSA:
case OSPF_OPAQUE_AS_LSA:
@@ -2764,17 +2766,17 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
}
}
- /*
+ /*
If received LSA' ls_age is MaxAge, or lsa is being prematurely aged
- (it's getting flushed out of the area), set LSA on MaxAge LSA list.
+ (it's getting flushed out of the area), set LSA on MaxAge LSA list.
*/
if ((lsa->flags & OSPF_LSA_PREMATURE_AGE) ||
(IS_LSA_MAXAGE (new) && !IS_LSA_SELF (new)))
{
if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
zlog_debug ("LSA[Type%d:%s]: Install LSA 0x%p, MaxAge",
- new->data->type,
- inet_ntoa (new->data->id),
+ new->data->type,
+ inet_ntoa (new->data->id),
lsa);
ospf_lsa_flush (ospf, lsa);
}
@@ -2782,13 +2784,13 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
return new;
}
-
+
static int
ospf_check_nbr_status (struct ospf *ospf)
{
struct listnode *node, *nnode;
struct ospf_interface *oi;
-
+
for (ALL_LIST_ELEMENTS (ospf->oiflist, node, nnode, oi))
{
struct route_node *rn;
@@ -2807,7 +2809,7 @@ ospf_check_nbr_status (struct ospf *ospf)
return 1;
}
-
+
static int
ospf_maxage_lsa_remover (struct thread *thread)
@@ -2832,11 +2834,11 @@ ospf_maxage_lsa_remover (struct thread *thread)
reschedule = 1;
continue;
}
-
+
/* TODO: maybe convert this function to a work-queue */
if (thread_should_yield (thread))
OSPF_TIMER_ON (ospf->t_maxage, ospf_maxage_lsa_remover, 0);
-
+
/* Remove LSA from the LSDB */
if (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF))
if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
@@ -3077,7 +3079,7 @@ ospf_lsa_lookup (struct ospf_area *area, u_int32_t type,
}
struct ospf_lsa *
-ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32_t type,
+ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32_t type,
struct in_addr id)
{
struct ospf_lsa *lsa;
@@ -3315,7 +3317,7 @@ ospf_flush_self_originated_lsas_now (struct ospf *ospf)
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("LSA[Type%d:%s]: Schedule self-originated LSA to FLUSH",
lsa->data->type, inet_ntoa (lsa->data->id));
-
+
ospf_refresher_unregister_lsa (ospf, lsa);
ospf_lsa_flush_area (lsa, area);
ospf_lsa_unlock (&area->router_lsa_self);
@@ -3331,7 +3333,7 @@ ospf_flush_self_originated_lsas_now (struct ospf *ospf)
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("LSA[Type%d:%s]: Schedule self-originated LSA to FLUSH",
lsa->data->type, inet_ntoa (lsa->data->id));
-
+
ospf_refresher_unregister_lsa (ospf, oi->network_lsa_self);
ospf_lsa_flush_area (oi->network_lsa_self, area);
ospf_lsa_unlock (&oi->network_lsa_self);
@@ -3381,7 +3383,7 @@ ospf_flush_self_originated_lsas_now (struct ospf *ospf)
/* If there is self-originated LSA, then return 1, otherwise return 0. */
/* An interface-independent version of ospf_lsa_is_self_originated */
-int
+int
ospf_lsa_is_self_originated (struct ospf *ospf, struct ospf_lsa *lsa)
{
struct listnode *node;
@@ -3470,7 +3472,7 @@ ospf_lsa_unique_id (struct ospf *ospf,
return id;
}
-
+
#define LSA_ACTION_FLOOD_AREA 1
#define LSA_ACTION_FLUSH_AREA 2
@@ -3500,6 +3502,8 @@ ospf_lsa_action (struct thread *t)
case LSA_ACTION_FLUSH_AREA:
ospf_lsa_flush_area (data->lsa, data->area);
break;
+ default:
+ break ;
}
ospf_lsa_unlock (&data->lsa); /* Message */
@@ -3533,7 +3537,7 @@ ospf_schedule_lsa_flush_area (struct ospf_area *area, struct ospf_lsa *lsa)
thread_add_event (master, ospf_lsa_action, data, 0);
}
-
+
/* LSA Refreshment functions. */
struct ospf_lsa *
ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
@@ -3549,7 +3553,7 @@ ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
case OSPF_ROUTER_LSA:
new = ospf_router_lsa_refresh (lsa);
break;
- case OSPF_NETWORK_LSA:
+ case OSPF_NETWORK_LSA:
new = ospf_network_lsa_refresh (lsa);
break;
case OSPF_SUMMARY_LSA:
@@ -3559,7 +3563,7 @@ ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
new = ospf_summary_asbr_lsa_refresh (ospf, lsa);
break;
case OSPF_AS_EXTERNAL_LSA:
- /* Translated from NSSA Type-5s are refreshed when
+ /* Translated from NSSA Type-5s are refreshed when
* from refresh of Type-7 - do not refresh these directly.
*/
if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
@@ -3587,7 +3591,7 @@ void
ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa)
{
u_int16_t index, current_index;
-
+
assert (lsa->lock > 0);
assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF));
@@ -3597,19 +3601,19 @@ ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa)
if (LS_AGE (lsa) == 0 &&
ntohl (lsa->data->ls_seqnum) == OSPF_INITIAL_SEQUENCE_NUMBER)
- /* Randomize first update by OSPF_LS_REFRESH_SHIFT factor */
+ /* Randomize first update by OSPF_LS_REFRESH_SHIFT factor */
delay = OSPF_LS_REFRESH_SHIFT + (random () % OSPF_LS_REFRESH_TIME);
else
/* Randomize another updates by +-OSPF_LS_REFRESH_JITTER factor */
delay = OSPF_LS_REFRESH_TIME - LS_AGE (lsa) - OSPF_LS_REFRESH_JITTER
- + (random () % (2*OSPF_LS_REFRESH_JITTER));
+ + (random () % (2*OSPF_LS_REFRESH_JITTER));
if (delay < 0)
delay = 0;
current_index = ospf->lsa_refresh_queue.index + (quagga_time (NULL)
- ospf->lsa_refresher_started)/OSPF_LSA_REFRESHER_GRANULARITY;
-
+
index = (current_index + delay/OSPF_LSA_REFRESHER_GRANULARITY)
% (OSPF_LSA_REFRESHER_SLOTS);
@@ -3623,7 +3627,7 @@ ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa)
lsa->refresh_list = index;
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
zlog_debug ("LSA[Refresh:%s]: ospf_refresher_register_lsa(): "
- "setting refresh_list on lsa %p (slod %d)",
+ "setting refresh_list on lsa %p (slod %d)",
inet_ntoa (lsa->data->id), lsa, index);
}
}
@@ -3660,9 +3664,9 @@ ospf_lsa_refresh_walker (struct thread *t)
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
zlog_debug ("LSA[Refresh]:ospf_lsa_refresh_walker(): start");
-
+
i = ospf->lsa_refresh_queue.index;
-
+
/* Note: if clock has jumped backwards, then time change could be negative,
so we are careful to cast the expression to unsigned before taking
modulus. */
@@ -3684,7 +3688,7 @@ ospf_lsa_refresh_walker (struct thread *t)
"refresh index %d", i);
refresh_list = ospf->lsa_refresh_queue.qs [i];
-
+
assert (i >= 0);
ospf->lsa_refresh_queue.qs [i] = NULL;
@@ -3695,9 +3699,9 @@ ospf_lsa_refresh_walker (struct thread *t)
{
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
zlog_debug ("LSA[Refresh:%s]: ospf_lsa_refresh_walker(): "
- "refresh lsa %p (slot %d)",
+ "refresh lsa %p (slot %d)",
inet_ntoa (lsa->data->id), lsa, i);
-
+
assert (lsa->lock > 0);
list_delete_node (refresh_list, node);
lsa->refresh_list = -1;
@@ -3717,12 +3721,12 @@ ospf_lsa_refresh_walker (struct thread *t)
assert (lsa->lock > 0);
ospf_lsa_unlock (&lsa); /* lsa_refresh_queue & temp for lsa_to_refresh*/
}
-
+
list_delete (lsa_to_refresh);
-
+
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
zlog_debug ("LSA[Refresh]: ospf_lsa_refresh_walker(): end");
-
+
return 0;
}
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index 967ca15d..7d0b6e43 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -3,7 +3,7 @@
* Copyright (C) 1999, 2000 Toshiaki Takada
*
* This file is part of GNU Zebra.
- *
+ *
* GNU Zebra is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or (at your
@@ -121,7 +121,7 @@ ospf_nbr_free (struct ospf_neighbor *nbr)
ospf_lsdb_cleanup (&nbr->db_sum);
ospf_lsdb_cleanup (&nbr->ls_req);
ospf_lsdb_cleanup (&nbr->ls_rxmt);
-
+
/* Clear last send packet. */
if (nbr->last_send)
ospf_packet_free (nbr->last_send);
@@ -153,7 +153,7 @@ ospf_nbr_delete (struct ospf_neighbor *nbr)
struct prefix p;
oi = nbr->oi;
-
+
/* get appropriate prefix 'key' */
ospf_nbr_key (oi, nbr, &p);
@@ -168,7 +168,7 @@ ospf_nbr_delete (struct ospf_neighbor *nbr)
* should never have NULL info.
*/
assert (rn->info);
-
+
if (rn->info)
{
rn->info = NULL;
@@ -215,7 +215,7 @@ ospf_nbr_add_self (struct ospf_interface *oi)
oi->nbr_self->router_id = oi->ospf->router_id;
oi->nbr_self->src = oi->address->u.prefix4;
oi->nbr_self->state = NSM_TwoWay;
-
+
switch (oi->area->external_routing)
{
case OSPF_AREA_DEFAULT:
@@ -228,11 +228,13 @@ ospf_nbr_add_self (struct ospf_interface *oi)
UNSET_FLAG (oi->nbr_self->options, OSPF_OPTION_E);
SET_FLAG (oi->nbr_self->options, OSPF_OPTION_NP);
break;
+ default:
+ break ;
}
-
+
/* Add nbr_self to nbrs table */
ospf_nbr_key (oi, oi->nbr_self, &p);
-
+
rn = route_node_get (oi->nbrs, &p);
if (rn->info)
{
@@ -282,7 +284,7 @@ ospf_nbr_count_opaque_capable (struct ospf_interface *oi)
#endif /* HAVE_OPAQUE_LSA */
/* lookup nbr by address - use this only if you know you must
- * otherwise use the ospf_nbr_lookup() wrapper, which deals
+ * otherwise use the ospf_nbr_lookup() wrapper, which deals
* with virtual link neighbours
*/
struct ospf_neighbor *
@@ -300,7 +302,7 @@ ospf_nbr_lookup_by_addr (struct route_table *nbrs,
rn = route_node_lookup (nbrs, &p);
if (! rn)
return NULL;
-
+
/* See comment in ospf_nbr_delete */
assert (rn->info);
@@ -386,7 +388,7 @@ ospf_nbr_add (struct ospf_interface *oi, struct ospf_header *ospfh,
struct prefix *p)
{
struct ospf_neighbor *nbr;
-
+
nbr = ospf_nbr_new (oi);
nbr->state = NSM_Down;
nbr->src = p->u.prefix4;
@@ -412,15 +414,15 @@ ospf_nbr_add (struct ospf_interface *oi, struct ospf_header *ospfh,
}
}
}
-
+
/* New nbr, save the crypto sequence number if necessary */
if (ntohs (ospfh->auth_type) == OSPF_AUTH_CRYPTOGRAPHIC)
nbr->crypt_seqnum = ospfh->u.crypt.crypt_seqnum;
-
+
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("NSM[%s:%s]: start", IF_NAME (nbr->oi),
inet_ntoa (nbr->router_id));
-
+
return nbr;
}
@@ -431,7 +433,7 @@ ospf_nbr_get (struct ospf_interface *oi, struct ospf_header *ospfh,
struct route_node *rn;
struct prefix key;
struct ospf_neighbor *nbr;
-
+
key.family = AF_INET;
key.prefixlen = IPV4_MAX_BITLEN;
@@ -445,7 +447,7 @@ ospf_nbr_get (struct ospf_interface *oi, struct ospf_header *ospfh,
{
route_unlock_node (rn);
nbr = rn->info;
-
+
if (oi->type == OSPF_IFTYPE_NBMA && nbr->state == NSM_Attempt)
{
nbr->src = iph->ip_src;
@@ -456,7 +458,7 @@ ospf_nbr_get (struct ospf_interface *oi, struct ospf_header *ospfh,
{
rn->info = nbr = ospf_nbr_add (oi, ospfh, p);
}
-
+
nbr->router_id = ospfh->router_id;
return nbr;