diff options
author | Lou Berger <lberger@labn.net> | 2018-03-06 20:02:52 +0100 |
---|---|---|
committer | Lou Berger <lberger@labn.net> | 2018-03-06 20:04:32 +0100 |
commit | 996c93142d3abfab0f6d6c800474e22a8cfbdbc5 (patch) | |
tree | 2b28846d256c84cf7b7f1a8988fb3267c8611722 /ospfd | |
parent | bgpd: another change to keep indent.py happy (diff) | |
download | frr-996c93142d3abfab0f6d6c800474e22a8cfbdbc5.tar.xz frr-996c93142d3abfab0f6d6c800474e22a8cfbdbc5.zip |
*: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
Diffstat (limited to 'ospfd')
34 files changed, 999 insertions, 1170 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index ea94bab6b..b29f35d7c 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -976,7 +976,7 @@ static void ospf_abr_process_nssa_translates(struct ospf *ospf) "looking at area %s", inet_ntoa(area->area_id)); - LSDB_LOOP(NSSA_LSDB(area), rn, lsa) + LSDB_LOOP (NSSA_LSDB(area), rn, lsa) ospf_abr_translate_nssa(area, lsa); } @@ -1323,7 +1323,7 @@ ospf_abr_unapprove_translates(struct ospf *ospf) /* For NSSA Translations */ /* NSSA Translator is not checked, because it may have gone away, and we would want to flush any residuals anyway */ - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) if (CHECK_FLAG(lsa->flags, OSPF_LSA_LOCAL_XLT)) { UNSET_FLAG(lsa->flags, OSPF_LSA_APPROVED); if (IS_DEBUG_OSPF_NSSA) @@ -1353,7 +1353,7 @@ static void ospf_abr_unapprove_summaries(struct ospf *ospf) "ospf_abr_unapprove_summaries(): " "considering area %s", inet_ntoa(area->area_id)); - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) if (ospf_lsa_is_self_originated(ospf, lsa)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( @@ -1363,7 +1363,7 @@ static void ospf_abr_unapprove_summaries(struct ospf *ospf) UNSET_FLAG(lsa->flags, OSPF_LSA_APPROVED); } - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) if (ospf_lsa_is_self_originated(ospf, lsa)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( @@ -1631,7 +1631,7 @@ static void ospf_abr_remove_unapproved_translates(struct ospf *ospf) if (IS_DEBUG_OSPF_NSSA) zlog_debug("ospf_abr_remove_unapproved_translates(): Start"); - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) ospf_abr_remove_unapproved_translates_apply(ospf, lsa); if (IS_DEBUG_OSPF_NSSA) @@ -1655,12 +1655,12 @@ static void ospf_abr_remove_unapproved_summaries(struct ospf *ospf) "looking at area %s", inet_ntoa(area->area_id)); - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) if (ospf_lsa_is_self_originated(ospf, lsa)) if (!CHECK_FLAG(lsa->flags, OSPF_LSA_APPROVED)) ospf_lsa_flush_area(lsa, area); - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) if (ospf_lsa_is_self_originated(ospf, lsa)) if (!CHECK_FLAG(lsa->flags, OSPF_LSA_APPROVED)) ospf_lsa_flush_area(lsa, area); @@ -1683,13 +1683,14 @@ static void ospf_abr_manage_discard_routes(struct ospf *ospf) if (CHECK_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE)) { if (range->specifics) - ospf_add_discard_route(ospf, - ospf->new_table, area, + ospf_add_discard_route( + ospf, ospf->new_table, + area, (struct prefix_ipv4 *)&rn->p); else - ospf_delete_discard_route(ospf, - ospf->new_table, + ospf_delete_discard_route( + ospf, ospf->new_table, (struct prefix_ipv4 *)&rn->p); } diff --git a/ospfd/ospf_api.h b/ospfd/ospf_api.h index 526e8228f..7b055db12 100644 --- a/ospfd/ospf_api.h +++ b/ospfd/ospf_api.h @@ -154,8 +154,6 @@ static const u_int16_t Power2[] = { struct lsa_filter_type { u_int16_t typemask; /* bitmask for selecting LSA types (1..16) */ u_char origin; /* selects according to origin. */ - /* $FRR indent$ */ - /* clang-format off */ #define NON_SELF_ORIGINATED 0 #define SELF_ORIGINATED (OSPF_LSA_SELF) #define ANY_ORIGIN 2 diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 9ebaeffa6..36bd49125 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -1312,27 +1312,27 @@ int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv, if (i) { /* Check msg type. */ if (mask & Power2[OSPF_ROUTER_LSA]) - LSDB_LOOP(ROUTER_LSDB(area), rn, lsa) + LSDB_LOOP (ROUTER_LSDB(area), rn, lsa) apiserver_sync_callback( lsa, (void *)¶m, seqnum); if (mask & Power2[OSPF_NETWORK_LSA]) - LSDB_LOOP(NETWORK_LSDB(area), rn, lsa) + LSDB_LOOP (NETWORK_LSDB(area), rn, lsa) apiserver_sync_callback( lsa, (void *)¶m, seqnum); if (mask & Power2[OSPF_SUMMARY_LSA]) - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) apiserver_sync_callback( lsa, (void *)¶m, seqnum); if (mask & Power2[OSPF_ASBR_SUMMARY_LSA]) - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) apiserver_sync_callback( lsa, (void *)¶m, seqnum); if (mask & Power2[OSPF_OPAQUE_LINK_LSA]) - LSDB_LOOP(OPAQUE_LINK_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa) apiserver_sync_callback( lsa, (void *)¶m, seqnum); if (mask & Power2[OSPF_OPAQUE_AREA_LSA]) - LSDB_LOOP(OPAQUE_AREA_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa) apiserver_sync_callback( lsa, (void *)¶m, seqnum); } @@ -1341,7 +1341,7 @@ int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv, /* For AS-external LSAs */ if (ospf->lsdb) { if (mask & Power2[OSPF_AS_EXTERNAL_LSA]) - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) apiserver_sync_callback(lsa, (void *)¶m, seqnum); } @@ -1349,7 +1349,7 @@ int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv, /* For AS-external opaque LSAs */ if (ospf->lsdb) { if (mask & Power2[OSPF_OPAQUE_AS_LSA]) - LSDB_LOOP(OPAQUE_AS_LSDB(ospf), rn, lsa) + LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) apiserver_sync_callback(lsa, (void *)¶m, seqnum); } @@ -1952,18 +1952,18 @@ void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv, case OSPF_OPAQUE_LINK_LSA: for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) - LSDB_LOOP(OPAQUE_LINK_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa) apiserver_flush_opaque_type_callback( lsa, (void *)¶m, 0); break; case OSPF_OPAQUE_AREA_LSA: for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) - LSDB_LOOP(OPAQUE_AREA_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa) apiserver_flush_opaque_type_callback( lsa, (void *)¶m, 0); break; case OSPF_OPAQUE_AS_LSA: - LSDB_LOOP(OPAQUE_LINK_LSDB(ospf), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(ospf), rn, lsa) apiserver_flush_opaque_type_callback(lsa, (void *)¶m, 0); break; diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 33461e6df..b970c1183 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -58,9 +58,8 @@ void ospf_external_route_remove(struct ospf *ospf, struct prefix_ipv4 *p) /* Remove route from zebra. */ if (or->type == OSPF_DESTINATION_NETWORK) - ospf_zebra_delete(ospf, - (struct prefix_ipv4 *)&rn->p, - or); + ospf_zebra_delete( + ospf, (struct prefix_ipv4 *)&rn->p, or); ospf_route_free(or); rn->info = NULL; @@ -127,12 +126,10 @@ int ospf_route_map_set_compare(struct route_map_set_values *values1, } /* Add an External info for AS-external-LSA. */ -struct external_info *ospf_external_info_add(struct ospf *ospf, u_char type, - u_short instance, - struct prefix_ipv4 p, - ifindex_t ifindex, - struct in_addr nexthop, - route_tag_t tag) +struct external_info * +ospf_external_info_add(struct ospf *ospf, u_char type, u_short instance, + struct prefix_ipv4 p, ifindex_t ifindex, + struct in_addr nexthop, route_tag_t tag) { struct external_info *new; struct route_node *rn; @@ -160,8 +157,8 @@ struct external_info *ospf_external_info_add(struct ospf *ospf, u_char type, zlog_warn( "Redistribute[%s][%d][%u]: %s/%d discarding old info with NH %s.", ospf_redist_string(type), instance, - ospf->vrf_id, inet_ntoa(p.prefix), - p.prefixlen, inetbuf); + ospf->vrf_id, inet_ntoa(p.prefix), p.prefixlen, + inetbuf); XFREE(MTYPE_OSPF_EXTERNAL_INFO, rn->info); rn->info = NULL; } diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index 38ed95322..d437314c8 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -58,16 +58,14 @@ extern struct external_info *ospf_external_info_new(u_char, u_short); extern void ospf_reset_route_map_set_values(struct route_map_set_values *); extern int ospf_route_map_set_compare(struct route_map_set_values *, struct route_map_set_values *); -extern struct external_info *ospf_external_info_add(struct ospf *, - u_char, u_short, - struct prefix_ipv4, +extern struct external_info *ospf_external_info_add(struct ospf *, u_char, + u_short, struct prefix_ipv4, ifindex_t, struct in_addr, route_tag_t); -extern void ospf_external_info_delete(struct ospf*, u_char, u_short, +extern void ospf_external_info_delete(struct ospf *, u_char, u_short, struct prefix_ipv4); -extern struct external_info *ospf_external_info_lookup(struct ospf*, u_char, - u_short, - struct prefix_ipv4 *); +extern struct external_info * +ospf_external_info_lookup(struct ospf *, u_char, u_short, struct prefix_ipv4 *); extern struct ospf_route *ospf_external_route_lookup(struct ospf *, struct prefix_ipv4 *); extern void ospf_asbr_status_update(struct ospf *, u_char); diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index d2af97483..0c2ddc964 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -610,9 +610,8 @@ static int ospf_ase_compare_tables(struct ospf *ospf, if ((or = rn->info)) { if (!(new_rn = route_node_lookup(new_external_route, &rn->p))) - ospf_zebra_delete(ospf, - (struct prefix_ipv4 *)&rn->p, - or); + ospf_zebra_delete( + ospf, (struct prefix_ipv4 *)&rn->p, or); else route_unlock_node(new_rn); } @@ -623,9 +622,8 @@ static int ospf_ase_compare_tables(struct ospf *ospf, if ((or = rn->info) != NULL) if (!ospf_ase_route_match_same(old_external_route, &rn->p, or)) - ospf_zebra_add(ospf, - (struct prefix_ipv4 *)&rn->p, - or); + ospf_zebra_add( + ospf, (struct prefix_ipv4 *)&rn->p, or); return 0; } @@ -648,7 +646,7 @@ static int ospf_ase_calculate_timer(struct thread *t) monotime(&start_time); /* Calculate external route for each AS-external-LSA */ - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) ospf_ase_calculate_route(ospf, lsa); /* This version simple adds to the table all NSSA areas */ @@ -660,12 +658,12 @@ static int ospf_ase_calculate_timer(struct thread *t) inet_ntoa(area->area_id)); if (area->external_routing == OSPF_AREA_NSSA) - LSDB_LOOP(NSSA_LSDB(area), rn, lsa) + LSDB_LOOP (NSSA_LSDB(area), rn, lsa) ospf_ase_calculate_route(ospf, lsa); } /* kevinm: And add the NSSA routes in ospf_top */ - LSDB_LOOP(NSSA_LSDB(ospf), rn, lsa) + LSDB_LOOP (NSSA_LSDB(ospf), rn, lsa) ospf_ase_calculate_route(ospf, lsa); /* Compare old and new external routing table and install the @@ -681,9 +679,12 @@ static int ospf_ase_calculate_timer(struct thread *t) monotime(&stop_time); if (IS_DEBUG_OSPF_EVENT) - zlog_info("SPF Processing Time(usecs): External Routes: %lld\n", - (stop_time.tv_sec - start_time.tv_sec) * 1000000LL - + (stop_time.tv_usec - start_time.tv_usec)); + zlog_info( + "SPF Processing Time(usecs): External Routes: %lld\n", + (stop_time.tv_sec - start_time.tv_sec) + * 1000000LL + + (stop_time.tv_usec + - start_time.tv_usec)); } return 0; } diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c index 95835cfd0..10dd2f92c 100644 --- a/ospfd/ospf_ext.c +++ b/ospfd/ospf_ext.c @@ -122,8 +122,8 @@ int ospf_ext_init(void) zlog_info("EXT (%s): Register Extended Link Opaque LSA", __func__); rc = ospf_register_opaque_functab( OSPF_OPAQUE_AREA_LSA, OPAQUE_TYPE_EXTENDED_LINK_LSA, - ospf_ext_link_new_if, /* new if */ - ospf_ext_link_del_if, /* del if */ + ospf_ext_link_new_if, /* new if */ + ospf_ext_link_del_if, /* del if */ ospf_ext_link_ism_change, /* ism change */ ospf_ext_link_nsm_change, /* nsm change */ NULL, /* Write router config. */ @@ -316,9 +316,8 @@ static void set_prefix_sid(struct ext_itf *exti, uint8_t algorithm, if ((algorithm != SR_ALGORITHM_SPF) && (algorithm != SR_ALGORITHM_STRICT_SPF)) { - zlog_warn( - "EXT (%s): unrecognized algorithm, not SPF or S-SPF", - __func__); + zlog_warn("EXT (%s): unrecognized algorithm, not SPF or S-SPF", + __func__); return; } @@ -342,7 +341,6 @@ static void set_prefix_sid(struct ext_itf *exti, uint8_t algorithm, htons(SID_INDEX_SIZE(EXT_SUBTLV_PREFIX_SID_SIZE)); exti->node_sid.value = htonl(value); } - } /* Adjacency SID SubTLV - section 6.1 */ @@ -385,7 +383,6 @@ static void set_adj_sid(struct ext_itf *exti, bool backup, uint32_t value, exti->adj_sid[index].flags = flags; /* Set computed flags */ exti->adj_sid[index].mtid = 0; /* Multi-Topology is not supported */ exti->adj_sid[index].weight = 0; /* Load-Balancing is not supported */ - } /* LAN Adjacency SID SubTLV - section 6.2 */ @@ -428,7 +425,6 @@ static void set_lan_adj_sid(struct ext_itf *exti, bool backup, uint32_t value, exti->lan_sid[index].mtid = 0; /* Multi-Topology is not supported */ exti->lan_sid[index].weight = 0; /* Load-Balancing is not supported */ exti->lan_sid[index].neighbor_id = neighbor_id; - } /* Experimental SubTLV from Cisco */ @@ -438,7 +434,6 @@ static void set_rmt_itf_addr(struct ext_itf *exti, struct in_addr rmtif) TLV_TYPE(exti->rmt_itf_addr) = htons(EXT_SUBTLV_RMT_ITF_ADDR); TLV_LEN(exti->rmt_itf_addr) = htons(sizeof(struct in_addr)); exti->rmt_itf_addr.value = rmtif; - } /* @@ -452,7 +447,7 @@ static void set_rmt_itf_addr(struct ext_itf *exti, struct in_addr rmtif) * @return instance number if update is OK, 0 otherwise */ uint32_t ospf_ext_schedule_prefix_index(struct interface *ifp, uint32_t index, - struct prefix_ipv4 *p, uint8_t flags) + struct prefix_ipv4 *p, uint8_t flags) { int rc = 0; struct ext_itf *exti; @@ -483,9 +478,8 @@ uint32_t ospf_ext_schedule_prefix_index(struct interface *ifp, uint32_t index, ospf_ext_pref_lsa_schedule(exti, REORIGINATE_THIS_LSA); } else { if (IS_DEBUG_OSPF_SR) - zlog_debug( - "EXT (%s): Remove prefix for interface %s", - __func__, ifp->name); + zlog_debug("EXT (%s): Remove prefix for interface %s", + __func__, ifp->name); if (CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ENGAGED)) { ospf_ext_pref_lsa_schedule(exti, FLUSH_THIS_LSA); @@ -510,9 +504,8 @@ void ospf_ext_update_sr(bool enable) struct ext_itf *exti; if (IS_DEBUG_OSPF_SR) - zlog_debug( - "EXT (%s): %s Extended LSAs for Segment Routing ", - __func__, enable ? "Enable" : "Disable"); + zlog_debug("EXT (%s): %s Extended LSAs for Segment Routing ", + __func__, enable ? "Enable" : "Disable"); if (enable) { OspfEXT.enabled = true; @@ -545,9 +538,8 @@ static int ospf_ext_link_new_if(struct interface *ifp) int rc = -1; if (lookup_ext_by_ifp(ifp) != NULL) { - zlog_warn( - "EXT (%s): interface %s is already in use", - __func__, ifp ? ifp->name : "-"); + zlog_warn("EXT (%s): interface %s is already in use", __func__, + ifp ? ifp->name : "-"); rc = 0; /* Do nothing here. */ return rc; } @@ -586,9 +578,8 @@ static int ospf_ext_link_del_if(struct interface *ifp) rc = 0; } else { - zlog_warn( - "EXT (%s): interface %s is not found", - __func__, ifp ? ifp->name : "-"); + zlog_warn("EXT (%s): interface %s is not found", __func__, + ifp ? ifp->name : "-"); } return rc; @@ -605,9 +596,8 @@ static void ospf_ext_link_ism_change(struct ospf_interface *oi, int old_status) /* Get interface information for Segment Routing */ exti = lookup_ext_by_ifp(oi->ifp); if (exti == NULL) { - zlog_warn( - "EXT (%s): Cannot get Extended info. from OI(%s)", - __func__, IF_NAME(oi)); + zlog_warn("EXT (%s): Cannot get Extended info. from OI(%s)", + __func__, IF_NAME(oi)); return; } @@ -621,10 +611,9 @@ static void ospf_ext_link_ism_change(struct ospf_interface *oi, int old_status) exti->instance = get_ext_link_instance_value(); exti->type = OPAQUE_TYPE_EXTENDED_LINK_LSA; - zlog_debug( - "EXT (%s): Set %s SID to interface %s ", __func__, - exti->stype == ADJ_SID ? "Adj." : "LAN Adj.", - oi->ifp->name); + zlog_debug("EXT (%s): Set %s SID to interface %s ", __func__, + exti->stype == ADJ_SID ? "Adj." : "LAN Adj.", + oi->ifp->name); } } @@ -639,9 +628,8 @@ static void ospf_ext_pref_ism_change(struct ospf_interface *oi, int old_status) /* Get interface information for Segment Routing */ exti = lookup_ext_by_ifp(oi->ifp); if (exti == NULL) { - zlog_warn( - "EXT (%s): Cannot get Extended info. from OI(%s)", - __func__, IF_NAME(oi)); + zlog_warn("EXT (%s): Cannot get Extended info. from OI(%s)", + __func__, IF_NAME(oi)); return; } @@ -651,9 +639,8 @@ static void ospf_ext_pref_ism_change(struct ospf_interface *oi, int old_status) exti->instance = get_ext_pref_instance_value(); exti->type = OPAQUE_TYPE_EXTENDED_PREFIX_LSA; - zlog_debug( - "EXT (%s): Set Node SID to interface %s ", __func__, - oi->ifp->name); + zlog_debug("EXT (%s): Set Node SID to interface %s ", __func__, + oi->ifp->name); /* Complete SRDB if the interface belongs to a Prefix */ if (OspfEXT.enabled) @@ -678,16 +665,14 @@ static void ospf_ext_link_nsm_change(struct ospf_neighbor *nbr, int old_status) /* Get interface information for Segment Routing */ exti = lookup_ext_by_ifp(oi->ifp); if (exti == NULL) { - zlog_warn( - "EXT (%s): Cannot get Extended info. from OI(%s)", - __func__, IF_NAME(oi)); + zlog_warn("EXT (%s): Cannot get Extended info. from OI(%s)", + __func__, IF_NAME(oi)); return; } if (oi->area == NULL || oi->area->ospf == NULL) { - zlog_warn( - "EXT (%s): Cannot refer to OSPF from OI(%s)", - __func__, IF_NAME(oi)); + zlog_warn("EXT (%s): Cannot refer to OSPF from OI(%s)", + __func__, IF_NAME(oi)); return; } @@ -761,10 +746,10 @@ static void ospf_ext_link_nsm_change(struct ospf_neighbor *nbr, int old_status) } if (IS_DEBUG_OSPF_SR) - zlog_debug( - "EXT (%s): Complete %s SID to interface %s ", __func__, - exti->stype == ADJ_SID ? "Adj." : "LAN Adj.", - oi->ifp->name); + zlog_debug("EXT (%s): Complete %s SID to interface %s ", + __func__, + exti->stype == ADJ_SID ? "Adj." : "LAN Adj.", + oi->ifp->name); /* flood this links params if everything is ok */ SET_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE); @@ -774,7 +759,6 @@ static void ospf_ext_link_nsm_change(struct ospf_neighbor *nbr, int old_status) else ospf_ext_link_lsa_schedule(exti, REORIGINATE_THIS_LSA); } - } /* Callbacks to handle Extended Link Segment Routing LSA information */ @@ -856,7 +840,6 @@ static int ospf_ext_pref_lsa_update(struct ospf_lsa *lsa) static void build_tlv_header(struct stream *s, struct tlv_header *tlvh) { stream_put(s, tlvh, sizeof(struct tlv_header)); - } static void build_tlv(struct stream *s, struct tlv_header *tlvh) @@ -866,7 +849,6 @@ static void build_tlv(struct stream *s, struct tlv_header *tlvh) build_tlv_header(s, tlvh); stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh)); } - } /* Build an Extended Prefix Opaque LSA body for extended prefix TLV */ @@ -878,16 +860,14 @@ static void ospf_ext_pref_lsa_body_set(struct stream *s, struct ext_itf *exti) return; /* Adjust Extended Prefix TLV size */ - TLV_LEN(exti->prefix) = - htons(ntohs(TLV_LEN(exti->node_sid)) + EXT_TLV_PREFIX_SIZE - + TLV_HDR_SIZE); + TLV_LEN(exti->prefix) = htons(ntohs(TLV_LEN(exti->node_sid)) + + EXT_TLV_PREFIX_SIZE + TLV_HDR_SIZE); /* Build LSA body for an Extended Prefix TLV */ build_tlv_header(s, &exti->prefix.header); stream_put(s, TLV_DATA(&exti->prefix.header), EXT_TLV_PREFIX_SIZE); /* Then add Prefix SID SubTLV */ build_tlv(s, &exti->node_sid.header); - } /* Build an Extended Link Opaque LSA body for extended link TLV */ @@ -903,10 +883,10 @@ static void ospf_ext_link_lsa_body_set(struct stream *s, struct ext_itf *exti) if (exti->stype == ADJ_SID) { /* Adjust Extended Link TLV size for Adj. SID */ size = EXT_TLV_LINK_SIZE + 2 * EXT_SUBTLV_ADJ_SID_SIZE - + 2 * TLV_HDR_SIZE; + + 2 * TLV_HDR_SIZE; if (ntohs(TLV_TYPE(exti->rmt_itf_addr)) != 0) size = size + EXT_SUBTLV_RMT_ITF_ADDR_SIZE - + TLV_HDR_SIZE; + + TLV_HDR_SIZE; TLV_LEN(exti->link) = htons(size); /* Build LSA body for an Extended Link TLV with Adj. SID */ @@ -922,7 +902,7 @@ static void ospf_ext_link_lsa_body_set(struct stream *s, struct ext_itf *exti) } else { /* Adjust Extended Link TLV size for LAN SID */ size = EXT_TLV_LINK_SIZE - + 2 * (EXT_SUBTLV_LAN_ADJ_SID_SIZE + TLV_HDR_SIZE); + + 2 * (EXT_SUBTLV_LAN_ADJ_SID_SIZE + TLV_HDR_SIZE); TLV_LEN(exti->link) = htons(size); /* Build LSA body for an Extended Link TLV with LAN SID */ @@ -932,7 +912,6 @@ static void ospf_ext_link_lsa_body_set(struct stream *s, struct ext_itf *exti) build_tlv(s, &exti->lan_sid[1].header); build_tlv(s, &exti->lan_sid[0].header); } - } /* Create new Extended Prefix opaque-LSA for every extended prefix */ @@ -1200,8 +1179,8 @@ static int ospf_ext_link_lsa_originate1(struct ospf_area *area, zlog_debug( "EXT (%s): LSA[Type%u:%s]: Originate Opaque-LSA " "Extended Link Opaque LSA: Area(%s), Link(%s)", - __func__, new->data->type, inet_ntoa(new->data->id), - area_id, exti->ifp->name); + __func__, new->data->type, inet_ntoa(new->data->id), + area_id, exti->ifp->name); ospf_lsa_header_dump(new->data); } @@ -1221,14 +1200,14 @@ static int ospf_ext_pref_lsa_originate(void *arg) if (!OspfEXT.enabled) { zlog_info( "EXT (%s): Segment Routing " - "functionality is Disabled now", __func__); + "functionality is Disabled now", + __func__); rc = 0; /* This is not an error case. */ return rc; } if (IS_DEBUG_OSPF_SR) - zlog_debug( - "EXT (%s): Start Originate Prefix LSA for area %s", - __func__, inet_ntoa(area->area_id)); + zlog_debug("EXT (%s): Start Originate Prefix LSA for area %s", + __func__, inet_ntoa(area->area_id)); /* Check if Extended Prefix Opaque LSA is already engaged */ for (ALL_LIST_ELEMENTS_RO(OspfEXT.iflist, node, exti)) { @@ -1247,7 +1226,8 @@ static int ospf_ext_pref_lsa_originate(void *arg) EXT_LPFLG_LSA_FORCED_REFRESH)) { zlog_warn( "EXT (%s): Refresh instead of " - "Originate", __func__); + "Originate", + __func__); UNSET_FLAG(exti->flags, EXT_LPFLG_LSA_FORCED_REFRESH); ospf_ext_pref_lsa_schedule(exti, @@ -1281,7 +1261,8 @@ static int ospf_ext_link_lsa_originate(void *arg) if (!OspfEXT.enabled) { zlog_info( "EXT (%s): Segment Routing " - "functionality is Disabled now", __func__); + "functionality is Disabled now", + __func__); rc = 0; /* This is not an error case. */ return rc; } @@ -1303,7 +1284,8 @@ static int ospf_ext_link_lsa_originate(void *arg) EXT_LPFLG_LSA_FORCED_REFRESH)) { zlog_warn( "EXT (%s): Refresh instead of " - "Originate", __func__); + "Originate", + __func__); UNSET_FLAG(exti->flags, EXT_LPFLG_LSA_FORCED_REFRESH); ospf_ext_link_lsa_schedule(exti, @@ -1343,7 +1325,8 @@ static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa) */ zlog_info( "EXT (%s): Segment Routing functionality is " - "Disabled", __func__); + "Disabled", + __func__); /* Flush it anyway. */ lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); } @@ -1359,7 +1342,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa) /* Check if Interface was not disable in the interval */ if ((exti != NULL) && !CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE)) { zlog_warn("EXT (%s): Interface was Disabled: Flush it!", - __func__); + __func__); /* Flush it anyway. */ lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); } @@ -1425,9 +1408,8 @@ static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa) * This LSA must have flushed before due to OSPF-SR status * change. It seems a slip among routers in the routing domain. */ - zlog_info( - "EXT (%s): Segment Routing functionality is Disabled", - __func__); + zlog_info("EXT (%s): Segment Routing functionality is Disabled", + __func__); /* Flush it anyway. */ lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); } @@ -1442,9 +1424,8 @@ static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa) /* Check if Interface was not disable in the interval */ if ((exti != NULL) && !CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE)) { - zlog_warn( - "EXT (%s): Interface was Disabled: Flush it!", - __func__); + zlog_warn("EXT (%s): Interface was Disabled: Flush it!", + __func__); lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); } @@ -1506,18 +1487,18 @@ static void ospf_ext_pref_lsa_schedule(struct ext_itf *exti, if (!(CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE))) return; - zlog_debug( - "EXT (%s): Schedule %s%s%s LSA for interface %s", __func__, - opcode == REORIGINATE_THIS_LSA ? "Re-Originate" : "", - opcode == REFRESH_THIS_LSA ? "Refresh" : "", - opcode == FLUSH_THIS_LSA ? "Flush" : "", - exti->ifp ? exti->ifp->name : "-"); + zlog_debug("EXT (%s): Schedule %s%s%s LSA for interface %s", __func__, + opcode == REORIGINATE_THIS_LSA ? "Re-Originate" : "", + opcode == REFRESH_THIS_LSA ? "Refresh" : "", + opcode == FLUSH_THIS_LSA ? "Flush" : "", + exti->ifp ? exti->ifp->name : "-"); /* Set LSA header information */ if (exti->area == NULL) { zlog_warn( "EXT (%s): Flooding is Area scope but area is not yet " - "set", __func__); + "set", + __func__); if (OspfEXT.area == NULL) { top = ospf_lookup_by_vrf_id(VRF_DEFAULT); OspfEXT.area = ospf_area_lookup_by_area_id( @@ -1548,7 +1529,6 @@ static void ospf_ext_pref_lsa_schedule(struct ext_itf *exti, zlog_warn("EXT (%s): Unknown opcode", __func__); break; } - } /* Schedule Extended Link Opaque LSA origination/refreshment/flushing */ @@ -1571,18 +1551,18 @@ static void ospf_ext_link_lsa_schedule(struct ext_itf *exti, if (!(CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE))) return; - zlog_debug( - "EXT (%s): Schedule %s%s%s LSA for interface %s", __func__, - opcode == REORIGINATE_THIS_LSA ? "Re-Originate" : "", - opcode == REFRESH_THIS_LSA ? "Refresh" : "", - opcode == FLUSH_THIS_LSA ? "Flush" : "", - exti->ifp ? exti->ifp->name : "-"); + zlog_debug("EXT (%s): Schedule %s%s%s LSA for interface %s", __func__, + opcode == REORIGINATE_THIS_LSA ? "Re-Originate" : "", + opcode == REFRESH_THIS_LSA ? "Refresh" : "", + opcode == FLUSH_THIS_LSA ? "Flush" : "", + exti->ifp ? exti->ifp->name : "-"); /* Set LSA header information */ if (exti->area == NULL) { zlog_warn( "EXT (%s): Flooding is Area scope but area is not " - "yet set", __func__); + "yet set", + __func__); if (OspfEXT.area == NULL) { top = ospf_lookup_by_vrf_id(VRF_DEFAULT); OspfEXT.area = ospf_area_lookup_by_area_id( @@ -1613,7 +1593,6 @@ static void ospf_ext_link_lsa_schedule(struct ext_itf *exti, zlog_warn("EXT (%s): Unknown opcode", __func__); break; } - } /* Schedule Extended Link or Prefix depending of the Type of LSA */ @@ -1634,7 +1613,7 @@ static void ospf_ext_lsa_schedule(struct ext_itf *exti, enum lsa_opcode op) /* Cisco experimental SubTLV */ static uint16_t show_vty_ext_link_rmt_itf_addr(struct vty *vty, - struct tlv_header *tlvh) + struct tlv_header *tlvh) { struct ext_subtlv_rmt_itf_addr *top; @@ -1650,7 +1629,7 @@ static uint16_t show_vty_ext_link_rmt_itf_addr(struct vty *vty, /* Adjacency SID SubTLV */ static uint16_t show_vty_ext_link_adj_sid(struct vty *vty, - struct tlv_header *tlvh) + struct tlv_header *tlvh) { struct ext_subtlv_adj_sid *top = (struct ext_subtlv_adj_sid *)tlvh; @@ -1669,7 +1648,7 @@ static uint16_t show_vty_ext_link_adj_sid(struct vty *vty, /* LAN Adjacency SubTLV */ static uint16_t show_vty_ext_link_lan_adj_sid(struct vty *vty, - struct tlv_header *tlvh) + struct tlv_header *tlvh) { struct ext_subtlv_lan_adj_sid *top = (struct ext_subtlv_lan_adj_sid *)tlvh; @@ -1755,12 +1734,11 @@ static void ospf_ext_link_show_info(struct vty *vty, struct ospf_lsa *lsa) break; } } - } /* Prefix SID SubTLV */ static uint16_t show_vty_ext_pref_pref_sid(struct vty *vty, - struct tlv_header *tlvh) + struct tlv_header *tlvh) { struct ext_subtlv_prefix_sid *top = (struct ext_subtlv_prefix_sid *)tlvh; @@ -1830,5 +1808,4 @@ static void ospf_ext_pref_show_info(struct vty *vty, struct ospf_lsa *lsa) break; } } - } diff --git a/ospfd/ospf_ext.h b/ospfd/ospf_ext.h index 67280754d..c3f9ae94d 100644 --- a/ospfd/ospf_ext.h +++ b/ospfd/ospf_ext.h @@ -194,7 +194,7 @@ extern void ospf_ext_term(void); extern void ospf_ext_finish(void); extern void ospf_ext_update_sr(bool enable); extern uint32_t ospf_ext_schedule_prefix_index(struct interface *ifp, - uint32_t index, - struct prefix_ipv4 *p, - uint8_t flags); + uint32_t index, + struct prefix_ipv4 *p, + uint8_t flags); #endif /* _FRR_OSPF_EXT_PREF_H_ */ diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 7ad9cf9f2..183ddc0d8 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -218,7 +218,7 @@ static void ospf_process_self_originated_lsa(struct ospf *ospf, break; case OSPF_OPAQUE_AS_LSA: ospf_opaque_lsa_refresh(new); - /* Reconsideration may needed. */ /* XXX */ + /* Reconsideration may needed. */ /* XXX */ break; default: break; diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c index e570f3337..9b74cb8c0 100644 --- a/ospfd/ospf_ia.c +++ b/ospfd/ospf_ia.c @@ -282,7 +282,7 @@ static void ospf_examine_summaries(struct ospf_area *area, struct ospf_lsa *lsa; struct route_node *rn; - LSDB_LOOP(lsdb_rt, rn, lsa) + LSDB_LOOP (lsdb_rt, rn, lsa) process_summary_lsa(area, rt, rtrs, lsa); } @@ -582,7 +582,7 @@ static void ospf_examine_transit_summaries(struct ospf_area *area, struct ospf_lsa *lsa; struct route_node *rn; - LSDB_LOOP(lsdb_rt, rn, lsa) + LSDB_LOOP (lsdb_rt, rn, lsa) process_transit_summary_lsa(area, rt, rtrs, lsa); } diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index c8f758525..e19bfe7f5 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -849,8 +849,9 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf, } if (IS_DEBUG_OSPF_EVENT) - zlog_debug("ospf_vl_new(): creating pseudo zebra interface vrf id %u", - ospf->vrf_id); + zlog_debug( + "ospf_vl_new(): creating pseudo zebra interface vrf id %u", + ospf->vrf_id); snprintf(ifname, sizeof(ifname), "VLINK%d", vlink_count); vi = if_create(ifname, ospf->vrf_id); diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index ab02444f7..85a24f002 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -194,8 +194,6 @@ struct ospf_interface { /* Neighbor information. */ struct route_table *nbrs; /* OSPF Neighbor List */ struct ospf_neighbor *nbr_self; /* Neighbor Self */ - /* $FRR indent$ */ - /* clang-format off */ #define DR(I) ((I)->nbr_self->d_router) #define BDR(I) ((I)->nbr_self->bd_router) #define OPTIONS(I) ((I)->nbr_self->options) diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 0f1dd63df..588a8f672 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -2114,8 +2114,8 @@ int ospf_default_originate_timer(struct thread *thread) /* If there is no default route via redistribute, then originate AS-external-LSA with nexthop 0 (self). */ nexthop.s_addr = 0; - ospf_external_info_add(ospf, DEFAULT_ROUTE, 0, p, 0, - nexthop, 0); + ospf_external_info_add(ospf, DEFAULT_ROUTE, 0, p, 0, nexthop, + 0); } if ((ei = ospf_default_external_info(ospf))) @@ -2133,9 +2133,8 @@ void ospf_nssa_lsa_flush(struct ospf *ospf, struct prefix_ipv4 *p) for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) { if (area->external_routing == OSPF_AREA_NSSA) { - lsa = ospf_lsa_lookup(ospf, area, - OSPF_AS_NSSA_LSA, p->prefix, - ospf->router_id); + lsa = ospf_lsa_lookup(ospf, area, OSPF_AS_NSSA_LSA, + p->prefix, ospf->router_id); if (!lsa) { if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) zlog_debug( @@ -2260,14 +2259,14 @@ void ospf_external_lsa_refresh_type(struct ospf *ospf, u_char type, if (!is_prefix_default(&ei->p)) { struct ospf_lsa *lsa; - lsa = ospf_external_info_find_lsa(ospf, - &ei->p); + lsa = ospf_external_info_find_lsa( + ospf, &ei->p); if (lsa) - ospf_external_lsa_refresh(ospf, - lsa, ei, force); + ospf_external_lsa_refresh( + ospf, lsa, ei, force); else - ospf_external_lsa_originate(ospf - , ei); + ospf_external_lsa_originate( + ospf, ei); } } } @@ -2431,7 +2430,7 @@ ospf_summary_lsa_install(struct ospf *ospf, struct ospf_lsa *new, int rt_recalc) #if 0 /* This doesn't exist yet... */ ospf_summary_incremental_update(new); */ -#else /* #if 0 */ +#else /* #if 0 */ ospf_spf_calculate_schedule(ospf, SPF_FLAG_SUMMARY_LSA_INSTALL); #endif /* #if 0 */ } @@ -3005,27 +3004,27 @@ int ospf_lsa_maxage_walker(struct thread *thread) ospf->t_maxage_walker = NULL; for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) { - LSDB_LOOP(ROUTER_LSDB(area), rn, lsa) + LSDB_LOOP (ROUTER_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(NETWORK_LSDB(area), rn, lsa) + LSDB_LOOP (NETWORK_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(OPAQUE_AREA_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(OPAQUE_LINK_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(NSSA_LSDB(area), rn, lsa) + LSDB_LOOP (NSSA_LSDB(area), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); } /* for AS-external-LSAs. */ if (ospf->lsdb) { - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); - LSDB_LOOP(OPAQUE_AS_LSDB(ospf), rn, lsa) + LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) ospf_lsa_maxage_walker_remover(ospf, lsa); } @@ -3348,20 +3347,20 @@ void ospf_flush_self_originated_lsas_now(struct ospf *ospf) need_to_flush_ase = 1; } - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) ospf_lsa_flush_schedule(ospf, lsa); - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) ospf_lsa_flush_schedule(ospf, lsa); - LSDB_LOOP(OPAQUE_LINK_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa) ospf_lsa_flush_schedule(ospf, lsa); - LSDB_LOOP(OPAQUE_AREA_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa) ospf_lsa_flush_schedule(ospf, lsa); } if (need_to_flush_ase) { - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) ospf_lsa_flush_schedule(ospf, lsa); - LSDB_LOOP(OPAQUE_AS_LSDB(ospf), rn, lsa) + LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) ospf_lsa_flush_schedule(ospf, lsa); } diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 8dbf39ef5..364f51aa7 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -54,9 +54,8 @@ #include "ospfd/ospf_bfd.h" /* ospfd privileges */ -zebra_capabilities_t _caps_p[] = { - ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN -}; +zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, + ZCAP_SYS_ADMIN}; struct zebra_privs_t ospfd_privs = { #if defined(FRR_USER) && defined(FRR_GROUP) diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c index a7aac26b3..d647525ea 100644 --- a/ospfd/ospf_neighbor.c +++ b/ospfd/ospf_neighbor.c @@ -269,8 +269,9 @@ void ospf_nbr_add_self(struct ospf_interface *oi, struct in_addr router_id) rn = route_node_get(oi->nbrs, &p); if (rn->info) { /* There is already pseudo neighbor. */ - zlog_warn("router_id %s already present in neighbor table. node refcount %u", - inet_ntoa(router_id), rn->lock); + zlog_warn( + "router_id %s already present in neighbor table. node refcount %u", + inet_ntoa(router_id), rn->lock); route_unlock_node(rn); } else rn->info = oi->nbr_self; @@ -461,9 +462,8 @@ struct ospf_neighbor *ospf_nbr_get(struct ospf_interface *oi, if (oi->type == OSPF_IFTYPE_VIRTUALLINK || oi->type == OSPF_IFTYPE_POINTOPOINT) - key.u.prefix4 = - ospfh->router_id; /* index vlink and ptp nbrs by - router-id */ + key.u.prefix4 = ospfh->router_id; /* index vlink and ptp nbrs by + router-id */ else key.u.prefix4 = iph->ip_src; diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 045634d8a..5e11245bc 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -58,8 +58,9 @@ int ospf_if_add_allspfrouters(struct ospf *top, struct prefix *p, safe_strerror(errno)); else { if (IS_DEBUG_OSPF_EVENT) - zlog_debug("interface %s [%u] join AllSPFRouters Multicast group.", - inet_ntoa(p->u.prefix4), ifindex); + zlog_debug( + "interface %s [%u] join AllSPFRouters Multicast group.", + inet_ntoa(p->u.prefix4), ifindex); } return ret; @@ -81,8 +82,9 @@ int ospf_if_drop_allspfrouters(struct ospf *top, struct prefix *p, safe_strerror(errno)); else { if (IS_DEBUG_OSPF_EVENT) - zlog_debug("interface %s [%u] leave AllSPFRouters Multicast group.", - inet_ntoa(p->u.prefix4), ifindex); + zlog_debug( + "interface %s [%u] leave AllSPFRouters Multicast group.", + inet_ntoa(p->u.prefix4), ifindex); } return ret; @@ -188,8 +190,8 @@ int ospf_sock_init(struct ospf *ospf) safe_strerror(errno)); } - ospf_sock = vrf_socket(AF_INET, SOCK_RAW, IPPROTO_OSPFIGP, - ospf->vrf_id, ospf->name); + ospf_sock = vrf_socket(AF_INET, SOCK_RAW, IPPROTO_OSPFIGP, ospf->vrf_id, + ospf->name); if (ospf_sock < 0) { int save_errno = errno; diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 54d5dd5d1..b83c9dec2 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -279,37 +279,37 @@ static int nsm_negotiation_done(struct ospf_neighbor *nbr) /* Send proactive ARP requests */ ospf_proactively_arp(nbr); - LSDB_LOOP(ROUTER_LSDB(area), rn, lsa) + LSDB_LOOP (ROUTER_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); - LSDB_LOOP(NETWORK_LSDB(area), rn, lsa) + LSDB_LOOP (NETWORK_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); /* Process only if the neighbor is opaque capable. */ if (CHECK_FLAG(nbr->options, OSPF_OPTION_O)) { - LSDB_LOOP(OPAQUE_LINK_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); - LSDB_LOOP(OPAQUE_AREA_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); } if (CHECK_FLAG(nbr->options, OSPF_OPTION_NP)) { - LSDB_LOOP(NSSA_LSDB(area), rn, lsa) + LSDB_LOOP (NSSA_LSDB(area), rn, lsa) ospf_db_summary_add(nbr, lsa); } if (nbr->oi->type != OSPF_IFTYPE_VIRTUALLINK && area->external_routing == OSPF_AREA_DEFAULT) - LSDB_LOOP(EXTERNAL_LSDB(nbr->oi->ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(nbr->oi->ospf), rn, lsa) ospf_db_summary_add(nbr, lsa); if (CHECK_FLAG(nbr->options, OSPF_OPTION_O) && (nbr->oi->type != OSPF_IFTYPE_VIRTUALLINK && area->external_routing == OSPF_AREA_DEFAULT)) - LSDB_LOOP(OPAQUE_AS_LSDB(nbr->oi->ospf), rn, lsa) + LSDB_LOOP (OPAQUE_AS_LSDB(nbr->oi->ospf), rn, lsa) ospf_db_summary_add(nbr, lsa); return 0; @@ -703,7 +703,8 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state) } if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) - zlog_info("%s:(%s, %s -> %s): " + zlog_info( + "%s:(%s, %s -> %s): " "scheduling new router-LSA origination", __PRETTY_FUNCTION__, inet_ntoa(nbr->router_id), lookup_msg(ospf_nsm_state_msg, old_state, NULL), diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 009fd997e..6e9cf36a3 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -610,28 +610,28 @@ static void free_opaque_info_owner(void *val) { struct opaque_info_per_type *oipt = (struct opaque_info_per_type *)val; - switch (oipt->lsa_type) { - case OSPF_OPAQUE_LINK_LSA: { - struct ospf_interface *oi = - (struct ospf_interface *)(oipt->owner); - listnode_delete(oi->opaque_lsa_self, oipt); - break; - } - case OSPF_OPAQUE_AREA_LSA: { - struct ospf_area *area = (struct ospf_area *)(oipt->owner); - listnode_delete(area->opaque_lsa_self, oipt); - break; - } - case OSPF_OPAQUE_AS_LSA: { - struct ospf *top = (struct ospf *)(oipt->owner); - listnode_delete(top->opaque_lsa_self, oipt); - break; - } - default: - zlog_warn("free_opaque_info_owner: Unexpected LSA-type(%u)", - oipt->lsa_type); - break; /* This case may not exist. */ - } + switch (oipt->lsa_type) { + case OSPF_OPAQUE_LINK_LSA: { + struct ospf_interface *oi = + (struct ospf_interface *)(oipt->owner); + listnode_delete(oi->opaque_lsa_self, oipt); + break; + } + case OSPF_OPAQUE_AREA_LSA: { + struct ospf_area *area = (struct ospf_area *)(oipt->owner); + listnode_delete(area->opaque_lsa_self, oipt); + break; + } + case OSPF_OPAQUE_AS_LSA: { + struct ospf *top = (struct ospf *)(oipt->owner); + listnode_delete(top->opaque_lsa_self, oipt); + break; + } + default: + zlog_warn("free_opaque_info_owner: Unexpected LSA-type(%u)", + oipt->lsa_type); + break; /* This case may not exist. */ + } } static void free_opaque_info_per_type(void *val) @@ -1393,12 +1393,11 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) * list_isempty (oipt->id_list) * not being empty. */ - if ( - oipt->t_opaque_lsa_self - != NULL /* Waiting for a thread call. */ - || oipt->status == PROC_SUSPEND) /* Cannot - originate - now. */ + if (oipt->t_opaque_lsa_self + != NULL /* Waiting for a thread call. */ + || oipt->status == PROC_SUSPEND) /* Cannot + originate + now. */ continue; ospf_opaque_lsa_reoriginate_schedule( @@ -1419,12 +1418,11 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) * list_isempty (oipt->id_list) * not being empty. */ - if ( - oipt->t_opaque_lsa_self - != NULL /* Waiting for a thread call. */ - || oipt->status == PROC_SUSPEND) /* Cannot - originate - now. */ + if (oipt->t_opaque_lsa_self + != NULL /* Waiting for a thread call. */ + || oipt->status == PROC_SUSPEND) /* Cannot + originate + now. */ continue; ospf_opaque_lsa_reoriginate_schedule( @@ -1445,12 +1443,11 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) * list_isempty (oipt->id_list) * not being empty. */ - if ( - oipt->t_opaque_lsa_self - != NULL /* Waiting for a thread call. */ - || oipt->status == PROC_SUSPEND) /* Cannot - originate - now. */ + if (oipt->t_opaque_lsa_self + != NULL /* Waiting for a thread call. */ + || oipt->status == PROC_SUSPEND) /* Cannot + originate + now. */ continue; ospf_opaque_lsa_reoriginate_schedule((void *)top, diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h index 632b7b039..4fc5699a2 100644 --- a/ospfd/ospf_opaque.h +++ b/ospfd/ospf_opaque.h @@ -47,7 +47,7 @@ #define SET_OPAQUE_LSID(type, id) \ ((((unsigned)(type) << 24) & LSID_OPAQUE_TYPE_MASK) \ - | ((id) & LSID_OPAQUE_ID_MASK)) + | ((id)&LSID_OPAQUE_ID_MASK)) /* * Opaque LSA types will be assigned by IANA. @@ -85,24 +85,23 @@ * used for various LSA opaque usage e.g. Traffic Engineering. */ struct tlv_header { - u_int16_t type; /* Type of Value */ - u_int16_t length; /* Length of Value portion only, in bytes */ + u_int16_t type; /* Type of Value */ + u_int16_t length; /* Length of Value portion only, in bytes */ }; #define TLV_HDR_SIZE (sizeof(struct tlv_header)) -#define TLV_BODY_SIZE(tlvh) \ - (ROUNDUP(ntohs((tlvh)->length), sizeof(u_int32_t))) +#define TLV_BODY_SIZE(tlvh) (ROUNDUP(ntohs((tlvh)->length), sizeof(u_int32_t))) #define TLV_SIZE(tlvh) (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh)) -#define TLV_HDR_TOP(lsah) \ +#define TLV_HDR_TOP(lsah) \ (struct tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE) -#define TLV_HDR_NEXT(tlvh) \ +#define TLV_HDR_NEXT(tlvh) \ (struct tlv_header *)((char *)(tlvh) + TLV_SIZE(tlvh)) -#define TLV_HDR_SUBTLV(tlvh) \ +#define TLV_HDR_SUBTLV(tlvh) \ (struct tlv_header *)((char *)(tlvh) + TLV_HDR_SIZE) #define TLV_DATA(tlvh) (void *)((char *)(tlvh) + TLV_HDR_SIZE) @@ -112,11 +111,7 @@ struct tlv_header { #define TLV_HDR(tlvh) tlvh.header /* Following declaration concerns the Opaque LSA management */ -enum lsa_opcode { - REORIGINATE_THIS_LSA, - REFRESH_THIS_LSA, - FLUSH_THIS_LSA -}; +enum lsa_opcode { REORIGINATE_THIS_LSA, REFRESH_THIS_LSA, FLUSH_THIS_LSA }; /* Prototypes. */ diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 881226683..790679441 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -518,8 +518,8 @@ int ospf_ls_upd_timer(struct thread *thread) } if (listcount(update) > 0) - ospf_ls_upd_send(nbr, update, - OSPF_SEND_PACKET_DIRECT, 0); + ospf_ls_upd_send(nbr, update, OSPF_SEND_PACKET_DIRECT, + 0); list_delete_and_null(&update); } @@ -645,8 +645,6 @@ static int ospf_write(struct thread *thread) static u_int16_t ipid = 0; u_int16_t maxdatasize; #endif /* WANT_OSPF_WRITE_FRAGMENT */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_WRITE_IPHL_SHIFT 2 int pkt_count = 0; @@ -777,10 +775,10 @@ static int ospf_write(struct thread *thread) msg.msg_controllen = cm->cmsg_len; #endif - /* Sadly we can not rely on kernels to fragment packets - * because of either IP_HDRINCL and/or multicast - * destination being set. - */ +/* Sadly we can not rely on kernels to fragment packets + * because of either IP_HDRINCL and/or multicast + * destination being set. + */ #ifdef WANT_OSPF_WRITE_FRAGMENT if (op->length > maxdatasize) @@ -827,23 +825,23 @@ static int ospf_write(struct thread *thread) } switch (type) { - case OSPF_MSG_HELLO: - oi->hello_out++; - break; - case OSPF_MSG_DB_DESC: - oi->db_desc_out++; - break; - case OSPF_MSG_LS_REQ: - oi->ls_req_out++; - break; - case OSPF_MSG_LS_UPD: - oi->ls_upd_out++; - break; - case OSPF_MSG_LS_ACK: - oi->ls_ack_out++; - break; - default: - break; + case OSPF_MSG_HELLO: + oi->hello_out++; + break; + case OSPF_MSG_DB_DESC: + oi->db_desc_out++; + break; + case OSPF_MSG_LS_REQ: + oi->ls_req_out++; + break; + case OSPF_MSG_LS_UPD: + oi->ls_upd_out++; + break; + case OSPF_MSG_LS_ACK: + oi->ls_ack_out++; + break; + default: + break; } /* Now delete packet from queue. */ @@ -1365,8 +1363,9 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, /* We're Slave---obey */ if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) - zlog_info("Packet[DD]: Neighbor %s Negotiation done (Slave).", - inet_ntoa(nbr->router_id)); + zlog_info( + "Packet[DD]: Neighbor %s Negotiation done (Slave).", + inet_ntoa(nbr->router_id)); nbr->dd_seqnum = ntohl(dd->dd_seqnum); @@ -1635,11 +1634,11 @@ static void ospf_ls_req(struct ip *iph, struct ospf_header *ospfh, /* Send rest of Link State Update. */ if (listcount(ls_upd) > 0) { if (oi->type == OSPF_IFTYPE_NBMA) - ospf_ls_upd_send(nbr, ls_upd, - OSPF_SEND_PACKET_DIRECT, 0); + ospf_ls_upd_send(nbr, ls_upd, OSPF_SEND_PACKET_DIRECT, + 0); else - ospf_ls_upd_send(nbr, ls_upd, - OSPF_SEND_PACKET_INDIRECT, 0); + ospf_ls_upd_send(nbr, ls_upd, OSPF_SEND_PACKET_INDIRECT, + 0); list_delete_and_null(&ls_upd); } else @@ -2489,15 +2488,14 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh) return 0; } /* only MD5 crypto method can pass ospf_packet_examin() */ - if ( - NULL == (ck = listgetdata(listtail( - OSPF_IF_PARAM(oi, auth_crypt)))) - || ospfh->u.crypt.key_id != ck->key_id || - /* Condition above uses the last key ID on the list, - which is - different from what ospf_crypt_key_lookup() does. A - bug? */ - !ospf_check_md5_digest(oi, ospfh)) { + if (NULL == (ck = listgetdata( + listtail(OSPF_IF_PARAM(oi, auth_crypt)))) + || ospfh->u.crypt.key_id != ck->key_id || + /* Condition above uses the last key ID on the list, + which is + different from what ospf_crypt_key_lookup() does. A + bug? */ + !ospf_check_md5_digest(oi, ospfh)) { if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV)) zlog_warn("interface %s: MD5 auth failed", IF_NAME(oi)); @@ -3543,10 +3541,11 @@ static void ospf_hello_send_sub(struct ospf_interface *oi, in_addr_t addr) if (IS_DEBUG_OSPF_EVENT) { if (oi->ospf->vrf_id) - zlog_debug("%s: Hello Tx interface %s ospf vrf %s id %u", - __PRETTY_FUNCTION__, oi->ifp->name, - ospf_vrf_id_to_name(oi->ospf->vrf_id), - oi->ospf->vrf_id); + zlog_debug( + "%s: Hello Tx interface %s ospf vrf %s id %u", + __PRETTY_FUNCTION__, oi->ifp->name, + ospf_vrf_id_to_name(oi->ospf->vrf_id), + oi->ospf->vrf_id); } /* Add packet to the top of the interface output queue, so that they * can't get delayed by things like long queues of LS Update packets @@ -4049,11 +4048,10 @@ void ospf_ls_upd_send(struct ospf_neighbor *nbr, struct list *update, int flag, ospf_ls_upd_queue_send(oi, send_update_list, rn->p.u.prefix4, 1); - } } else thread_add_event(master, ospf_ls_upd_send_queue_event, oi, 0, - &oi->t_ls_upd_event); + &oi->t_ls_upd_event); } static void ospf_ls_ack_send_list(struct ospf_interface *oi, struct list *ack, @@ -4174,8 +4172,8 @@ void ospf_proactively_arp(struct ospf_neighbor *nbr) return; snprintf(ping_nbr, sizeof(ping_nbr), - "ping -c 1 -I %s %s > /dev/null 2>&1 &", - nbr->oi->ifp->name, inet_ntoa(nbr->address.u.prefix4)); + "ping -c 1 -I %s %s > /dev/null 2>&1 &", nbr->oi->ifp->name, + inet_ntoa(nbr->address.u.prefix4)); ret = system(ping_nbr); if (IS_DEBUG_OSPF_EVENT) diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 7c7a6fd79..e1d3e925c 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -176,15 +176,12 @@ static int ospf_router_info_register(u_int8_t scope) scope, OPAQUE_TYPE_ROUTER_INFORMATION_LSA, NULL, /* new interface */ NULL, /* del interface */ - ospf_router_info_ism_change, - ospf_router_info_nsm_change, + ospf_router_info_ism_change, ospf_router_info_nsm_change, ospf_router_info_config_write_router, NULL, /* Config. write interface */ NULL, /* Config. write debug */ - ospf_router_info_show_info, - ospf_router_info_lsa_originate, - ospf_router_info_lsa_refresh, - ospf_router_info_lsa_update, + ospf_router_info_show_info, ospf_router_info_lsa_originate, + ospf_router_info_lsa_refresh, ospf_router_info_lsa_update, NULL); /* del_lsa_hook */ if (rc != 0) { @@ -465,7 +462,6 @@ static void set_sr_algorithm(uint8_t algo) /* Set TLV type and length == only 1 Algorithm */ TLV_TYPE(OspfRI.sr_info.algo) = htons(RI_SR_TLV_SR_ALGORITHM); TLV_LEN(OspfRI.sr_info.algo) = htons(sizeof(uint8_t)); - } /* unset Aglogithm SubTLV */ @@ -478,7 +474,6 @@ static void unset_sr_algorithm(uint8_t algo) /* Unset TLV type and length */ TLV_TYPE(OspfRI.sr_info.algo) = htons(0); TLV_LEN(OspfRI.sr_info.algo) = htons(0); - } /* Segment Routing Global Block SubTLV - section 3.2 */ @@ -494,7 +489,6 @@ static void set_sr_sid_label_range(struct sr_srgb srgb) TLV_TYPE(OspfRI.sr_info.range.lower) = htons(SUBTLV_SID_LABEL); TLV_LEN(OspfRI.sr_info.range.lower) = htons(SID_RANGE_LABEL_LENGTH); OspfRI.sr_info.range.lower.value = htonl(SET_LABEL(srgb.lower_bound)); - } /* Unset this SRGB SubTLV */ @@ -505,7 +499,6 @@ static void unset_sr_sid_label_range(void) TLV_LEN(OspfRI.sr_info.range) = htons(0); TLV_TYPE(OspfRI.sr_info.range.lower) = htons(0); TLV_LEN(OspfRI.sr_info.range.lower) = htons(0); - } /* Set Maximum Stack Depth for this router */ @@ -514,7 +507,6 @@ static void set_sr_node_msd(uint8_t msd) TLV_TYPE(OspfRI.sr_info.msd) = htons(RI_SR_TLV_NODE_MSD); TLV_LEN(OspfRI.sr_info.msd) = htons(sizeof(uint32_t)); OspfRI.sr_info.msd.value = msd; - } /* Unset this router MSD */ @@ -522,7 +514,6 @@ static void unset_sr_node_msd(void) { TLV_TYPE(OspfRI.sr_info.msd) = htons(0); TLV_LEN(OspfRI.sr_info.msd) = htons(0); - } static void unset_param(struct tlv_header *tlv) @@ -621,7 +612,7 @@ void ospf_router_info_update_sr(bool enable, struct sr_srgb srgb, uint8_t msd) if (IS_DEBUG_OSPF_SR) zlog_debug("RI-> %s Routing Information for Segment Routing", - enable ? "Enable" : "Disable"); + enable ? "Enable" : "Disable"); /* Unset or Set SR parameters */ if (!enable) { @@ -709,7 +700,7 @@ static void ospf_router_info_lsa_body_set(struct stream *s) if (OspfRI.pce_info.enabled) { /* Compute PCE Info header first */ - set_pce_header (&OspfRI.pce_info); + set_pce_header(&OspfRI.pce_info); /* Build PCE TLV */ build_tlv_header(s, &OspfRI.pce_info.pce_header.header); @@ -994,10 +985,12 @@ static void ospf_router_info_lsa_schedule(enum lsa_opcode opcode) opcode == FLUSH_THIS_LSA ? "Flush" : ""); /* Check LSA flags state coherence */ - if (!CHECK_FLAG(OspfRI.flags, RIFLG_LSA_ENGAGED) && (opcode != REORIGINATE_THIS_LSA)) + if (!CHECK_FLAG(OspfRI.flags, RIFLG_LSA_ENGAGED) + && (opcode != REORIGINATE_THIS_LSA)) return; - if (CHECK_FLAG(OspfRI.flags, RIFLG_LSA_ENGAGED) && (opcode == REORIGINATE_THIS_LSA)) + if (CHECK_FLAG(OspfRI.flags, RIFLG_LSA_ENGAGED) + && (opcode == REORIGINATE_THIS_LSA)) opcode = REFRESH_THIS_LSA; top = ospf_lookup_by_vrf_id(VRF_DEFAULT); @@ -1057,8 +1050,8 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa) return 0; /* Process only Router Information LSA */ - if (GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)) != - OPAQUE_TYPE_ROUTER_INFORMATION_LSA) + if (GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)) + != OPAQUE_TYPE_ROUTER_INFORMATION_LSA) return 0; /* Check if it is not my LSA */ @@ -1082,8 +1075,7 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa) * Followings are vty session control functions. *------------------------------------------------------------------------*/ -static u_int16_t show_vty_router_cap(struct vty *vty, - struct tlv_header *tlvh) +static u_int16_t show_vty_router_cap(struct vty *vty, struct tlv_header *tlvh) { struct ri_tlv_router_cap *top = (struct ri_tlv_router_cap *)tlvh; @@ -1200,8 +1192,7 @@ static u_int16_t show_vty_pce_subtlv_cap_flag(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_unknown_tlv(struct vty *vty, - struct tlv_header *tlvh) +static u_int16_t show_vty_unknown_tlv(struct vty *vty, struct tlv_header *tlvh) { if (vty != NULL) vty_out(vty, " Unknown TLV: [type(0x%x), length(0x%x)]\n", @@ -1496,8 +1487,8 @@ DEFUN (router_info, /* Refresh RI LSA if already engaged */ if (CHECK_FLAG(OspfRI.flags, RIFLG_LSA_ENGAGED)) { - zlog_debug ("RI-> Refresh LSA following configuration"); - ospf_router_info_lsa_schedule (REFRESH_THIS_LSA); + zlog_debug("RI-> Refresh LSA following configuration"); + ospf_router_info_lsa_schedule(REFRESH_THIS_LSA); } else { zlog_debug("RI-> Initial origination following configuration"); ospf_router_info_lsa_schedule(REORIGINATE_THIS_LSA); @@ -1891,8 +1882,7 @@ DEFUN (show_ip_opsf_router_info_pce, &pce->pce_cap_flag.header); } else { - vty_out(vty, - " PCE info is disabled on this router\n"); + vty_out(vty, " PCE info is disabled on this router\n"); } return CMD_SUCCESS; diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index cc7c6d266..60a2e2d3e 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -54,7 +54,7 @@ struct ospf_route *ospf_route_new() void ospf_route_free(struct ospf_route * or) { if (or->paths) - list_delete_and_null(&or->paths); + list_delete_and_null(& or->paths); XFREE(MTYPE_OSPF_ROUTE, or); } @@ -91,12 +91,11 @@ void ospf_route_delete(struct ospf *ospf, struct route_table *rt) for (rn = route_top(rt); rn; rn = route_next(rn)) if ((or = rn->info) != NULL) { if (or->type == OSPF_DESTINATION_NETWORK) - ospf_zebra_delete(ospf, - (struct prefix_ipv4 *)&rn->p, - or); + ospf_zebra_delete( + ospf, (struct prefix_ipv4 *)&rn->p, or); else if (or->type == OSPF_DESTINATION_DISCARD) - ospf_zebra_delete_discard(ospf, - (struct prefix_ipv4 *)&rn->p); + ospf_zebra_delete_discard( + ospf, (struct prefix_ipv4 *)&rn->p); } } @@ -235,7 +234,8 @@ static void ospf_route_delete_uniq(struct ospf *ospf, struct route_table *rt, cmprt, (struct prefix_ipv4 *)&rn ->p)) - ospf_zebra_delete(ospf, + ospf_zebra_delete( + ospf, (struct prefix_ipv4 *)&rn->p, or); @@ -244,7 +244,8 @@ static void ospf_route_delete_uniq(struct ospf *ospf, struct route_table *rt, cmprt, (struct prefix_ipv4 *)&rn ->p)) - ospf_zebra_delete_discard(ospf, + ospf_zebra_delete_discard( + ospf, (struct prefix_ipv4 *)&rn->p); } @@ -277,14 +278,16 @@ void ospf_route_install(struct ospf *ospf, struct route_table *rt) if (!ospf_route_match_same( ospf->old_table, (struct prefix_ipv4 *)&rn->p, or)) - ospf_zebra_add(ospf, + ospf_zebra_add( + ospf, (struct prefix_ipv4 *)&rn->p, or); } else if (or->type == OSPF_DESTINATION_DISCARD) if (!ospf_route_match_same( ospf->old_table, (struct prefix_ipv4 *)&rn->p, or)) - ospf_zebra_add_discard(ospf, + ospf_zebra_add_discard( + ospf, (struct prefix_ipv4 *)&rn->p); } } @@ -910,8 +913,7 @@ void ospf_prune_unreachable_routers(struct route_table *rtrs) } int ospf_add_discard_route(struct ospf *ospf, struct route_table *rt, - struct ospf_area *area, - struct prefix_ipv4 *p) + struct ospf_area *area, struct prefix_ipv4 *p) { struct route_node *rn; struct ospf_route * or, *new_or; diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index f2769c6f3..bec0ec039 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -69,15 +69,18 @@ static void ospf_route_map_update(const char *name) struct route_map *old = ROUTEMAP(red); /* Update route-map. */ - ROUTEMAP(red) = route_map_lookup_by_name( - ROUTEMAP_NAME(red)); - - /* No update for this distribute type. */ - if (old == NULL && ROUTEMAP(red) == NULL) + ROUTEMAP(red) = + route_map_lookup_by_name( + ROUTEMAP_NAME(red)); + + /* No update for this distribute type. + */ + if (old == NULL + && ROUTEMAP(red) == NULL) continue; - ospf_distribute_list_update(ospf, type, - red->instance); + ospf_distribute_list_update( + ospf, type, red->instance); } } } @@ -103,8 +106,8 @@ static void ospf_route_map_event(route_map_event_t event, const char *name) for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) { if (ROUTEMAP_NAME(red) && ROUTEMAP(red) && !strcmp(ROUTEMAP_NAME(red), name)) { - ospf_distribute_list_update(ospf, type, - red->instance); + ospf_distribute_list_update( + ospf, type, red->instance); } } } diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index b28aebb81..28826254e 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -739,8 +739,6 @@ static u_char *ospfAreaEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(0); break; case OSPFAREASUMMARY: /* 9 */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_noAreaSummary 1 #define OSPF_sendAreaSummary 2 if (area->no_summary) @@ -872,7 +870,7 @@ static u_char *ospfStubAreaEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(SNMP_VALID); break; case OSPFSTUBMETRICTYPE: /* 5 */ -/* OSPF Metric type. */ + /* OSPF Metric type. */ #define OSPF_ospfMetric 1 #define OSPF_comparableCost 2 #define OSPF_nonComparable 3 @@ -1269,8 +1267,6 @@ static u_char *ospfAreaRangeEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(SNMP_VALID); break; case OSPFAREARANGEEFFECT: /* 5 */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_advertiseMatching 1 #define OSPF_doNotAdvertiseMatching 2 return SNMP_INTEGER(OSPF_advertiseMatching); @@ -1744,8 +1740,6 @@ static u_char *ospfIfEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(SNMP_VALID); break; case OSPFIFMULTICASTFORWARDING: /* 18 */ - /* $FRR indent$ */ - /* clang-format off */ #define ospf_snmp_multiforward_blocked 1 #define ospf_snmp_multiforward_multicast 2 #define ospf_snmp_multiforward_unicast 3 diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 9c747cd56..f81210ffc 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -781,8 +781,7 @@ static unsigned int ospf_nexthop_calculation(struct ospf_area *area, * path is found to a vertex already on the candidate list, store the new cost. */ static void ospf_spf_next(struct vertex *v, struct ospf *ospf, - struct ospf_area *area, - struct pqueue *candidate) + struct ospf_area *area, struct pqueue *candidate) { struct ospf_lsa *w_lsa = NULL; u_char *p; @@ -1341,10 +1340,10 @@ static int ospf_spf_calculate_timer(struct thread *thread) ospf_ase_calculate_timer_add(ospf); if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: ospf install new route, vrf %s id %u new_table count %lu", - __PRETTY_FUNCTION__, - ospf_vrf_id_to_name(ospf->vrf_id), - ospf->vrf_id, new_table->count); + zlog_debug( + "%s: ospf install new route, vrf %s id %u new_table count %lu", + __PRETTY_FUNCTION__, ospf_vrf_id_to_name(ospf->vrf_id), + ospf->vrf_id, new_table->count); /* Update routing table. */ monotime(&start_time); ospf_route_install(ospf, new_table); diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index fef77f574..c7bc129a4 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -105,7 +105,6 @@ static void del_sr_link(void *val) del_sid_nhlfe(srl->nhlfe[0]); del_sid_nhlfe(srl->nhlfe[1]); XFREE(MTYPE_OSPF_SR_PARAMS, val); - } /* Functions to remove an SR Prefix */ @@ -115,7 +114,6 @@ static void del_sr_pref(void *val) del_sid_nhlfe(srp->nhlfe); XFREE(MTYPE_OSPF_SR_PARAMS, val); - } /* Allocate new Segment Routine node */ @@ -256,8 +254,7 @@ static int ospf_sr_start(struct ospf *ospf) /* Start by looking to Router Info & Extended LSA in lsdb */ if ((ospf != NULL) && (ospf->backbone != NULL)) { - LSDB_LOOP(OPAQUE_AREA_LSDB(ospf->backbone), rn, lsa) - { + LSDB_LOOP (OPAQUE_AREA_LSDB(ospf->backbone), rn, lsa) { if (IS_LSA_MAXAGE(lsa) || IS_LSA_SELF(lsa)) continue; int lsa_id = @@ -428,7 +425,7 @@ static struct ospf_neighbor *get_neighbor_by_addr(struct ospf *top, static struct ospf_path *get_nexthop_by_addr(struct ospf *top, struct prefix_ipv4 p) { - struct ospf_route *or; + struct ospf_route * or ; struct ospf_path *path; struct listnode *node; struct route_node *rn; @@ -835,9 +832,8 @@ static struct sr_prefix *get_ext_prefix_sid(struct tlv_header *tlvh) case EXT_SUBTLV_PREFIX_SID: psid = (struct ext_subtlv_prefix_sid *)sub_tlvh; if (psid->algorithm != SR_ALGORITHM_SPF) { - zlog_err( - "SR (%s): Unsupported Algorithm", - __func__); + zlog_err("SR (%s): Unsupported Algorithm", + __func__); XFREE(MTYPE_OSPF_SR_PARAMS, srp); return NULL; } @@ -1108,8 +1104,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) zlog_debug( "SR (%s): Process Router " "Information LSA 4.0.0.%u from %s", - __func__, - GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), inet_ntoa(lsah->adv_router)); /* Sanity check */ @@ -1127,9 +1122,8 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_err( - "SR (%s): Abort! can't create SR node in hash table", - __func__); + zlog_err("SR (%s): Abort! can't create SR node in hash table", + __func__); return; } @@ -1137,8 +1131,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) zlog_err( "SR (%s): Abort! Wrong " "LSA ID 4.0.0.%u for SR node %s/%u", - __func__, - GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), inet_ntoa(lsah->adv_router), srn->instance); return; } @@ -1182,9 +1175,8 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) /* Check that we collect mandatory parameters */ if (srn->algo[0] == SR_ALGORITHM_UNSET || srgb.range_size == 0 || srgb.lower_bound == 0) { - zlog_warn( - "SR (%s): Missing mandatory parameters. Abort!", - __func__); + zlog_warn("SR (%s): Missing mandatory parameters. Abort!", + __func__); hash_release(OspfSR.neighbors, &(srn->adv_router)); XFREE(MTYPE_OSPF_SR_PARAMS, srn); return; @@ -1211,7 +1203,6 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) void *))update_out_nhlfe, (void *)srn); } - } /* @@ -1224,10 +1215,9 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa) struct lsa_header *lsah = (struct lsa_header *)lsa->data; if (IS_DEBUG_OSPF_SR) - zlog_debug( - "SR (%s): Remove SR node %s from lsa_id 4.0.0.%u", - __func__, inet_ntoa(lsah->adv_router), - GET_OPAQUE_ID(ntohl(lsah->id.s_addr))); + zlog_debug("SR (%s): Remove SR node %s from lsa_id 4.0.0.%u", + __func__, inet_ntoa(lsah->adv_router), + GET_OPAQUE_ID(ntohl(lsah->id.s_addr))); /* Sanity check */ if (OspfSR.neighbors == NULL) { @@ -1240,23 +1230,20 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_err( - "SR (%s): Abort! no entry in SRDB for SR Node %s", - __func__, inet_ntoa(lsah->adv_router)); + zlog_err("SR (%s): Abort! no entry in SRDB for SR Node %s", + __func__, inet_ntoa(lsah->adv_router)); return; } if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) { - zlog_err( - "SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s", - __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), - inet_ntoa(lsah->adv_router)); + zlog_err("SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + inet_ntoa(lsah->adv_router)); return; } /* Remove SR node */ sr_node_del(srn); - } /* Update Segment Routing from Extended Link LSA */ @@ -1288,9 +1275,8 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_err( - "SR (%s): Abort! can't create SR node in hash table", - __func__); + zlog_err("SR (%s): Abort! can't create SR node in hash table", + __func__); return; } @@ -1322,10 +1308,9 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) uint32_t instance = ntohl(lsah->id.s_addr); if (IS_DEBUG_OSPF_SR) - zlog_debug( - "SR (%s): Remove Extended Link LSA 8.0.0.%u from %s", - __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), - inet_ntoa(lsah->adv_router)); + zlog_debug("SR (%s): Remove Extended Link LSA 8.0.0.%u from %s", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + inet_ntoa(lsah->adv_router)); /* Sanity check */ if (OspfSR.neighbors == NULL) { @@ -1342,9 +1327,8 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) * processing Router Information LSA deletion */ if (srn == NULL) { - zlog_warn( - "SR (%s): Stop! no entry in SRDB for SR Node %s", - __func__, inet_ntoa(lsah->adv_router)); + zlog_warn("SR (%s): Stop! no entry in SRDB for SR Node %s", + __func__, inet_ntoa(lsah->adv_router)); return; } @@ -1362,11 +1346,10 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) } else { zlog_warn( "SR (%s): Didn't found corresponding SR Link 8.0.0.%u " - "for SR Node %s", __func__, - GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + "for SR Node %s", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), inet_ntoa(lsah->adv_router)); } - } /* Update Segment Routing from Extended Prefix LSA */ @@ -1382,8 +1365,8 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa) if (IS_DEBUG_OSPF_SR) zlog_debug( "SR (%s): Process Extended Prefix LSA " - "7.0.0.%u from %s", __func__, - GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + "7.0.0.%u from %s", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), inet_ntoa(lsah->adv_router)); /* Sanity check */ @@ -1399,9 +1382,8 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - zlog_err( - "SR (%s): Abort! can't create SR node in hash table", - __func__); + zlog_err("SR (%s): Abort! can't create SR node in hash table", + __func__); return; } @@ -1453,9 +1435,8 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa) * processing Router Information LSA deletion */ if (srn == NULL) { - zlog_warn( - "SR (%s): Stop! no entry in SRDB for SR Node %s", - __func__, inet_ntoa(lsah->adv_router)); + zlog_warn("SR (%s): Stop! no entry in SRDB for SR Node %s", + __func__, inet_ntoa(lsah->adv_router)); return; } @@ -1472,11 +1453,10 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa) } else { zlog_warn( "SR (%s): Didn't found corresponding SR Prefix " - "7.0.0.%u for SR Node %s", __func__, - GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + "7.0.0.%u for SR Node %s", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), inet_ntoa(lsah->adv_router)); } - } /* Get Label for Extended Link SID */ @@ -1516,26 +1496,26 @@ void ospf_sr_update_prefix(struct interface *ifp, struct prefix *p) for (ALL_LIST_ELEMENTS_RO(OspfSR.self->ext_prefix, node, srp)) { if ((srp->nhlfe.ifindex == ifp->ifindex) || ((IPV4_ADDR_SAME(&srp->nhlfe.prefv4.prefix, - &p->u.prefix4)) - && (srp->nhlfe.prefv4.prefixlen == p->prefixlen))) { + &p->u.prefix4)) + && (srp->nhlfe.prefv4.prefixlen == p->prefixlen))) { /* Update Interface & Prefix info */ srp->nhlfe.ifindex = ifp->ifindex; IPV4_ADDR_COPY(&srp->nhlfe.prefv4.prefix, - &p->u.prefix4); + &p->u.prefix4); srp->nhlfe.prefv4.prefixlen = p->prefixlen; srp->nhlfe.prefv4.family = p->family; IPV4_ADDR_COPY(&srp->nhlfe.nexthop, &p->u.prefix4); /* OK. Let's Schedule Extended Prefix LSA */ - srp->instance = ospf_ext_schedule_prefix_index(ifp, - srp->sid, &srp->nhlfe.prefv4, srp->flags); + srp->instance = ospf_ext_schedule_prefix_index( + ifp, srp->sid, &srp->nhlfe.prefv4, srp->flags); /* Install NHLFE if NO-PHP is requested */ if (CHECK_FLAG(srp->flags, - EXT_SUBTLV_PREFIX_SID_NPFLG)) { - srp->nhlfe.label_in = index2label(srp->sid, - OspfSR.self->srgb); + EXT_SUBTLV_PREFIX_SID_NPFLG)) { + srp->nhlfe.label_in = index2label( + srp->sid, OspfSR.self->srgb); srp->nhlfe.label_out = MPLS_LABEL_IMPLICIT_NULL; add_sid_nhlfe(srp->nhlfe); } @@ -1623,7 +1603,7 @@ static int ospf_sr_update_schedule(struct thread *t) zlog_debug("SR (%s): SPF Processing Time(usecs): %lld\n", __func__, (stop_time.tv_sec - start_time.tv_sec) * 1000000LL - + (stop_time.tv_usec - start_time.tv_usec)); + + (stop_time.tv_usec - start_time.tv_usec)); OspfSR.update = false; return 1; @@ -1675,9 +1655,9 @@ void ospf_sr_config_write_router(struct vty *vty) if ((OspfSR.srgb.lower_bound != MPLS_DEFAULT_MIN_SRGB_LABEL) || (OspfSR.srgb.range_size != MPLS_DEFAULT_MAX_SRGB_SIZE)) { vty_out(vty, " segment-routing global-block %u %u\n", - OspfSR.srgb.lower_bound, - OspfSR.srgb.lower_bound + - OspfSR.srgb.range_size - 1); + OspfSR.srgb.lower_bound, + OspfSR.srgb.lower_bound + OspfSR.srgb.range_size + - 1); } if (OspfSR.msd != 0) vty_out(vty, " segment-routing node-msd %u\n", @@ -1692,8 +1672,9 @@ void ospf_sr_config_write_router(struct vty *vty) inet_ntoa(srp->nhlfe.prefv4.prefix), srp->nhlfe.prefv4.prefixlen, srp->sid, CHECK_FLAG(srp->flags, - EXT_SUBTLV_PREFIX_SID_NPFLG) ? - " no-php-flag" : ""); + EXT_SUBTLV_PREFIX_SID_NPFLG) + ? " no-php-flag" + : ""); } } } @@ -1712,8 +1693,9 @@ DEFUN(ospf_sr_enable, return CMD_SUCCESS; if (ospf->vrf_id != VRF_DEFAULT) { - vty_out(vty, "Segment Routing is only supported in default " - "VRF\n"); + vty_out(vty, + "Segment Routing is only supported in default " + "VRF\n"); return CMD_WARNING_CONFIG_FAILED; } @@ -1960,8 +1942,7 @@ DEFUN (sr_prefix_sid, /* Get network prefix */ argv_find(argv, argc, "A.B.C.D/M", &idx); if (!str2prefix(argv[idx]->arg, &p)) { - vty_out(vty, "Invalid prefix format %s\n", - argv[idx]->arg); + vty_out(vty, "Invalid prefix format %s\n", argv[idx]->arg); return CMD_WARNING_CONFIG_FAILED; } @@ -1997,10 +1978,9 @@ DEFUN (sr_prefix_sid, } if (IS_DEBUG_OSPF_SR) - zlog_debug( - "SR (%s): Add new index %u to Prefix %s/%u", - __func__, index, inet_ntoa(new->nhlfe.prefv4.prefix), - new->nhlfe.prefv4.prefixlen); + zlog_debug("SR (%s): Add new index %u to Prefix %s/%u", + __func__, index, inet_ntoa(new->nhlfe.prefv4.prefix), + new->nhlfe.prefv4.prefixlen); /* Get Interface and check if it is a Loopback */ ifp = if_lookup_prefix(&p, VRF_DEFAULT); @@ -2014,7 +1994,8 @@ DEFUN (sr_prefix_sid, listnode_add(OspfSR.self->ext_prefix, new); zlog_warn( "Interface for prefix %s/%u not found. Deferred LSA " - "flooding", inet_ntoa(p.u.prefix4), p.prefixlen); + "flooding", + inet_ntoa(p.u.prefix4), p.prefixlen); return CMD_SUCCESS; } @@ -2028,7 +2009,7 @@ DEFUN (sr_prefix_sid, /* Search if this prefix already exist */ for (ALL_LIST_ELEMENTS_RO(OspfSR.self->ext_prefix, node, srp)) { if ((IPV4_ADDR_SAME(&srp->nhlfe.prefv4.prefix, &p.u.prefix4) - && srp->nhlfe.prefv4.prefixlen == p.prefixlen)) + && srp->nhlfe.prefv4.prefixlen == p.prefixlen)) break; else srp = NULL; @@ -2045,8 +2026,8 @@ DEFUN (sr_prefix_sid, } /* Finally, update Extended Prefix LSA */ - new->instance = ospf_ext_schedule_prefix_index(ifp, new->sid, - &new->nhlfe.prefv4, new->flags); + new->instance = ospf_ext_schedule_prefix_index( + ifp, new->sid, &new->nhlfe.prefv4, new->flags); if (new->instance == 0) { vty_out(vty, "Unable to set index %u for prefix %s/%u\n", index, inet_ntoa(p.u.prefix4), p.prefixlen); @@ -2079,8 +2060,7 @@ DEFUN (no_sr_prefix_sid, argv_find(argv, argc, "A.B.C.D/M", &idx); rc = str2prefix(argv[idx]->arg, &p); if (!rc) { - vty_out(vty, "Invalid prefix format %s\n", - argv[idx]->arg); + vty_out(vty, "Invalid prefix format %s\n", argv[idx]->arg); return CMD_WARNING_CONFIG_FAILED; } @@ -2113,10 +2093,9 @@ DEFUN (no_sr_prefix_sid, } if (IS_DEBUG_OSPF_SR) - zlog_debug( - "SR (%s): Remove Prefix %s/%u with index %u", - __func__, inet_ntoa(srp->nhlfe.prefv4.prefix), - srp->nhlfe.prefv4.prefixlen, srp->sid); + zlog_debug("SR (%s): Remove Prefix %s/%u with index %u", + __func__, inet_ntoa(srp->nhlfe.prefv4.prefix), + srp->nhlfe.prefv4.prefixlen, srp->sid); /* Delete NHLFE is NO-PHP is set */ if (CHECK_FLAG(srp->flags, EXT_SUBTLV_PREFIX_SID_NPFLG)) @@ -2130,9 +2109,8 @@ DEFUN (no_sr_prefix_sid, } - static void show_sr_node(struct vty *vty, struct json_object *json, - struct sr_node *srn) + struct sr_node *srn) { struct listnode *node; @@ -2152,11 +2130,11 @@ static void show_sr_node(struct vty *vty, struct json_object *json, if (json) { json_node = json_object_new_object(); json_object_string_add(json_node, "routerID", - inet_ntoa(srn->adv_router)); + inet_ntoa(srn->adv_router)); json_object_int_add(json_node, "srgbSize", - srn->srgb.range_size); + srn->srgb.range_size); json_object_int_add(json_node, "srgbLabel", - srn->srgb.lower_bound); + srn->srgb.lower_bound); json_algo = json_object_new_array(); json_object_object_add(json_node, "algorithms", json_algo); for (int i = 0; i < ALGORITHM_COUNT; i++) { @@ -2167,24 +2145,25 @@ static void show_sr_node(struct vty *vty, struct json_object *json, snprintf(tmp, 2, "%u", i); json_object_string_add(json_obj, tmp, - srn->algo[i] == SR_ALGORITHM_SPF ? - "SPF" : "S-SPF"); + srn->algo[i] == SR_ALGORITHM_SPF + ? "SPF" + : "S-SPF"); json_object_array_add(json_algo, json_obj); } if (srn->msd != 0) json_object_int_add(json_node, "nodeMsd", srn->msd); } else { vty_out(vty, "SR-Node: %s", inet_ntoa(srn->adv_router)); - vty_out(vty, "\tSRGB (Size/Label): %u/%u", - srn->srgb.range_size, srn->srgb.lower_bound); + vty_out(vty, "\tSRGB (Size/Label): %u/%u", srn->srgb.range_size, + srn->srgb.lower_bound); vty_out(vty, "\tAlgorithm(s): %s", srn->algo[0] == SR_ALGORITHM_SPF ? "SPF" : "S-SPF"); for (int i = 1; i < ALGORITHM_COUNT; i++) { if (srn->algo[i] == SR_ALGORITHM_UNSET) continue; vty_out(vty, "/%s", - srn->algo[i] == SR_ALGORITHM_SPF ? - "SPF" : "S-SPF"); + srn->algo[i] == SR_ALGORITHM_SPF ? "SPF" + : "S-SPF"); } if (srn->msd != 0) vty_out(vty, "\tMSD: %u", srn->msd); @@ -2199,9 +2178,8 @@ static void show_sr_node(struct vty *vty, struct json_object *json, "--------------------- --------- ---------------\n"); } for (ALL_LIST_ELEMENTS_RO(srn->ext_prefix, node, srp)) { - snprintf(pref, 19, "%s/%u", - inet_ntoa(srp->nhlfe.prefv4.prefix), - srp->nhlfe.prefv4.prefixlen); + snprintf(pref, 19, "%s/%u", inet_ntoa(srp->nhlfe.prefv4.prefix), + srp->nhlfe.prefv4.prefixlen); snprintf(sid, 22, "SR Pfx (idx %u)", srp->sid); if (srp->nhlfe.label_out == MPLS_LABEL_IMPLICIT_NULL) sprintf(label, "pop"); @@ -2212,32 +2190,32 @@ static void show_sr_node(struct vty *vty, struct json_object *json, if (!json_prefix) { json_prefix = json_object_new_array(); json_object_object_add(json_node, - "extendedPrefix", json_prefix); + "extendedPrefix", + json_prefix); } json_obj = json_object_new_object(); json_object_string_add(json_obj, "prefix", pref); json_object_int_add(json_obj, "sid", srp->sid); json_object_int_add(json_obj, "inputLabel", - srp->nhlfe.label_in); - json_object_string_add(json_obj, "outputLabel", - label); + srp->nhlfe.label_in); + json_object_string_add(json_obj, "outputLabel", label); json_object_string_add(json_obj, "interface", - itf ? itf->name : "-"); + itf ? itf->name : "-"); json_object_string_add(json_obj, "nexthop", - inet_ntoa(srp->nhlfe.nexthop)); + inet_ntoa(srp->nhlfe.nexthop)); json_object_array_add(json_prefix, json_obj); } else { - vty_out(vty, "%18s %8u %9s %21s %9s %15s\n", - pref, srp->nhlfe.label_in, label, - sid, itf ? itf->name : "-", + vty_out(vty, "%18s %8u %9s %21s %9s %15s\n", pref, + srp->nhlfe.label_in, label, sid, + itf ? itf->name : "-", inet_ntoa(srp->nhlfe.nexthop)); } } for (ALL_LIST_ELEMENTS_RO(srn->ext_link, node, srl)) { snprintf(pref, 19, "%s/%u", - inet_ntoa(srl->nhlfe[0].prefv4.prefix), - srl->nhlfe[0].prefv4.prefixlen); + inet_ntoa(srl->nhlfe[0].prefv4.prefix), + srl->nhlfe[0].prefv4.prefixlen); snprintf(sid, 22, "SR Adj. (lbl %u)", srl->sid[0]); if (srl->nhlfe[0].label_out == MPLS_LABEL_IMPLICIT_NULL) sprintf(label, "pop"); @@ -2247,20 +2225,20 @@ static void show_sr_node(struct vty *vty, struct json_object *json, if (json) { if (!json_link) { json_link = json_object_new_array(); - json_object_object_add(json_node, - "extendedLink", json_link); + json_object_object_add( + json_node, "extendedLink", json_link); } /* Primary Link */ json_obj = json_object_new_object(); json_object_string_add(json_obj, "prefix", pref); json_object_int_add(json_obj, "sid", srl->sid[0]); json_object_int_add(json_obj, "inputLabel", - srl->nhlfe[0].label_in); - json_object_string_add(json_obj, "outputLabel", - label); + srl->nhlfe[0].label_in); + json_object_string_add(json_obj, "outputLabel", label); json_object_string_add(json_obj, "interface", - itf ? itf->name : "-"); - json_object_string_add(json_obj, "nexthop", + itf ? itf->name : "-"); + json_object_string_add( + json_obj, "nexthop", inet_ntoa(srl->nhlfe[0].nexthop)); json_object_array_add(json_link, json_obj); /* Backup Link */ @@ -2273,27 +2251,27 @@ static void show_sr_node(struct vty *vty, struct json_object *json, json_object_string_add(json_obj, "prefix", pref); json_object_int_add(json_obj, "sid", srl->sid[1]); json_object_int_add(json_obj, "inputLabel", - srl->nhlfe[1].label_in); - json_object_string_add(json_obj, "outputLabel", - label); + srl->nhlfe[1].label_in); + json_object_string_add(json_obj, "outputLabel", label); json_object_string_add(json_obj, "interface", - itf ? itf->name : "-"); - json_object_string_add(json_obj, "nexthop", + itf ? itf->name : "-"); + json_object_string_add( + json_obj, "nexthop", inet_ntoa(srl->nhlfe[1].nexthop)); json_object_array_add(json_link, json_obj); } else { - vty_out(vty, "%18s %8u %9s %21s %9s %15s\n", - pref, srl->nhlfe[0].label_in, - label, sid, itf ? itf->name : "-", + vty_out(vty, "%18s %8u %9s %21s %9s %15s\n", pref, + srl->nhlfe[0].label_in, label, sid, + itf ? itf->name : "-", inet_ntoa(srl->nhlfe[0].nexthop)); snprintf(sid, 22, "SR Adj. (lbl %u)", srl->sid[1]); if (srl->nhlfe[1].label_out == MPLS_LABEL_IMPLICIT_NULL) sprintf(label, "pop"); else sprintf(label, "%u", srl->nhlfe[1].label_out); - vty_out(vty, "%18s %8u %9s %21s %9s %15s\n", - pref, srl->nhlfe[1].label_in, - label, sid, itf ? itf->name : "-", + vty_out(vty, "%18s %8u %9s %21s %9s %15s\n", pref, + srl->nhlfe[1].label_in, label, sid, + itf ? itf->name : "-", inet_ntoa(srl->nhlfe[1].nexthop)); } } @@ -2347,7 +2325,7 @@ DEFUN (show_ip_opsf_srdb, json = json_object_new_object(); json_node_array = json_object_new_array(); json_object_string_add(json, "srdbID", - inet_ntoa(OspfSR.self->adv_router)); + inet_ntoa(OspfSR.self->adv_router)); json_object_object_add(json, "srNodes", json_node_array); } else { vty_out(vty, @@ -2360,8 +2338,8 @@ DEFUN (show_ip_opsf_srdb, show_sr_node(vty, json_node_array, srn); if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } return CMD_SUCCESS; @@ -2369,8 +2347,7 @@ DEFUN (show_ip_opsf_srdb, if (argv_find(argv, argc, "A.B.C.D", &idx)) { if (!inet_aton(argv[idx]->arg, &rid)) { - vty_out(vty, - "Specified Router ID %s is invalid\n", + vty_out(vty, "Specified Router ID %s is invalid\n", argv[idx]->arg); return CMD_WARNING_CONFIG_FAILED; } @@ -2380,8 +2357,8 @@ DEFUN (show_ip_opsf_srdb, show_sr_node(vty, json_node_array, srn); if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } return CMD_SUCCESS; @@ -2389,19 +2366,16 @@ DEFUN (show_ip_opsf_srdb, /* No parameters have been provided, Iterate through all the SRDB */ if (uj) { - hash_iterate( - OspfSR.neighbors, - (void (*)(struct hash_backet *, void *))show_json_srdb, - (void *)json_node_array); - vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + hash_iterate(OspfSR.neighbors, (void (*)(struct hash_backet *, + void *))show_json_srdb, + (void *)json_node_array); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { - hash_iterate( - OspfSR.neighbors, - (void (*)(struct hash_backet *, void *))show_vty_srdb, - (void *)vty); + hash_iterate(OspfSR.neighbors, (void (*)(struct hash_backet *, + void *))show_vty_srdb, + (void *)vty); } return CMD_SUCCESS; } @@ -2419,5 +2393,4 @@ void ospf_sr_register_vty(void) install_element(OSPF_NODE, &no_sr_node_msd_cmd); install_element(OSPF_NODE, &sr_prefix_sid_cmd); install_element(OSPF_NODE, &no_sr_prefix_sid_cmd); - } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index ab395207b..276a5765f 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -236,9 +236,9 @@ static struct mpls_te_link *lookup_linkparams_by_instance(struct ospf_lsa *lsa) return NULL; } -static void ospf_mpls_te_foreach_area(void (*func)(struct mpls_te_link *lp, - enum lsa_opcode sched_opcode), - enum lsa_opcode sched_opcode) +static void ospf_mpls_te_foreach_area( + void (*func)(struct mpls_te_link *lp, enum lsa_opcode sched_opcode), + enum lsa_opcode sched_opcode) { struct listnode *node, *nnode; struct listnode *node2; @@ -772,7 +772,7 @@ static void initialize_linkparams(struct mpls_te_link *lp) ifp->name); /* Search OSPF Interface parameters for this interface */ - for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) { + for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) { if ((oi = rn->info) == NULL) continue; @@ -948,9 +948,11 @@ void ospf_mpls_te_update_if(struct interface *ifp) if (OspfMplsTE.enabled) if (lp->area != NULL) { if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) - ospf_mpls_te_lsa_schedule(lp, REFRESH_THIS_LSA); + ospf_mpls_te_lsa_schedule( + lp, REFRESH_THIS_LSA); else - ospf_mpls_te_lsa_schedule(lp, REORIGINATE_THIS_LSA); + ospf_mpls_te_lsa_schedule( + lp, REORIGINATE_THIS_LSA); } } else { /* If MPLS TE is disable on this interface, flush LSA if it is @@ -1037,7 +1039,8 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state) if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) ospf_mpls_te_lsa_schedule(lp, REFRESH_THIS_LSA); else - ospf_mpls_te_lsa_schedule(lp, REORIGINATE_THIS_LSA); + ospf_mpls_te_lsa_schedule(lp, + REORIGINATE_THIS_LSA); } break; default: @@ -1379,8 +1382,7 @@ static int ospf_mpls_te_lsa_originate_as(void *arg) struct mpls_te_link *lp; int rc = -1; - if ((!OspfMplsTE.enabled) - || (OspfMplsTE.inter_as == Off)) { + if ((!OspfMplsTE.enabled) || (OspfMplsTE.inter_as == Off)) { zlog_info( "ospf_mpls_te_lsa_originate_as: MPLS-TE Inter-AS is disabled for now."); rc = 0; /* This is not an error case. */ @@ -1395,7 +1397,7 @@ static int ospf_mpls_te_lsa_originate_as(void *arg) if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) { if (CHECK_FLAG(lp->flags, LPFLG_LSA_FORCED_REFRESH)) { - UNSET_FLAG(lp->flags,LPFLG_LSA_FORCED_REFRESH); + UNSET_FLAG(lp->flags, LPFLG_LSA_FORCED_REFRESH); ospf_mpls_te_lsa_schedule(lp, REFRESH_THIS_LSA); } continue; @@ -1596,8 +1598,7 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode) * Followings are vty session control functions. *------------------------------------------------------------------------*/ -static u_int16_t show_vty_router_addr(struct vty *vty, - struct tlv_header *tlvh) +static u_int16_t show_vty_router_addr(struct vty *vty, struct tlv_header *tlvh) { struct te_tlv_router_addr *top = (struct te_tlv_router_addr *)tlvh; @@ -1609,8 +1610,7 @@ static u_int16_t show_vty_router_addr(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_header(struct vty *vty, - struct tlv_header *tlvh) +static u_int16_t show_vty_link_header(struct vty *vty, struct tlv_header *tlvh) { struct te_tlv_link *top = (struct te_tlv_link *)tlvh; @@ -2037,8 +2037,7 @@ static u_int16_t show_vty_link_subtlv_use_bw(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_unknown_tlv(struct vty *vty, - struct tlv_header *tlvh) +static u_int16_t show_vty_unknown_tlv(struct vty *vty, struct tlv_header *tlvh) { if (vty != NULL) vty_out(vty, " Unknown TLV: [type(0x%x), length(0x%x)]\n", @@ -2411,8 +2410,7 @@ DEFUN (no_ospf_mpls_te_inter_as, if (IS_DEBUG_OSPF_EVENT) zlog_debug("MPLS-TE: Inter-AS support OFF"); - if ((OspfMplsTE.enabled) - && (OspfMplsTE.inter_as != Off)) { + if ((OspfMplsTE.enabled) && (OspfMplsTE.inter_as != Off)) { OspfMplsTE.inter_as = Off; /* Flush all Inter-AS LSA */ for (ALL_LIST_ELEMENTS(OspfMplsTE.iflist, node, nnode, lp)) @@ -2452,8 +2450,8 @@ static void show_mpls_te_link_sub(struct vty *vty, struct interface *ifp) { struct mpls_te_link *lp; - if ((OspfMplsTE.enabled) && HAS_LINK_PARAMS(ifp) - && !if_is_loopback(ifp) && if_is_up(ifp) + if ((OspfMplsTE.enabled) && HAS_LINK_PARAMS(ifp) && !if_is_loopback(ifp) + && if_is_up(ifp) && ((lp = lookup_linkparams_by_ifp(ifp)) != NULL)) { /* Continue only if interface is not passive or support Inter-AS * TEv2 */ @@ -2571,7 +2569,7 @@ DEFUN (show_ip_ospf_mpls_te_link, } return CMD_SUCCESS; } - ospf = ospf_lookup_by_inst_name (inst, vrf_name); + ospf = ospf_lookup_by_inst_name(inst, vrf_name); if (ospf == NULL || !ospf->oi_running) return CMD_SUCCESS; vrf = vrf_lookup_by_id(ospf->vrf_id); diff --git a/ospfd/ospf_te.h b/ospfd/ospf_te.h index ed71e54f5..ff9397498 100644 --- a/ospfd/ospf_te.h +++ b/ospfd/ospf_te.h @@ -132,49 +132,49 @@ struct te_link_subtlv_link_type { #define TE_LINK_SUBTLV_LINK_ID 2 struct te_link_subtlv_link_id { struct tlv_header header; /* Value length is 4 octets. */ - struct in_addr value; /* Same as router-lsa's link-id. */ + struct in_addr value; /* Same as router-lsa's link-id. */ }; /* Link Sub-TLV: Local Interface IP Address */ /* Optional */ #define TE_LINK_SUBTLV_LCLIF_IPADDR 3 struct te_link_subtlv_lclif_ipaddr { struct tlv_header header; /* Value length is 4 x N octets. */ - struct in_addr value[1]; /* Local IP address(es). */ + struct in_addr value[1]; /* Local IP address(es). */ }; /* Link Sub-TLV: Remote Interface IP Address */ /* Optional */ #define TE_LINK_SUBTLV_RMTIF_IPADDR 4 struct te_link_subtlv_rmtif_ipaddr { struct tlv_header header; /* Value length is 4 x N octets. */ - struct in_addr value[1]; /* Neighbor's IP address(es). */ + struct in_addr value[1]; /* Neighbor's IP address(es). */ }; /* Link Sub-TLV: Traffic Engineering Metric */ /* Optional */ #define TE_LINK_SUBTLV_TE_METRIC 5 struct te_link_subtlv_te_metric { struct tlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Link metric for TE purpose. */ + u_int32_t value; /* Link metric for TE purpose. */ }; /* Link Sub-TLV: Maximum Bandwidth */ /* Optional */ #define TE_LINK_SUBTLV_MAX_BW 6 struct te_link_subtlv_max_bw { struct tlv_header header; /* Value length is 4 octets. */ - float value; /* bytes/sec */ + float value; /* bytes/sec */ }; /* Link Sub-TLV: Maximum Reservable Bandwidth */ /* Optional */ #define TE_LINK_SUBTLV_MAX_RSV_BW 7 struct te_link_subtlv_max_rsv_bw { struct tlv_header header; /* Value length is 4 octets. */ - float value; /* bytes/sec */ + float value; /* bytes/sec */ }; /* Link Sub-TLV: Unreserved Bandwidth */ /* Optional */ #define TE_LINK_SUBTLV_UNRSV_BW 8 #define TE_LINK_SUBTLV_UNRSV_SIZE 32 struct te_link_subtlv_unrsv_bw { - struct tlv_header header; /* Value length is 32 octets. */ + struct tlv_header header; /* Value length is 32 octets. */ float value[MAX_CLASS_TYPE]; /* One for each priority level. */ }; @@ -182,7 +182,7 @@ struct te_link_subtlv_unrsv_bw { #define TE_LINK_SUBTLV_RSC_CLSCLR 9 struct te_link_subtlv_rsc_clsclr { struct tlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Admin. group membership. */ + u_int32_t value; /* Admin. group membership. */ }; /* For RFC6827 */ @@ -191,8 +191,8 @@ struct te_link_subtlv_rsc_clsclr { #define TE_LINK_SUBTLV_LRRID_SIZE 8 struct te_link_subtlv_lrrid { struct tlv_header header; /* Value length is 8 octets. */ - struct in_addr local; /* Local TE Router Identifier */ - struct in_addr remote; /* Remote TE Router Identifier */ + struct in_addr local; /* Local TE Router Identifier */ + struct in_addr remote; /* Remote TE Router Identifier */ }; /* RFC4203: Link Local/Remote Identifiers */ @@ -200,8 +200,8 @@ struct te_link_subtlv_lrrid { #define TE_LINK_SUBTLV_LLRI_SIZE 8 struct te_link_subtlv_llri { struct tlv_header header; /* Value length is 8 octets. */ - u_int32_t local; /* Link Local Identifier */ - u_int32_t remote; /* Link Remote Identifier */ + u_int32_t local; /* Link Local Identifier */ + u_int32_t remote; /* Link Remote Identifier */ }; /* Inter-RA Export Upward sub-TLV (12) and Inter-RA Export Downward sub-TLV (13) @@ -215,14 +215,14 @@ struct te_link_subtlv_llri { #define TE_LINK_SUBTLV_RAS 21 struct te_link_subtlv_ras { struct tlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Remote AS number */ + u_int32_t value; /* Remote AS number */ }; /* IPv4 Remote ASBR ID Sub-TLV */ #define TE_LINK_SUBTLV_RIP 22 struct te_link_subtlv_rip { struct tlv_header header; /* Value length is 4 octets. */ - struct in_addr value; /* Remote ASBR IP address */ + struct in_addr value; /* Remote ASBR IP address */ }; /* SUBTLV 24 is IPv6 Remote ASBR ID (RFC5392). see ospf6d */ diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 68fb2f567..ee53497af 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -126,16 +126,15 @@ int ospf_oi_count(struct interface *ifp) return i; } -#define OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \ - if (argv_find(argv, argc, "vrf", &idx_vrf)) { \ - vrf_name = argv[idx_vrf + 1]->arg; \ - all_vrf = strmatch(vrf_name, "all"); \ +#define OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \ + if (argv_find(argv, argc, "vrf", &idx_vrf)) { \ + vrf_name = argv[idx_vrf + 1]->arg; \ + all_vrf = strmatch(vrf_name, "all"); \ } static struct ospf *ospf_cmd_lookup_ospf(struct vty *vty, struct cmd_token *argv[], - const int argc, - uint32_t enable, + const int argc, uint32_t enable, u_short *instance) { struct ospf *ospf = NULL; @@ -218,9 +217,10 @@ DEFUN_NOSH (router_ospf, if (ospf->vrf_id != VRF_UNKNOWN) ospf->oi_running = 1; if (IS_DEBUG_OSPF_EVENT) - zlog_debug("Config command 'router ospf %d' received, vrf %s id %u oi_running %u", - instance, ospf->name ? ospf->name : "NIL", - ospf->vrf_id, ospf->oi_running); + zlog_debug( + "Config command 'router ospf %d' received, vrf %s id %u oi_running %u", + instance, ospf->name ? ospf->name : "NIL", + ospf->vrf_id, ospf->oi_running); VTY_PUSH_CONTEXT(OSPF_NODE, ospf); /* Activate 'ip ospf area x' configured interfaces for given @@ -240,8 +240,8 @@ DEFUN_NOSH (router_ospf, rn = route_next(rn)) { if (rn->info != NULL) { vty_out(vty, - "Interface %s has area config but please remove all network commands first.\n", - ifp->name); + "Interface %s has area config but please remove all network commands first.\n", + ifp->name); return ret; } } @@ -463,8 +463,7 @@ DEFUN (ospf_passive_interface, ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id, 0); if (ifp == NULL) { - vty_out(vty, "interface %s not found.\n", - (char *)argv[1]->arg); + vty_out(vty, "interface %s not found.\n", (char *)argv[1]->arg); return CMD_WARNING_CONFIG_FAILED; } @@ -537,8 +536,7 @@ DEFUN (no_ospf_passive_interface, ifp = if_get_by_name(argv[2]->arg, ospf->vrf_id, 0); if (ifp == NULL) { - vty_out(vty, "interface %s not found.\n", - (char *)argv[2]->arg); + vty_out(vty, "interface %s not found.\n", (char *)argv[2]->arg); return CMD_WARNING_CONFIG_FAILED; } @@ -605,10 +603,11 @@ DEFUN (ospf_network_area, vty_out(vty, "Please remove all ip ospf area x.x.x.x commands first.\n"); if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s ospf vrf %s num of %u ip osp area x config", - __PRETTY_FUNCTION__, - ospf->name ? ospf->name : "NIL", - ospf->if_ospf_cli_count); + zlog_debug( + "%s ospf vrf %s num of %u ip osp area x config", + __PRETTY_FUNCTION__, + ospf->name ? ospf->name : "NIL", + ospf->if_ospf_cli_count); return CMD_WARNING_CONFIG_FAILED; } @@ -1984,7 +1983,9 @@ DEFUN (ospf_area_authentication_message_digest, area = ospf_area_get(ospf, area_id); ospf_area_display_format_set(ospf, area, format); - area->auth_type = strmatch(argv[0]->text, "no") ? OSPF_AUTH_NULL : OSPF_AUTH_CRYPTOGRAPHIC; + area->auth_type = strmatch(argv[0]->text, "no") + ? OSPF_AUTH_NULL + : OSPF_AUTH_CRYPTOGRAPHIC; return CMD_SUCCESS; } @@ -2340,25 +2341,22 @@ DEFUN (no_ospf_timers_lsa_min_arrival, #if CONFDATE > 20180708 CPP_NOTICE("ospf: `timers lsa arrival (0-1000)` deprecated 2017/07/08") #endif -ALIAS_HIDDEN (ospf_timers_lsa_min_arrival, - ospf_timers_lsa_arrival_cmd, - "timers lsa arrival (0-1000)", - "adjust routing timers\n" - "throttling link state advertisement delays\n" - "ospf minimum arrival interval delay\n" - "delay (msec) between accepted lsas\n"); +ALIAS_HIDDEN(ospf_timers_lsa_min_arrival, ospf_timers_lsa_arrival_cmd, + "timers lsa arrival (0-1000)", + "adjust routing timers\n" + "throttling link state advertisement delays\n" + "ospf minimum arrival interval delay\n" + "delay (msec) between accepted lsas\n"); #if CONFDATE > 20180708 CPP_NOTICE("ospf: `no timers lsa arrival (0-1000)` deprecated 2017/07/08") #endif -ALIAS_HIDDEN (no_ospf_timers_lsa_min_arrival, - no_ospf_timers_lsa_arrival_cmd, - "no timers lsa arrival (0-1000)", - NO_STR - "adjust routing timers\n" - "throttling link state advertisement delays\n" - "ospf minimum arrival interval delay\n" - "delay (msec) between accepted lsas\n"); +ALIAS_HIDDEN(no_ospf_timers_lsa_min_arrival, no_ospf_timers_lsa_arrival_cmd, + "no timers lsa arrival (0-1000)", NO_STR + "adjust routing timers\n" + "throttling link state advertisement delays\n" + "ospf minimum arrival interval delay\n" + "delay (msec) between accepted lsas\n"); DEFUN (ospf_neighbor, @@ -3284,7 +3282,7 @@ DEFUN (show_ip_ospf, if (uj) json = json_object_new_object(); - /* vrf input is provided could be all or specific vrf*/ + /* vrf input is provided could be all or specific vrf*/ if (vrf_name) { use_vrf = 1; if (all_vrf) { @@ -3296,8 +3294,8 @@ DEFUN (show_ip_ospf, } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } return ret; @@ -3318,11 +3316,12 @@ DEFUN (show_ip_ospf, } } - if (ospf) { + if (ospf) { show_ip_ospf_common(vty, ospf, json, use_vrf); if (uj) - vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); } if (uj) @@ -3361,8 +3360,8 @@ DEFUN (show_ip_ospf_instance, ret = show_ip_ospf_common(vty, ospf, json, 0); if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -3735,7 +3734,7 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf, } if (use_json) json_object_object_add(json_vrf, "interfaces", - json_interface); + json_interface); } else { /* Interface name is specified. */ ifp = if_lookup_by_name(intf_name, ospf->vrf_id); @@ -3785,59 +3784,42 @@ static void show_ip_ospf_interface_traffic_sub(struct vty *vty, u_char use_json) { if (use_json) { - json_object_int_add(json_interface_sub, - "ifIndex", - oi->ifp->ifindex); - json_object_int_add(json_interface_sub, - "helloIn", - oi->hello_in); - json_object_int_add(json_interface_sub, - "helloOut", - oi->hello_out); - json_object_int_add(json_interface_sub, - "dbDescIn", - oi->db_desc_in); - json_object_int_add(json_interface_sub, - "dbDescOut", - oi->db_desc_out); - json_object_int_add(json_interface_sub, - "lsReqIn", - oi->ls_req_in); - json_object_int_add(json_interface_sub, - "lsReqOut", - oi->ls_req_out); - json_object_int_add(json_interface_sub, - "lsUpdIn", - oi->ls_upd_in); - json_object_int_add(json_interface_sub, - "lsUpdOut", - oi->ls_upd_out); - json_object_int_add(json_interface_sub, - "lsAckIn", - oi->ls_ack_in); - json_object_int_add(json_interface_sub, - "lsAckOut", - oi->ls_ack_out); + json_object_int_add(json_interface_sub, "ifIndex", + oi->ifp->ifindex); + json_object_int_add(json_interface_sub, "helloIn", + oi->hello_in); + json_object_int_add(json_interface_sub, "helloOut", + oi->hello_out); + json_object_int_add(json_interface_sub, "dbDescIn", + oi->db_desc_in); + json_object_int_add(json_interface_sub, "dbDescOut", + oi->db_desc_out); + json_object_int_add(json_interface_sub, "lsReqIn", + oi->ls_req_in); + json_object_int_add(json_interface_sub, "lsReqOut", + oi->ls_req_out); + json_object_int_add(json_interface_sub, "lsUpdIn", + oi->ls_upd_in); + json_object_int_add(json_interface_sub, "lsUpdOut", + oi->ls_upd_out); + json_object_int_add(json_interface_sub, "lsAckIn", + oi->ls_ack_in); + json_object_int_add(json_interface_sub, "lsAckOut", + oi->ls_ack_out); } else { vty_out(vty, "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", - oi->ifp->name, oi->hello_in, - oi->hello_out, - oi->db_desc_in, oi->db_desc_out, - oi->ls_req_in, oi->ls_req_out, - oi->ls_upd_in, oi->ls_upd_out, + oi->ifp->name, oi->hello_in, oi->hello_out, + oi->db_desc_in, oi->db_desc_out, oi->ls_req_in, + oi->ls_req_out, oi->ls_upd_in, oi->ls_upd_out, oi->ls_ack_in, oi->ls_ack_out); } } /* OSPFv2 Packet Counters */ -static int show_ip_ospf_interface_traffic_common(struct vty *vty, - struct ospf *ospf, - char *intf_name, - json_object *json, - int display_once, - u_char use_vrf, - u_char use_json) +static int show_ip_ospf_interface_traffic_common( + struct vty *vty, struct ospf *ospf, char *intf_name, json_object *json, + int display_once, u_char use_vrf, u_char use_json) { struct vrf *vrf = NULL; struct interface *ifp = NULL; @@ -3846,13 +3828,14 @@ static int show_ip_ospf_interface_traffic_common(struct vty *vty, if (!use_json && !display_once) { vty_out(vty, "\n"); - vty_out(vty, "%-12s%-17s%-17s%-17s%-17s%-17s\n", - "Interface", " HELLO", " DB-Desc", " LS-Req", - " LS-Update", " LS-Ack"); + vty_out(vty, "%-12s%-17s%-17s%-17s%-17s%-17s\n", "Interface", + " HELLO", " DB-Desc", " LS-Req", " LS-Update", + " LS-Ack"); vty_out(vty, "%-10s%-18s%-18s%-17s%-17s%-17s\n", "", - " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx"); + " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx", + " Rx/Tx"); vty_out(vty, - "--------------------------------------------------------------------------------------------\n"); + "--------------------------------------------------------------------------------------------\n"); } else if (use_json) { if (use_vrf) json_vrf = json_object_new_object(); @@ -3872,7 +3855,7 @@ static int show_ip_ospf_interface_traffic_common(struct vty *vty, continue; for (rn = route_top(IF_OIFS(ifp)); rn; - rn = route_next(rn)) { + rn = route_next(rn)) { oi = rn->info; if (oi == NULL) @@ -3883,13 +3866,12 @@ static int show_ip_ospf_interface_traffic_common(struct vty *vty, json_object_new_object(); } - show_ip_ospf_interface_traffic_sub(vty, oi, - json_interface_sub, - use_json); + show_ip_ospf_interface_traffic_sub( + vty, oi, json_interface_sub, use_json); if (use_json) { - json_object_object_add(json_vrf, - ifp->name, - json_interface_sub); + json_object_object_add( + json_vrf, ifp->name, + json_interface_sub); } } } @@ -3901,7 +3883,8 @@ static int show_ip_ospf_interface_traffic_common(struct vty *vty, struct ospf_interface *oi; if (ospf_oi_count(ifp) == 0) { - vty_out(vty, " OSPF not enabled on this interface %s\n", + vty_out(vty, + " OSPF not enabled on this interface %s\n", ifp->name); return CMD_SUCCESS; } @@ -3915,13 +3898,12 @@ static int show_ip_ospf_interface_traffic_common(struct vty *vty, json_object_new_object(); } - show_ip_ospf_interface_traffic_sub(vty, oi, - json_interface_sub, - use_json); + show_ip_ospf_interface_traffic_sub( + vty, oi, json_interface_sub, use_json); if (use_json) { - json_object_object_add(json_vrf, - ifp->name, - json_interface_sub); + json_object_object_add( + json_vrf, ifp->name, + json_interface_sub); } } } @@ -3980,18 +3962,15 @@ DEFUN (show_ip_ospf_interface, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_interface_common(vty, - ospf, - intf_name, - use_vrf, - json, - uj); + ret = show_ip_ospf_interface_common( + vty, ospf, intf_name, use_vrf, json, + uj); } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4019,8 +3998,8 @@ DEFUN (show_ip_ospf_interface, } if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4064,8 +4043,8 @@ DEFUN (show_ip_ospf_instance_interface, ret = show_ip_ospf_interface_common(vty, ospf, intf_name, 0, json, uj); if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4112,19 +4091,16 @@ DEFUN (show_ip_ospf_interface_traffic, if (!ospf->oi_running) continue; - ret = show_ip_ospf_interface_traffic_common(vty, - ospf, intf_name, - json, - display_once, - use_vrf, - uj); + ret = show_ip_ospf_interface_traffic_common( + vty, ospf, intf_name, json, + display_once, use_vrf, uj); display_once = 1; } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4137,10 +4113,8 @@ DEFUN (show_ip_ospf_interface_traffic, return CMD_SUCCESS; } - ret = show_ip_ospf_interface_traffic_common(vty, ospf, - intf_name, json, - display_once, - use_vrf, uj); + ret = show_ip_ospf_interface_traffic_common( + vty, ospf, intf_name, json, display_once, use_vrf, uj); } else { ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); if (ospf == NULL || !ospf->oi_running) { @@ -4149,15 +4123,13 @@ DEFUN (show_ip_ospf_interface_traffic, return CMD_SUCCESS; } - ret = show_ip_ospf_interface_traffic_common(vty, ospf, - intf_name, json, - display_once, - use_vrf, uj); + ret = show_ip_ospf_interface_traffic_common( + vty, ospf, intf_name, json, display_once, use_vrf, uj); } if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4193,14 +4165,15 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty, if (use_json) { char neigh_str[INET_ADDRSTRLEN]; - if (prev_nbr && - !IPV4_ADDR_SAME(&prev_nbr->src, &nbr->src)) { + if (prev_nbr + && !IPV4_ADDR_SAME(&prev_nbr->src, + &nbr->src)) { /* Start new neigh list */ json_neigh_array = NULL; } - if (nbr->state == NSM_Attempt && - nbr->router_id.s_addr == 0) + if (nbr->state == NSM_Attempt + && nbr->router_id.s_addr == 0) strlcpy(neigh_str, "neighbor", sizeof(neigh_str)); else @@ -4212,72 +4185,67 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty, &json_neigh_array); if (!json_neigh_array) { - json_neigh_array = json_object_new_array(); - json_object_object_add(json, neigh_str, - json_neigh_array); + json_neigh_array = + json_object_new_array(); + json_object_object_add( + json, neigh_str, + json_neigh_array); } - json_neighbor = - json_object_new_object(); + json_neighbor = json_object_new_object(); ospf_nbr_state_message(nbr, msgbuf, 16); long time_store; - time_store = monotime_until( + time_store = + monotime_until( &nbr->t_inactivity->u.sands, - NULL) / 1000LL; + NULL) + / 1000LL; - json_object_int_add(json_neighbor, - "priority", + json_object_int_add(json_neighbor, "priority", nbr->priority); json_object_string_add(json_neighbor, "state", msgbuf); json_object_int_add(json_neighbor, "deadTimeMsecs", time_store); - json_object_string_add(json_neighbor, - "address", + json_object_string_add(json_neighbor, "address", inet_ntoa(nbr->src)); json_object_string_add(json_neighbor, "ifaceName", IF_NAME(oi)); + json_object_int_add( + json_neighbor, "retransmitCounter", + ospf_ls_retransmit_count(nbr)); json_object_int_add(json_neighbor, - "retransmitCounter", - ospf_ls_retransmit_count(nbr)); - json_object_int_add(json_neighbor, - "requestCounter", - ospf_ls_request_count(nbr)); + "requestCounter", + ospf_ls_request_count(nbr)); json_object_int_add(json_neighbor, - "dbSummaryCounter", - ospf_db_summary_count(nbr)); + "dbSummaryCounter", + ospf_db_summary_count(nbr)); json_object_array_add(json_neigh_array, json_neighbor); } else { ospf_nbr_state_message(nbr, msgbuf, 16); - if (nbr->state == NSM_Attempt && - nbr->router_id.s_addr == 0) - vty_out(vty, - "%-15s %3d %-15s ", - "-", - nbr->priority, - msgbuf); + if (nbr->state == NSM_Attempt + && nbr->router_id.s_addr == 0) + vty_out(vty, "%-15s %3d %-15s ", "-", + nbr->priority, msgbuf); else - vty_out(vty, - "%-15s %3d %-15s ", + vty_out(vty, "%-15s %3d %-15s ", inet_ntoa(nbr->router_id), - nbr->priority, - msgbuf); + nbr->priority, msgbuf); vty_out(vty, "%9s ", ospf_timer_dump(nbr->t_inactivity, timebuf, sizeof(timebuf))); vty_out(vty, "%-15s ", inet_ntoa(nbr->src)); - vty_out(vty, - "%-20s %5ld %5ld %5d\n", + vty_out(vty, "%-20s %5ld %5ld %5d\n", IF_NAME(oi), ospf_ls_retransmit_count(nbr), ospf_ls_request_count(nbr), @@ -4324,8 +4292,7 @@ static int show_ip_ospf_neighbor_common(struct vty *vty, struct ospf *ospf, } if (use_json) { - json_object_object_add(json_vrf, "neighbors", - json_nbr_sub); + json_object_object_add(json_vrf, "neighbors", json_nbr_sub); if (use_vrf) { if (ospf->vrf_id == VRF_DEFAULT) json_object_object_add(json, "default", @@ -4374,15 +4341,14 @@ DEFUN (show_ip_ospf_neighbor, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_neighbor_common(vty, ospf, - json, uj, - use_vrf); + ret = show_ip_ospf_neighbor_common( + vty, ospf, json, uj, use_vrf); } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4411,8 +4377,8 @@ DEFUN (show_ip_ospf_neighbor, if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); } } @@ -4454,8 +4420,8 @@ DEFUN (show_ip_ospf_instance_neighbor, ret = show_ip_ospf_neighbor_common(vty, ospf, json, uj, 0); if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4463,8 +4429,7 @@ DEFUN (show_ip_ospf_instance_neighbor, } static int show_ip_ospf_neighbor_all_common(struct vty *vty, struct ospf *ospf, - json_object *json, - u_char use_json, + json_object *json, u_char use_json, u_char use_vrf) { struct listnode *node; @@ -4589,17 +4554,14 @@ DEFUN (show_ip_ospf_neighbor_all, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_neighbor_all_common(vty, - ospf, - json, - uj, - use_vrf); + ret = show_ip_ospf_neighbor_all_common( + vty, ospf, json, uj, use_vrf); } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -4627,8 +4589,8 @@ DEFUN (show_ip_ospf_neighbor_all, use_vrf); if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); } } @@ -4753,8 +4715,8 @@ DEFUN (show_ip_ospf_neighbor_int, continue; if (!ifp || ifp->vrf_id != ospf->vrf_id) continue; - ret = show_ip_ospf_neighbor_int_common(vty, ospf, - idx_ifname, argv, uj, 0); + ret = show_ip_ospf_neighbor_int_common(vty, ospf, idx_ifname, + argv, uj, 0); } return ret; @@ -4791,8 +4753,8 @@ DEFUN (show_ip_ospf_instance_neighbor_int, if (!uj) show_ip_ospf_neighbour_header(vty); - return show_ip_ospf_neighbor_int_common(vty, ospf, idx_ifname, - argv, uj, 0); + return show_ip_ospf_neighbor_int_common(vty, ospf, idx_ifname, argv, uj, + 0); } static void show_ip_ospf_nbr_nbma_detail_sub(struct vty *vty, @@ -4875,8 +4837,7 @@ static void show_ip_ospf_nbr_nbma_detail_sub(struct vty *vty, static void show_ip_ospf_neighbor_detail_sub(struct vty *vty, struct ospf_interface *oi, struct ospf_neighbor *nbr, - json_object *json, - u_char use_json) + json_object *json, u_char use_json) { char timebuf[OSPF_TIME_DUMP_SIZE]; json_object *json_sub = NULL; @@ -5092,8 +5053,7 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty, static int show_ip_ospf_neighbor_id_common(struct vty *vty, struct ospf *ospf, int arg_base, struct cmd_token **argv, - u_char use_json, - u_char use_vrf) + u_char use_json, u_char use_vrf) { struct listnode *node; struct ospf_neighbor *nbr; @@ -5161,8 +5121,8 @@ DEFUN (show_ip_ospf_neighbor_id, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_neighbor_id_common(vty, ospf, 0, - argv, uj, 0); + ret = show_ip_ospf_neighbor_id_common(vty, ospf, 0, argv, uj, + 0); } return ret; @@ -5200,8 +5160,7 @@ DEFUN (show_ip_ospf_instance_neighbor_id, static int show_ip_ospf_neighbor_detail_common(struct vty *vty, struct ospf *ospf, json_object *json, - u_char use_json, - u_char use_vrf) + u_char use_json, u_char use_vrf) { struct ospf_interface *oi; struct listnode *node; @@ -5290,16 +5249,13 @@ DEFUN (show_ip_ospf_neighbor_detail, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_neighbor_detail_common(vty, - ospf, - json, - uj, - use_vrf); + ret = show_ip_ospf_neighbor_detail_common( + vty, ospf, json, uj, use_vrf); } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -5326,8 +5282,8 @@ DEFUN (show_ip_ospf_neighbor_detail, use_vrf); if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); } } @@ -5482,17 +5438,14 @@ DEFUN (show_ip_ospf_neighbor_detail_all, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_neighbor_detail_all_common(vty, - ospf, - json, - uj, - use_vrf); + ret = show_ip_ospf_neighbor_detail_all_common( + vty, ospf, json, uj, use_vrf); } if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -5519,8 +5472,8 @@ DEFUN (show_ip_ospf_neighbor_detail_all, uj, use_vrf); if (uj) { vty_out(vty, "%s\n", - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); } } @@ -5563,8 +5516,8 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, ret = show_ip_ospf_neighbor_detail_all_common(vty, ospf, json, uj, 0); if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } @@ -5683,7 +5636,8 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, if (!ospf->oi_running) return CMD_SUCCESS; - return show_ip_ospf_neighbor_int_detail_common(vty, ospf, idx_ifname, argv, uj); + return show_ip_ospf_neighbor_int_detail_common(vty, ospf, idx_ifname, + argv, uj); } /* Show functions */ @@ -6183,7 +6137,7 @@ static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf, vty_out(vty, "%s\n", show_database_header[type]); - LSDB_LOOP(AREA_LSDB(area, type), rn, lsa) + LSDB_LOOP (AREA_LSDB(area, type), rn, lsa) show_lsa_summary(vty, lsa, self); vty_out(vty, "\n"); @@ -6205,7 +6159,7 @@ static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf, show_database_desc[type]); vty_out(vty, "%s\n", show_database_header[type]); - LSDB_LOOP(AS_LSDB(ospf, type), rn, lsa) + LSDB_LOOP (AS_LSDB(ospf, type), rn, lsa) show_lsa_summary(vty, lsa, self); vty_out(vty, "\n"); @@ -6255,8 +6209,7 @@ static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf) static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, int arg_base, int argc, - struct cmd_token **argv, - u_char use_vrf) + struct cmd_token **argv, u_char use_vrf) { int idx_type = 4; int type, ret; @@ -6361,19 +6314,17 @@ DEFUN (show_ip_ospf_database_max, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_database_common(vty, ospf, - idx_vrf ? 2 - : 0, argc, - argv, - use_vrf); + ret = show_ip_ospf_database_common( + vty, ospf, idx_vrf ? 2 : 0, argc, argv, + use_vrf); } } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if (ospf == NULL || !ospf->oi_running) return CMD_SUCCESS; - ret = (show_ip_ospf_database_common(vty, ospf, idx_vrf ? - 2 : 0, argc, argv, - use_vrf)); + ret = (show_ip_ospf_database_common( + vty, ospf, idx_vrf ? 2 : 0, argc, argv, + use_vrf)); } } else { /* Display default ospf (instance 0) info */ @@ -6433,18 +6384,16 @@ DEFUN (show_ip_ospf_instance_database, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = (show_ip_ospf_database_common(vty, ospf, - idx ? 2 : 0, - argc, argv, - use_vrf)); + ret = (show_ip_ospf_database_common( + vty, ospf, idx ? 2 : 0, argc, argv, + use_vrf)); } } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if ((ospf == NULL) || !ospf->oi_running) return CMD_SUCCESS; - ret = (show_ip_ospf_database_common(vty, ospf, idx ? 2 : - 0, argc, argv, - use_vrf)); + ret = (show_ip_ospf_database_common( + vty, ospf, idx ? 2 : 0, argc, argv, use_vrf)); } } else { /* Display default ospf (instance 0) info */ @@ -6571,11 +6520,8 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, return CMD_NOT_MY_INSTANCE; if (!ospf->oi_running) return CMD_SUCCESS; - return (show_ip_ospf_database_type_adv_router_common(vty, ospf, - idx ? 1 : 0, - argc, - argv, - use_vrf)); + return (show_ip_ospf_database_type_adv_router_common( + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf)); } OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -6586,27 +6532,24 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) continue; - ret = show_ip_ospf_database_type_adv_router_common(vty, - ospf, idx ? 1 : 0, argc, argv, - use_vrf); + ret = show_ip_ospf_database_type_adv_router_common( + vty, ospf, idx ? 1 : 0, argc, argv, + use_vrf); } } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if ((ospf == NULL) || !ospf->oi_running) return CMD_SUCCESS; - ret = show_ip_ospf_database_type_adv_router_common(vty, - ospf, idx ? 1 : 0, argc, argv, - use_vrf); + ret = show_ip_ospf_database_type_adv_router_common( + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf); } } else { /* Display default ospf (instance 0) info */ ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); if (ospf == NULL || !ospf->oi_running) return CMD_SUCCESS; - ret = show_ip_ospf_database_type_adv_router_common(vty, ospf, - idx ? 1 : 0, - argc, argv, - use_vrf); + ret = show_ip_ospf_database_type_adv_router_common( + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf); } return ret; /*return (show_ip_ospf_database_type_adv_router_common( @@ -8015,7 +7958,8 @@ DEFUN (ip_ospf_area, // Check if we have an address arg and proccess it if (argc == idx + 3) { if (!inet_aton(argv[idx + 2]->arg, &addr)) { - vty_out(vty, "Please specify Intf Address by A.B.C.D\n"); + vty_out(vty, + "Please specify Intf Address by A.B.C.D\n"); return CMD_WARNING_CONFIG_FAILED; } // update/create address-level params @@ -8088,7 +8032,8 @@ DEFUN (no_ip_ospf_area, // Check if we have an address arg and proccess it if (argc == idx + 3) { if (!inet_aton(argv[idx + 2]->arg, &addr)) { - vty_out(vty, "Please specify Intf Address by A.B.C.D\n"); + vty_out(vty, + "Please specify Intf Address by A.B.C.D\n"); return CMD_WARNING_CONFIG_FAILED; } params = ospf_lookup_if_params(ifp, addr); @@ -8910,7 +8855,8 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, *json_nexthop = NULL; if (!json) - vty_out(vty, "============ OSPF network routing table ============\n"); + vty_out(vty, + "============ OSPF network routing table ============\n"); for (rn = route_top(rt); rn; rn = route_next(rn)) { if ((or = rn->info) == NULL) @@ -8922,10 +8868,9 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, json_route = json_object_new_object(); if (json) { - json_object_object_add(json, buf1, json_route); - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_NOSLASHESCAPE); - + json_object_object_add(json, buf1, json_route); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_NOSLASHESCAPE); } switch (or->path_type) { @@ -8933,28 +8878,24 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, if (or->type == OSPF_DESTINATION_NETWORK) { if (json) { json_object_string_add(json_route, - "routeType", - "N IA"); - json_object_int_add(json_route, - "cost", + "routeType", + "N IA"); + json_object_int_add(json_route, "cost", or->cost); json_object_string_add( - json_route, - "area", - inet_ntoa( - or->u.std.area_id)); + json_route, "area", + inet_ntoa(or->u.std.area_id)); } else { vty_out(vty, - "N IA %-18s [%d] area: %s\n", + "N IA %-18s [%d] area: %s\n", buf1, or->cost, - inet_ntoa(or->u.std.area_id)); + inet_ntoa(or->u.std.area_id)); } - } else if (or->type == - OSPF_DESTINATION_DISCARD) { + } else if (or->type == OSPF_DESTINATION_DISCARD) { if (json) { json_object_string_add(json_route, - "routeType", - "D IA"); + "routeType", + "D IA"); } else { vty_out(vty, "D IA %-18s Discard entry\n", @@ -8964,12 +8905,13 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, break; case OSPF_PATH_INTRA_AREA: if (json) { - json_object_string_add(json_route, - "routeType", "N"); + json_object_string_add(json_route, "routeType", + "N"); json_object_int_add(json_route, "cost", - or->cost); - json_object_string_add(json_route, - "area", inet_ntoa(or->u.std.area_id)); + or->cost); + json_object_string_add( + json_route, "area", + inet_ntoa(or->u.std.area_id)); } else { vty_out(vty, "N %-18s [%d] area: %s\n", buf1, or->cost, @@ -8984,16 +8926,16 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, if (json) { json_nexthop_array = json_object_new_array(); json_object_object_add(json_route, "nexthops", - json_nexthop_array); + json_nexthop_array); } for (ALL_LIST_ELEMENTS(or->paths, pnode, pnnode, path)) { if (json) { - json_nexthop = - json_object_new_object(); - json_object_array_add(json_nexthop_array, - json_nexthop); + json_nexthop = json_object_new_object(); + json_object_array_add( + json_nexthop_array, + json_nexthop); } if (if_lookup_by_index(path->ifindex, ospf->vrf_id)) { @@ -9002,21 +8944,20 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, if (json) { json_object_string_add( json_nexthop, - "ip", - " "); + "ip", " "); json_object_string_add( json_nexthop, "directly attached to", ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + path->ifindex, + ospf->vrf_id)); } else { vty_out(vty, - "%24s directly attached to %s\n", - "", - ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + "%24s directly attached to %s\n", + "", + ifindex2ifname( + path->ifindex, + ospf->vrf_id)); } } else { if (json) { @@ -9024,22 +8965,22 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, json_nexthop, "ip", inet_ntoa( - path->nexthop)); + path->nexthop)); json_object_string_add( json_nexthop, "via", ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + path->ifindex, + ospf->vrf_id)); } else { vty_out(vty, - "%24s via %s, %s\n", - "", - inet_ntoa( - path->nexthop), - ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + "%24s via %s, %s\n", + "", + inet_ntoa( + path->nexthop), + ifindex2ifname( + path->ifindex, + ospf->vrf_id)); } } } @@ -9065,7 +9006,8 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, *json_nexthop = NULL; if (!json) - vty_out(vty, "============ OSPF router routing table =============\n"); + vty_out(vty, + "============ OSPF router routing table =============\n"); for (rn = route_top(rtrs); rn; rn = route_next(rn)) { if (rn->info == NULL) @@ -9074,18 +9016,15 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, json_route = json_object_new_object(); if (json) { - json_object_object_add(json, - inet_ntoa(rn->p.u.prefix4), - json_route); - json_object_string_add(json_route, "routeType", - "R "); + json_object_object_add(json, inet_ntoa(rn->p.u.prefix4), + json_route); + json_object_string_add(json_route, "routeType", "R "); } else { vty_out(vty, "R %-15s ", inet_ntoa(rn->p.u.prefix4)); } - for (ALL_LIST_ELEMENTS_RO((struct list *)rn->info, node, - or)) { + for (ALL_LIST_ELEMENTS_RO((struct list *)rn->info, node, or)) { if (flag++) { if (!json) vty_out(vty, "%24s", ""); @@ -9095,53 +9034,45 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, if (json) { json_object_int_add(json_route, "cost", or->cost); - json_object_string_add(json_route, - "area", + json_object_string_add( + json_route, "area", inet_ntoa(or->u.std.area_id)); - if (or->path_type == - OSPF_PATH_INTER_AREA) - json_object_boolean_true_add( - json_route, - "IA"); + if (or->path_type == OSPF_PATH_INTER_AREA) + json_object_boolean_true_add(json_route, + "IA"); if (or->u.std.flags & ROUTER_LSA_BORDER) - json_object_string_add( - json_route, - "routerType", - "abr"); - else if (or->u.std.flags & - ROUTER_LSA_EXTERNAL) - json_object_string_add( - json_route, - "routerType", - "asbr"); + json_object_string_add(json_route, + "routerType", + "abr"); + else if (or->u.std.flags & ROUTER_LSA_EXTERNAL) + json_object_string_add(json_route, + "routerType", + "asbr"); } else { vty_out(vty, "%s [%d] area: %s", - (or->path_type == OSPF_PATH_INTER_AREA - ? "IA" - : " "), - or->cost, inet_ntoa(or->u.std.area_id)); + (or->path_type == OSPF_PATH_INTER_AREA + ? "IA" + : " "), + or->cost, inet_ntoa(or->u.std.area_id)); /* Show flags. */ vty_out(vty, "%s%s\n", - (or->u.std.flags & ROUTER_LSA_BORDER - ? ", ABR" - : ""), - (or->u.std.flags & ROUTER_LSA_EXTERNAL - ? ", ASBR" - : "")); + (or->u.std.flags & ROUTER_LSA_BORDER + ? ", ABR" + : ""), + (or->u.std.flags & ROUTER_LSA_EXTERNAL + ? ", ASBR" + : "")); } if (json) { - json_nexthop_array = - json_object_new_array(); + json_nexthop_array = json_object_new_array(); json_object_object_add(json_route, "nexthops", - json_nexthop_array); + json_nexthop_array); } - for (ALL_LIST_ELEMENTS_RO(or->paths, pnode, - path)) { + for (ALL_LIST_ELEMENTS_RO(or->paths, pnode, path)) { if (json) { - json_nexthop = - json_object_new_object(); + json_nexthop = json_object_new_object(); json_object_array_add( json_nexthop_array, json_nexthop); @@ -9152,8 +9083,7 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, if (json) { json_object_string_add( json_nexthop, - "ip", - " "); + "ip", " "); json_object_string_add( json_nexthop, "directly attached to", @@ -9162,18 +9092,19 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, ospf->vrf_id)); } else { vty_out(vty, - "%24s directly attached to %s\n", - "", - ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + "%24s directly attached to %s\n", + "", + ifindex2ifname( + path->ifindex, + ospf->vrf_id)); } } else { if (json) { json_object_string_add( json_nexthop, "ip", - inet_ntoa(path->nexthop)); + inet_ntoa( + path->nexthop)); json_object_string_add( json_nexthop, "via", @@ -9182,13 +9113,13 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, ospf->vrf_id)); } else { vty_out(vty, - "%24s via %s, %s\n", - "", - inet_ntoa( - path->nexthop), - ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + "%24s via %s, %s\n", + "", + inet_ntoa( + path->nexthop), + ifindex2ifname( + path->ifindex, + ospf->vrf_id)); } } } @@ -9213,7 +9144,8 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, *json_nexthop = NULL; if (!json) - vty_out(vty, "============ OSPF external routing table ===========\n"); + vty_out(vty, + "============ OSPF external routing table ===========\n"); for (rn = route_top(rt); rn; rn = route_next(rn)) { if ((er = rn->info) == NULL) @@ -9225,40 +9157,36 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, rn->p.prefixlen); json_route = json_object_new_object(); if (json) { - json_object_object_add(json, buf1, json_route); - json_object_to_json_string_ext(json, - JSON_C_TO_STRING_NOSLASHESCAPE); - + json_object_object_add(json, buf1, json_route); + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_NOSLASHESCAPE); } switch (er->path_type) { case OSPF_PATH_TYPE1_EXTERNAL: if (json) { - json_object_string_add(json_route, - "routeType", + json_object_string_add(json_route, "routeType", "N E1"); json_object_int_add(json_route, "cost", - er->cost); + er->cost); } else { vty_out(vty, - "N E1 %-18s [%d] tag: %" ROUTE_TAG_PRI - "\n", - buf1, er->cost, er->u.ext.tag); + "N E1 %-18s [%d] tag: %" ROUTE_TAG_PRI + "\n", + buf1, er->cost, er->u.ext.tag); } break; case OSPF_PATH_TYPE2_EXTERNAL: if (json) { - json_object_string_add(json_route, - "routeType", + json_object_string_add(json_route, "routeType", "N E2"); json_object_int_add(json_route, "cost", - er->cost); + er->cost); } else { vty_out(vty, - "N E2 %-18s [%d/%d] tag: %" - ROUTE_TAG_PRI - "\n", buf1, er->cost, - er->u.ext.type2_cost, + "N E2 %-18s [%d/%d] tag: %" ROUTE_TAG_PRI + "\n", + buf1, er->cost, er->u.ext.type2_cost, er->u.ext.tag); } break; @@ -9267,61 +9195,56 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, if (json) { json_nexthop_array = json_object_new_array(); json_object_object_add(json_route, "nexthops", - json_nexthop_array); + json_nexthop_array); } - for (ALL_LIST_ELEMENTS(er->paths, pnode, pnnode, - path)) { + for (ALL_LIST_ELEMENTS(er->paths, pnode, pnnode, path)) { if (json) { json_nexthop = json_object_new_object(); - json_object_array_add(json_nexthop_array - ,json_nexthop); + json_object_array_add(json_nexthop_array, + json_nexthop); } - if (if_lookup_by_index(path->ifindex, - ospf->vrf_id)) { + if (if_lookup_by_index(path->ifindex, ospf->vrf_id)) { if (path->nexthop.s_addr == 0) { if (json) { json_object_string_add( - json_nexthop, - "ip", - " "); + json_nexthop, "ip", + " "); json_object_string_add( json_nexthop, "directly attached to", ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + path->ifindex, + ospf->vrf_id)); } else { vty_out(vty, - "%24s directly attached to %s\n", - "", - ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + "%24s directly attached to %s\n", + "", + ifindex2ifname( + path->ifindex, + ospf->vrf_id)); } } else { if (json) { json_object_string_add( - json_nexthop, - "ip", + json_nexthop, "ip", inet_ntoa( - path->nexthop)); + path->nexthop)); json_object_string_add( - json_nexthop, - "via", + json_nexthop, "via", ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + path->ifindex, + ospf->vrf_id)); } else { vty_out(vty, - "%24s via %s, %s\n", - "", - inet_ntoa( - path->nexthop), - ifindex2ifname( - path->ifindex, - ospf->vrf_id)); + "%24s via %s, %s\n", + "", + inet_ntoa( + path->nexthop), + ifindex2ifname( + path->ifindex, + ospf->vrf_id)); } } } @@ -9334,8 +9257,7 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, } static int show_ip_ospf_border_routers_common(struct vty *vty, - struct ospf *ospf, - u_char use_vrf) + struct ospf *ospf, u_char use_vrf) { if (ospf->instance) vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); @@ -9386,9 +9308,8 @@ DEFUN (show_ip_ospf_border_routers, if (!ospf->oi_running) continue; - ret = show_ip_ospf_border_routers_common(vty, - ospf, - use_vrf); + ret = show_ip_ospf_border_routers_common( + vty, ospf, use_vrf); } } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); @@ -9468,7 +9389,8 @@ static int show_ip_ospf_route_common(struct vty *vty, struct ospf *ospf, if (json) { if (use_vrf) { - //json_object_object_add(json_vrf, "areas", json_areas); + // json_object_object_add(json_vrf, "areas", + // json_areas); if (ospf->vrf_id == VRF_DEFAULT) json_object_object_add(json, "default", json_vrf); @@ -9623,8 +9545,9 @@ DEFUN (show_ip_ospf_vrfs, else name = ospf->name; - vrf_id_ui = (ospf->vrf_id == VRF_UNKNOWN) ? -1 : - (int64_t) ospf->vrf_id; + vrf_id_ui = (ospf->vrf_id == VRF_UNKNOWN) + ? -1 + : (int64_t)ospf->vrf_id; if (uj) { json_object_int_add(json_vrf, "vrfId", vrf_id_ui); @@ -9634,8 +9557,8 @@ DEFUN (show_ip_ospf_vrfs, json_object_object_add(json_vrfs, name, json_vrf); } else { - vty_out(vty, "%-25s %-5d %-16s \n", - name, ospf->vrf_id, inet_ntoa(ospf->router_id)); + vty_out(vty, "%-25s %-5d %-16s \n", name, + ospf->vrf_id, inet_ntoa(ospf->router_id)); } } @@ -9643,8 +9566,8 @@ DEFUN (show_ip_ospf_vrfs, json_object_object_add(json, "vrfs", json_vrfs); json_object_int_add(json, "totalVrfs", count); - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { if (count) @@ -9685,8 +9608,8 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) if (ifp->vrf_id == VRF_DEFAULT) vty_frame(vty, "interface %s\n", ifp->name); else - vty_frame(vty, "interface %s vrf %s\n", - ifp->name, vrf->name); + vty_frame(vty, "interface %s vrf %s\n", ifp->name, + vrf->name); if (ifp->desc) vty_out(vty, " description %s\n", ifp->desc); @@ -9698,22 +9621,21 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Interface Network print. */ if (OSPF_IF_PARAM_CONFIGURED(params, type) && params->type != OSPF_IFTYPE_LOOPBACK) { - if (params->type != - ospf_default_iftype(ifp)) { + if (params->type != ospf_default_iftype(ifp)) { vty_out(vty, " ip ospf network %s", ospf_int_type_str - [params->type]); + [params->type]); if (params != IF_DEF_PARAMS(ifp)) vty_out(vty, " %s", inet_ntoa( - rn->p.u.prefix4)); + rn->p.u.prefix4)); vty_out(vty, "\n"); } } /* OSPF interface authentication print */ if (OSPF_IF_PARAM_CONFIGURED(params, auth_type) - && params->auth_type != OSPF_AUTH_NOTSET) { + && params->auth_type != OSPF_AUTH_NOTSET) { const char *auth_str; /* Translation tables are not that much help @@ -9748,7 +9670,7 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Simple Authentication Password print. */ if (OSPF_IF_PARAM_CONFIGURED(params, auth_simple) - && params->auth_simple[0] != '\0') { + && params->auth_simple[0] != '\0') { vty_out(vty, " ip ospf authentication-key %s", params->auth_simple); if (params != IF_DEF_PARAMS(ifp)) @@ -9759,23 +9681,21 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Cryptographic Authentication Key print. */ if (params && params->auth_crypt) { - for (ALL_LIST_ELEMENTS_RO( - params->auth_crypt, - node, ck)) { + for (ALL_LIST_ELEMENTS_RO(params->auth_crypt, + node, ck)) { vty_out(vty, " ip ospf message-digest-key %d md5 %s", - ck->key_id, - ck->auth_key); + ck->key_id, ck->auth_key); if (params != IF_DEF_PARAMS(ifp)) vty_out(vty, " %s", - inet_ntoa(rn->p.u.prefix4)); + inet_ntoa( + rn->p.u.prefix4)); vty_out(vty, "\n"); } } /* Interface Output Cost print. */ - if (OSPF_IF_PARAM_CONFIGURED(params, - output_cost_cmd)) { + if (OSPF_IF_PARAM_CONFIGURED(params, output_cost_cmd)) { vty_out(vty, " ip ospf cost %u", params->output_cost_cmd); if (params != IF_DEF_PARAMS(ifp)) @@ -9786,8 +9706,7 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Hello Interval print. */ if (OSPF_IF_PARAM_CONFIGURED(params, v_hello) - && params->v_hello != - OSPF_HELLO_INTERVAL_DEFAULT) { + && params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) { vty_out(vty, " ip ospf hello-interval %u", params->v_hello); if (params != IF_DEF_PARAMS(ifp)) @@ -9799,19 +9718,18 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Router Dead Interval print. */ if (OSPF_IF_PARAM_CONFIGURED(params, v_wait) - && params->v_wait - != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) { + && params->v_wait + != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) { vty_out(vty, " ip ospf dead-interval "); /* fast hello ? */ if (OSPF_IF_PARAM_CONFIGURED(params, - fast_hello)) + fast_hello)) vty_out(vty, "minimal hello-multiplier %d", params->fast_hello); else - vty_out(vty, "%u", - params->v_wait); + vty_out(vty, "%u", params->v_wait); if (params != IF_DEF_PARAMS(ifp)) vty_out(vty, " %s", @@ -9821,8 +9739,8 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Router Priority print. */ if (OSPF_IF_PARAM_CONFIGURED(params, priority) - && params->priority - != OSPF_ROUTER_PRIORITY_DEFAULT) { + && params->priority + != OSPF_ROUTER_PRIORITY_DEFAULT) { vty_out(vty, " ip ospf priority %u", params->priority); if (params != IF_DEF_PARAMS(ifp)) @@ -9833,9 +9751,9 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* Retransmit Interval print. */ if (OSPF_IF_PARAM_CONFIGURED(params, - retransmit_interval) - && params->retransmit_interval - != OSPF_RETRANSMIT_INTERVAL_DEFAULT) { + retransmit_interval) + && params->retransmit_interval + != OSPF_RETRANSMIT_INTERVAL_DEFAULT) { vty_out(vty, " ip ospf retransmit-interval %u", params->retransmit_interval); if (params != IF_DEF_PARAMS(ifp)) @@ -9845,15 +9763,14 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) } /* Transmit Delay print. */ - if (OSPF_IF_PARAM_CONFIGURED(params, - transmit_delay) - && params->transmit_delay - != OSPF_TRANSMIT_DELAY_DEFAULT) { + if (OSPF_IF_PARAM_CONFIGURED(params, transmit_delay) + && params->transmit_delay + != OSPF_TRANSMIT_DELAY_DEFAULT) { vty_out(vty, " ip ospf transmit-delay %u", params->transmit_delay); if (params != IF_DEF_PARAMS(ifp)) vty_out(vty, " %s", - inet_ntoa(rn->p.u.prefix4)); + inet_ntoa(rn->p.u.prefix4)); vty_out(vty, "\n"); } @@ -9867,16 +9784,15 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) size_t buflen = MAX(strlen("4294967295"), - strlen("255.255.255.255")); + strlen("255.255.255.255")); char buf[buflen]; - area_id2str(buf, sizeof(buf), - ¶ms->if_area, - params->if_area_id_fmt); + area_id2str(buf, sizeof(buf), ¶ms->if_area, + params->if_area_id_fmt); vty_out(vty, " area %s", buf); if (params != IF_DEF_PARAMS(ifp)) vty_out(vty, " %s", - inet_ntoa(rn->p.u.prefix4)); + inet_ntoa(rn->p.u.prefix4)); vty_out(vty, "\n"); } @@ -9886,23 +9802,21 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf) /* MTU ignore print. */ if (OSPF_IF_PARAM_CONFIGURED(params, mtu_ignore) - && params->mtu_ignore != - OSPF_MTU_IGNORE_DEFAULT) { + && params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) { if (params->mtu_ignore == 0) vty_out(vty, " no ip ospf mtu-ignore"); else vty_out(vty, " ip ospf mtu-ignore"); if (params != IF_DEF_PARAMS(ifp)) vty_out(vty, " %s", - inet_ntoa(rn->p.u.prefix4)); + inet_ntoa(rn->p.u.prefix4)); vty_out(vty, "\n"); } while (1) { if (rn == NULL) - rn = route_top( - IF_OIFS_PARAMS(ifp)); + rn = route_top(IF_OIFS_PARAMS(ifp)); else rn = route_next(rn); @@ -10288,14 +10202,12 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) /* `router ospf' print. */ if (ospf->instance && ospf->name) { - vty_out(vty, "router ospf %d vrf %s\n", - ospf->instance, ospf->name); + vty_out(vty, "router ospf %d vrf %s\n", ospf->instance, + ospf->name); } else if (ospf->instance) { - vty_out(vty, "router ospf %d\n", - ospf->instance); + vty_out(vty, "router ospf %d\n", ospf->instance); } else if (ospf->name) { - vty_out(vty, "router ospf vrf %s\n", - ospf->name); + vty_out(vty, "router ospf vrf %s\n", ospf->name); } else vty_out(vty, "router ospf\n"); @@ -10342,9 +10254,8 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT || ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT) - vty_out(vty, " timers throttle spf %d %d %d\n", - ospf->spf_delay, ospf->spf_holdtime, - ospf->spf_max_holdtime); + vty_out(vty, " timers throttle spf %d %d %d\n", ospf->spf_delay, + ospf->spf_holdtime, ospf->spf_max_holdtime); /* LSA timers print. */ if (ospf->min_ls_interval != OSPF_MIN_LS_INTERVAL) @@ -10363,10 +10274,8 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) config_write_stub_router(vty, ospf); /* SPF refresh parameters print. */ - if (ospf->lsa_refresh_interval - != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) - vty_out(vty, " refresh timer %d\n", - ospf->lsa_refresh_interval); + if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) + vty_out(vty, " refresh timer %d\n", ospf->lsa_refresh_interval); /* Redistribute information print. */ config_write_ospf_redistribute(vty, ospf); @@ -10379,22 +10288,19 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), passive_interface) && IF_DEF_PARAMS(ifp)->passive_interface - != ospf->passive_interface_default) { + != ospf->passive_interface_default) { vty_out(vty, " %spassive-interface %s\n", - IF_DEF_PARAMS(ifp)->passive_interface - ? "" - : "no ", + IF_DEF_PARAMS(ifp)->passive_interface ? "" + : "no ", ifp->name); } for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) { - if (!OSPF_IF_PARAM_CONFIGURED(oi->params, - passive_interface)) + if (!OSPF_IF_PARAM_CONFIGURED(oi->params, passive_interface)) continue; if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(oi->ifp), passive_interface)) { if (oi->params->passive_interface - == IF_DEF_PARAMS(oi->ifp) - ->passive_interface) + == IF_DEF_PARAMS(oi->ifp)->passive_interface) continue; } else if (oi->params->passive_interface == ospf->passive_interface_default) @@ -10402,8 +10308,7 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) vty_out(vty, " %spassive-interface %s %s\n", oi->params->passive_interface ? "" : "no ", - oi->ifp->name, - inet_ntoa(oi->address->u.prefix4)); + oi->ifp->name, inet_ntoa(oi->address->u.prefix4)); } /* Network area print. */ diff --git a/ospfd/ospf_vty.h b/ospfd/ospf_vty.h index 5eb6842be..559109972 100644 --- a/ospfd/ospf_vty.h +++ b/ospfd/ospf_vty.h @@ -44,7 +44,7 @@ vty_out(vty, \ "%% You can't configure %s to backbone\n", \ NAME); \ - return CMD_WARNING; \ + return CMD_WARNING; \ } \ } diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 93aa60390..3b257fec9 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -75,8 +75,8 @@ static int ospf_router_id_update_zebra(int command, struct zclient *zclient, if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) { char buf[PREFIX2STR_BUFFER]; prefix2str(&router_id, buf, sizeof(buf)); - zlog_debug("Zebra rcvd: router id update %s vrf %s id %u", - buf, ospf_vrf_id_to_name(vrf_id), vrf_id); + zlog_debug("Zebra rcvd: router id update %s vrf %s id %u", buf, + ospf_vrf_id_to_name(vrf_id), vrf_id); } ospf = ospf_lookup_by_vrf_id(vrf_id); @@ -89,9 +89,10 @@ static int ospf_router_id_update_zebra(int command, struct zclient *zclient, char buf[PREFIX2STR_BUFFER]; prefix2str(&router_id, buf, sizeof(buf)); - zlog_debug("%s: ospf instance not found for vrf %s id %u router_id %s", - __PRETTY_FUNCTION__, - ospf_vrf_id_to_name(vrf_id), vrf_id, buf); + zlog_debug( + "%s: ospf instance not found for vrf %s id %u router_id %s", + __PRETTY_FUNCTION__, + ospf_vrf_id_to_name(vrf_id), vrf_id, buf); } } return 0; @@ -356,29 +357,30 @@ static int ospf_interface_link_params(int command, struct zclient *zclient, /* VRF update for an interface. */ static int ospf_interface_vrf_update(int command, struct zclient *zclient, - zebra_size_t length, vrf_id_t vrf_id) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp = NULL; vrf_id_t new_vrf_id; ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id, - &new_vrf_id); + &new_vrf_id); if (!ifp) return 0; if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: Rx Interface %s VRF change vrf_id %u New vrf %s id %u", - __PRETTY_FUNCTION__, ifp->name, vrf_id, - ospf_vrf_id_to_name(new_vrf_id), new_vrf_id); + zlog_debug( + "%s: Rx Interface %s VRF change vrf_id %u New vrf %s id %u", + __PRETTY_FUNCTION__, ifp->name, vrf_id, + ospf_vrf_id_to_name(new_vrf_id), new_vrf_id); /*if_update(ifp, ifp->name, strlen(ifp->name), new_vrf_id);*/ if_update_to_new_vrf(ifp, new_vrf_id); - return 0; + return 0; } void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p, - struct ospf_route *or) + struct ospf_route * or) { struct zapi_route api; struct zapi_nexthop *api_nh; @@ -461,7 +463,7 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p, } void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p, - struct ospf_route *or) + struct ospf_route * or) { struct zapi_route api; @@ -694,10 +696,11 @@ int ospf_redistribute_set(struct ospf *ospf, int type, u_short instance, instance, ospf->vrf_id); if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) - zlog_debug("Redistribute[%s][%d] vrf id %u: Start Type[%d], Metric[%d]", - ospf_redist_string(type), instance, ospf->vrf_id, - metric_type(ospf, type, instance), - metric_value(ospf, type, instance)); + zlog_debug( + "Redistribute[%s][%d] vrf id %u: Start Type[%d], Metric[%d]", + ospf_redist_string(type), instance, ospf->vrf_id, + metric_type(ospf, type, instance), + metric_value(ospf, type, instance)); ospf_asbr_status_update(ospf, ++ospf->redistribute); @@ -967,8 +970,8 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, */ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) if (i != api.type) - ospf_external_info_delete(ospf, i, - api.instance, p); + ospf_external_info_delete(ospf, i, api.instance, + p); ei = ospf_external_info_add(ospf, api.type, api.instance, p, ifindex, nexthop, api.tag); @@ -1068,7 +1071,7 @@ static int ospf_distribute_list_update_timer(struct thread *thread) struct ospf_lsa *lsa; int type, default_refresh = 0, arg_type; struct ospf *ospf = NULL; - void **arg = THREAD_ARG (thread); + void **arg = THREAD_ARG(thread); ospf = (struct ospf *)arg[0]; arg_type = (int)(intptr_t)arg[1]; @@ -1081,9 +1084,10 @@ static int ospf_distribute_list_update_timer(struct thread *thread) zlog_info("Zebra[Redistribute]: distribute-list update timer fired!"); if (IS_DEBUG_OSPF_EVENT) { - zlog_debug("%s: ospf distribute-list update arg_type %d vrf %s id %d", - __PRETTY_FUNCTION__, arg_type, - ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id); + zlog_debug( + "%s: ospf distribute-list update arg_type %d vrf %s id %d", + __PRETTY_FUNCTION__, arg_type, + ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id); } /* foreach all external info. */ @@ -1124,15 +1128,14 @@ static int ospf_distribute_list_update_timer(struct thread *thread) } /* Update distribute-list and set timer to apply access-list. */ -void ospf_distribute_list_update(struct ospf *ospf, int type, - u_short instance) +void ospf_distribute_list_update(struct ospf *ospf, int type, u_short instance) { struct route_table *rt; struct ospf_external *ext; - void **args = XCALLOC(MTYPE_OSPF_DIST_ARGS, sizeof(void *)*2); + void **args = XCALLOC(MTYPE_OSPF_DIST_ARGS, sizeof(void *) * 2); args[0] = ospf; - args[1] = (void *)((ptrdiff_t) type); + args[1] = (void *)((ptrdiff_t)type); /* External info does not exist. */ ext = ospf_external_lookup(ospf, type, instance); @@ -1177,13 +1180,15 @@ static void ospf_filter_update(struct access_list *access) red_list = ospf->redist[type]; if (red_list) - for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) { + for (ALL_LIST_ELEMENTS_RO(red_list, node, + red)) { if (ROUTEMAP(red)) { - /* if route-map is not NULL it may be + /* if route-map is not NULL it + * may be * using this access list */ ospf_distribute_list_update( - ospf, - type, red->instance); + ospf, type, + red->instance); } } @@ -1195,22 +1200,27 @@ static void ospf_filter_update(struct access_list *access) if (DISTRIBUTE_NAME(ospf, type)) { /* Keep old access-list for distribute-list. */ - struct access_list *old = DISTRIBUTE_LIST(ospf, - type); + struct access_list *old = + DISTRIBUTE_LIST(ospf, type); /* Update access-list for distribute-list. */ - DISTRIBUTE_LIST(ospf, type) = access_list_lookup( - AFI_IP, DISTRIBUTE_NAME(ospf, type)); + DISTRIBUTE_LIST(ospf, type) = + access_list_lookup( + AFI_IP, + DISTRIBUTE_NAME(ospf, type)); /* No update for this distribute type. */ - if (old == NULL && DISTRIBUTE_LIST(ospf, type) == NULL) + if (old == NULL + && DISTRIBUTE_LIST(ospf, type) == NULL) continue; /* Schedule distribute-list update timer. */ if (DISTRIBUTE_LIST(ospf, type) == NULL - || strcmp(DISTRIBUTE_NAME(ospf, type), access->name) - == 0) - ospf_distribute_list_update(ospf, type, 0); + || strcmp(DISTRIBUTE_NAME(ospf, type), + access->name) + == 0) + ospf_distribute_list_update(ospf, type, + 0); } } @@ -1260,8 +1270,8 @@ void ospf_prefix_list_update(struct prefix_list *plist) red_list = ospf->redist[type]; if (red_list) { - for (ALL_LIST_ELEMENTS_RO(red_list, - node, red)) { + for (ALL_LIST_ELEMENTS_RO(red_list, node, + red)) { if (ROUTEMAP(red)) { /* if route-map is not NULL * it may be using @@ -1279,22 +1289,24 @@ void ospf_prefix_list_update(struct prefix_list *plist) /* Update filter-list in. */ if (PREFIX_NAME_IN(area)) if (strcmp(PREFIX_NAME_IN(area), - prefix_list_name(plist)) == 0) { + prefix_list_name(plist)) + == 0) { PREFIX_LIST_IN(area) = prefix_list_lookup( - AFI_IP, - PREFIX_NAME_IN(area)); + AFI_IP, + PREFIX_NAME_IN(area)); abr_inv++; } /* Update filter-list out. */ if (PREFIX_NAME_OUT(area)) if (strcmp(PREFIX_NAME_OUT(area), - prefix_list_name(plist)) == 0) { + prefix_list_name(plist)) + == 0) { PREFIX_LIST_IN(area) = prefix_list_lookup( - AFI_IP, - PREFIX_NAME_OUT(area)); + AFI_IP, + PREFIX_NAME_OUT(area)); abr_inv++; } } @@ -1407,7 +1419,7 @@ void ospf_distance_reset(struct ospf *ospf) } u_char ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *p, - struct ospf_route *or) + struct ospf_route * or) { if (ospf == NULL) diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h index d4b00dddf..236f5a263 100644 --- a/ospfd/ospf_zebra.h +++ b/ospfd/ospf_zebra.h @@ -59,9 +59,9 @@ extern int ospf_is_type_redistributed(struct ospf *, int, u_short); extern void ospf_distance_reset(struct ospf *); extern u_char ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *, struct ospf_route *); -extern struct ospf_external *ospf_external_lookup(struct ospf*, u_char, +extern struct ospf_external *ospf_external_lookup(struct ospf *, u_char, u_short); -extern struct ospf_external *ospf_external_add(struct ospf*, u_char, u_short); +extern struct ospf_external *ospf_external_add(struct ospf *, u_char, u_short); extern void ospf_external_del(struct ospf *, u_char, u_short); extern struct ospf_redist *ospf_redist_lookup(struct ospf *, u_char, u_short); extern struct ospf_redist *ospf_redist_add(struct ospf *, u_char, u_short); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 79af4a55f..c4a471322 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -121,8 +121,7 @@ void ospf_router_id_update(struct ospf *ospf) if (IS_DEBUG_OSPF_EVENT) zlog_debug("Router-ID[OLD:%s]: Update to %s", - inet_ntoa(ospf->router_id), - inet_ntoa(router_id)); + inet_ntoa(ospf->router_id), inet_ntoa(router_id)); if (!IPV4_ADDR_SAME(&router_id_old, &router_id)) { @@ -159,7 +158,7 @@ void ospf_router_id_update(struct ospf *ospf) struct route_node *rn; struct ospf_lsa *lsa; - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) if (IS_LSA_SELF(lsa)) ospf_lsa_flush_schedule(ospf, lsa); } @@ -241,8 +240,9 @@ static struct ospf *ospf_new(u_short instance, const char *name) new->name = XSTRDUP(MTYPE_OSPF_TOP, name); vrf = vrf_lookup_by_name(new->name); if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: Create new ospf instance with vrf_name %s vrf_id %u", - __PRETTY_FUNCTION__, name, new->vrf_id); + zlog_debug( + "%s: Create new ospf instance with vrf_name %s vrf_id %u", + __PRETTY_FUNCTION__, name, new->vrf_id); if (vrf) ospf_vrf_link(new, vrf); } else { @@ -329,8 +329,8 @@ static struct ospf *ospf_new(u_short instance, const char *name) if ((ospf_sock_init(new)) < 0) { if (new->vrf_id != VRF_UNKNOWN) zlog_warn( - "%s: ospf_sock_init is unable to open a socket", - __func__); + "%s: ospf_sock_init is unable to open a socket", + __func__); return new; } thread_add_read(master, ospf_read, new, new->fd, &new->t_read); @@ -380,9 +380,10 @@ struct ospf *ospf_lookup_by_inst_name(u_short instance, const char *name) struct listnode *node, *nnode; for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) { - if ((ospf->instance == instance) && - ((ospf->name == NULL && name == NULL) || - (ospf->name && name && strcmp(ospf->name, name) == 0))) + if ((ospf->instance == instance) + && ((ospf->name == NULL && name == NULL) + || (ospf->name && name + && strcmp(ospf->name, name) == 0))) return ospf; } return NULL; @@ -426,9 +427,10 @@ struct ospf *ospf_get_instance(u_short instance) ospf_router_id_update(ospf); else { if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: ospf VRF (id %d) is not active yet, skip router id update" - , __PRETTY_FUNCTION__, - ospf->vrf_id); + zlog_debug( + "%s: ospf VRF (id %d) is not active yet, skip router id update", + __PRETTY_FUNCTION__, + ospf->vrf_id); } ospf_router_id_update(ospf); } @@ -447,7 +449,6 @@ struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id) if (!vrf) return NULL; return (vrf->info) ? (struct ospf *)vrf->info : NULL; - } /* It should only be used when processing incoming info update from zebra. @@ -461,8 +462,8 @@ static struct ospf *ospf_lookup_by_name(const char *vrf_name) for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) if ((ospf->name == NULL && vrf_name == NULL) - || (ospf->name && vrf_name && - strcmp(ospf->name, vrf_name) == 0)) + || (ospf->name && vrf_name + && strcmp(ospf->name, vrf_name) == 0)) return ospf; return NULL; } @@ -711,9 +712,9 @@ static void ospf_finish_final(struct ospf *ospf) close(ospf->fd); stream_free(ospf->ibuf); - LSDB_LOOP(OPAQUE_AS_LSDB(ospf), rn, lsa) + LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) ospf_discard_from_db(ospf, ospf->lsdb, lsa); - LSDB_LOOP(EXTERNAL_LSDB(ospf), rn, lsa) + LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) ospf_discard_from_db(ospf, ospf->lsdb, lsa); ospf_lsdb_delete_all(ospf->lsdb); @@ -848,20 +849,20 @@ static void ospf_area_free(struct ospf_area *area) ospf_opaque_type10_lsa_term(area); /* Free LSDBs. */ - LSDB_LOOP(ROUTER_LSDB(area), rn, lsa) + LSDB_LOOP (ROUTER_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); - LSDB_LOOP(NETWORK_LSDB(area), rn, lsa) + LSDB_LOOP (NETWORK_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); - LSDB_LOOP(SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); - LSDB_LOOP(ASBR_SUMMARY_LSDB(area), rn, lsa) + LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); - LSDB_LOOP(NSSA_LSDB(area), rn, lsa) + LSDB_LOOP (NSSA_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); - LSDB_LOOP(OPAQUE_AREA_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); - LSDB_LOOP(OPAQUE_LINK_LSDB(area), rn, lsa) + LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa) ospf_discard_from_db(area->ospf, area->lsdb, lsa); ospf_lsdb_delete_all(area->lsdb); @@ -998,13 +999,12 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) continue; if (add_to_ospf) { - if (ospf_external_info_find_lsa( - ospf, &ei->p)) + if (ospf_external_info_find_lsa(ospf, + &ei->p)) if (!ospf_distribute_check_connected( ospf, ei)) ospf_external_lsa_flush( - ospf, - ei->type, + ospf, ei->type, &ei->p, ei->ifindex /*, ei->nexthop */); } else { @@ -1013,8 +1013,7 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) if (ospf_distribute_check_connected( ospf, ei)) ospf_external_lsa_originate( - ospf, - ei); + ospf, ei); } } } @@ -1100,10 +1099,10 @@ int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p, /* Find interfaces that are not configured already. */ for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) { - if (oi->type == OSPF_IFTYPE_VIRTUALLINK) - continue; + if (oi->type == OSPF_IFTYPE_VIRTUALLINK) + continue; - ospf_network_run_subnet(ospf, oi->connected, NULL, NULL); + ospf_network_run_subnet(ospf, oi->connected, NULL, NULL); } /* Update connected redistribute. */ @@ -1321,10 +1320,11 @@ void ospf_if_update(struct ospf *ospf, struct interface *ifp) return; if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: interface %s ifp->vrf_id %u ospf vrf %s vrf_id %u router_id %s", - __PRETTY_FUNCTION__, ifp->name, ifp->vrf_id, - ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id, - inet_ntoa(ospf->router_id)); + zlog_debug( + "%s: interface %s ifp->vrf_id %u ospf vrf %s vrf_id %u router_id %s", + __PRETTY_FUNCTION__, ifp->name, ifp->vrf_id, + ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id, + inet_ntoa(ospf->router_id)); /* OSPF must be ready. */ if (!ospf_is_ready(ospf)) @@ -2056,8 +2056,8 @@ static int ospf_vrf_enable(struct vrf *vrf) int ret = 0; if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: VRF %s id %u enabled", - __PRETTY_FUNCTION__, vrf->name, vrf->vrf_id); + zlog_debug("%s: VRF %s id %u enabled", __PRETTY_FUNCTION__, + vrf->name, vrf->vrf_id); ospf = ospf_lookup_by_name(vrf->name); if (ospf) { @@ -2065,24 +2065,27 @@ static int ospf_vrf_enable(struct vrf *vrf) /* We have instance configured, link to VRF and make it "up". */ ospf_vrf_link(ospf, vrf); if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: ospf linked to vrf %s vrf_id %u (old id %u)", - __PRETTY_FUNCTION__, vrf->name, ospf->vrf_id, - old_vrf_id); + zlog_debug( + "%s: ospf linked to vrf %s vrf_id %u (old id %u)", + __PRETTY_FUNCTION__, vrf->name, ospf->vrf_id, + old_vrf_id); if (old_vrf_id != ospf->vrf_id) { if (ospfd_privs.change(ZPRIVS_RAISE)) { - zlog_err("ospf_sock_init: could not raise privs, %s", - safe_strerror(errno)); + zlog_err( + "ospf_sock_init: could not raise privs, %s", + safe_strerror(errno)); } ret = ospf_sock_init(ospf); if (ospfd_privs.change(ZPRIVS_LOWER)) { - zlog_err("ospf_sock_init: could not lower privs, %s", - safe_strerror(errno)); + zlog_err( + "ospf_sock_init: could not lower privs, %s", + safe_strerror(errno)); } if (ret < 0 || ospf->fd <= 0) return 0; - thread_add_read(master, ospf_read, ospf, - ospf->fd, &ospf->t_read); + thread_add_read(master, ospf_read, ospf, ospf->fd, + &ospf->t_read); ospf->oi_running = 1; ospf_zebra_vrf_register(ospf); ospf_router_id_update(ospf); @@ -2102,8 +2105,8 @@ static int ospf_vrf_disable(struct vrf *vrf) return 0; if (IS_DEBUG_OSPF_EVENT) - zlog_debug("%s: VRF %s id %d disabled.", - __PRETTY_FUNCTION__, vrf->name, vrf->vrf_id); + zlog_debug("%s: VRF %s id %d disabled.", __PRETTY_FUNCTION__, + vrf->name, vrf->vrf_id); ospf = ospf_lookup_by_name(vrf->name); if (ospf) { @@ -2116,7 +2119,7 @@ static int ospf_vrf_disable(struct vrf *vrf) ospf->oi_running = 0; if (IS_DEBUG_OSPF_EVENT) zlog_debug("%s: ospf old_vrf_id %d unlinked", - __PRETTY_FUNCTION__, old_vrf_id); + __PRETTY_FUNCTION__, old_vrf_id); thread_cancel(ospf->t_read); close(ospf->fd); ospf->fd = -1; @@ -2128,8 +2131,8 @@ static int ospf_vrf_disable(struct vrf *vrf) void ospf_vrf_init(void) { - vrf_init(ospf_vrf_new, ospf_vrf_enable, - ospf_vrf_disable, ospf_vrf_delete); + vrf_init(ospf_vrf_new, ospf_vrf_enable, ospf_vrf_disable, + ospf_vrf_delete); } void ospf_vrf_terminate(void) diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 6954660e0..bed446085 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -131,8 +131,8 @@ struct ospf { struct in_addr router_id_static; /* Configured manually. */ struct in_addr router_id_zebra; - vrf_id_t vrf_id; /* VRF Id */ - char *name; /* VRF name */ + vrf_id_t vrf_id; /* VRF Id */ + char *name; /* VRF name */ /* ABR/ASBR internal flags. */ u_char flags; @@ -165,8 +165,6 @@ struct ospf { /* RFC3137 stub router. Configured time to stay stub / max-metric */ unsigned int stub_router_startup_time; /* seconds */ unsigned int stub_router_shutdown_time; /* seconds */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_STUB_ROUTER_UNCONFIGURED 0 u_char stub_router_admin_set; #define OSPF_STUB_ROUTER_ADMINISTRATIVE_SET 1 @@ -187,8 +185,6 @@ struct ospf { spf_hold_multiplier; /* Adaptive multiplier for hold time */ int default_originate; /* Default information originate. */ - /* $FRR indent$ */ - /* clang-format off */ #define DEFAULT_ORIGINATE_NONE 0 #define DEFAULT_ORIGINATE_ZEBRA 1 #define DEFAULT_ORIGINATE_ALWAYS 2 @@ -343,8 +339,6 @@ struct ospf_area { int external_routing; /* ExternalRoutingCapability. */ int no_summary; /* Don't inject summaries into stub.*/ int shortcut_configured; /* Area configured as shortcut. */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_SHORTCUT_DEFAULT 0 #define OSPF_SHORTCUT_ENABLE 1 #define OSPF_SHORTCUT_DISABLE 2 @@ -354,21 +348,15 @@ struct ospf_area { u_char NSSATranslatorRole; /* NSSA configured role */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_NSSA_ROLE_NEVER 0 #define OSPF_NSSA_ROLE_CANDIDATE 1 #define OSPF_NSSA_ROLE_ALWAYS 2 u_char NSSATranslatorState; /* NSSA operational role */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_NSSA_TRANSLATE_DISABLED 0 #define OSPF_NSSA_TRANSLATE_ENABLED 1 int NSSATranslatorStabilityInterval; u_char transit; /* TransitCapability. */ - /* $FRR indent$ */ - /* clang-format off */ #define OSPF_TRANSIT_FALSE 0 #define OSPF_TRANSIT_TRUE 1 struct route_table *ranges; /* Configured Area Ranges. */ |