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 /ospf6d | |
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 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_abr.c | 25 | ||||
-rw-r--r-- | ospf6d/ospf6_area.c | 11 | ||||
-rw-r--r-- | ospf6d/ospf6_asbr.c | 293 | ||||
-rw-r--r-- | ospf6d/ospf6_flood.c | 39 | ||||
-rw-r--r-- | ospf6d/ospf6_interface.c | 44 | ||||
-rw-r--r-- | ospf6d/ospf6_intra.c | 117 | ||||
-rw-r--r-- | ospf6d/ospf6_intra.h | 8 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.c | 12 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.h | 4 | ||||
-rw-r--r-- | ospf6d/ospf6_lsdb.c | 3 | ||||
-rw-r--r-- | ospf6d/ospf6_message.c | 58 | ||||
-rw-r--r-- | ospf6d/ospf6_neighbor.c | 4 | ||||
-rw-r--r-- | ospf6d/ospf6_route.c | 30 | ||||
-rw-r--r-- | ospf6d/ospf6_snmp.c | 10 | ||||
-rw-r--r-- | ospf6d/ospf6_spf.c | 59 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 14 | ||||
-rw-r--r-- | ospf6d/ospf6d.c | 4 |
17 files changed, 371 insertions, 364 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 884761149..67d18566a 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -390,10 +390,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (prefix_list_apply(PREFIX_LIST_OUT(area), &route->prefix) != PREFIX_PERMIT) { if (is_debug) { - inet_ntop(AF_INET, - &(ADV_ROUTER_IN_PREFIX( - &route->prefix)), - buf, sizeof(buf)); + inet_ntop( + AF_INET, + &(ADV_ROUTER_IN_PREFIX(&route->prefix)), + buf, sizeof(buf)); zlog_debug( "prefix %s was denied by filter-list out", buf); @@ -870,8 +870,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (prefix_list_apply(PREFIX_LIST_IN(oa), &prefix) != PREFIX_PERMIT) { if (is_debug) - zlog_debug( - "Prefix was denied by prefix-list"); + zlog_debug("Prefix was denied by prefix-list"); if (old) ospf6_route_remove(old, table); return; @@ -914,8 +913,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("%s: Update route: %s nh count %u", - __PRETTY_FUNCTION__, - buf, listcount(route->nh_list)); + __PRETTY_FUNCTION__, buf, + listcount(route->nh_list)); /* Update RIB/FIB */ if (table->hook_add) @@ -925,8 +924,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) ospf6_route_delete(route); } else { if (is_debug) - zlog_debug("Install route: %s nh count %u", - buf, listcount(route->nh_list)); + zlog_debug("Install route: %s nh count %u", buf, + listcount(route->nh_list)); /* ospf6_ia_add_nw_route (table, &prefix, route); */ ospf6_route_add(route, table); } @@ -1123,8 +1122,7 @@ struct ospf6_lsa_handler inter_prefix_handler = { .lh_short_name = "IAP", .lh_show = ospf6_inter_area_prefix_lsa_show, .lh_get_prefix_str = ospf6_inter_area_prefix_lsa_get_prefix_str, - .lh_debug = 0 -}; + .lh_debug = 0}; struct ospf6_lsa_handler inter_router_handler = { .lh_type = OSPF6_LSTYPE_INTER_ROUTER, @@ -1132,8 +1130,7 @@ struct ospf6_lsa_handler inter_router_handler = { .lh_short_name = "IAR", .lh_show = ospf6_inter_area_router_lsa_show, .lh_get_prefix_str = ospf6_inter_area_router_lsa_get_prefix_str, - .lh_debug = 0 -}; + .lh_debug = 0}; void ospf6_abr_init(void) { diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index ed624c6ae..0a7280603 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -61,7 +61,8 @@ static void ospf6_area_lsdb_hook_add(struct ospf6_lsa *lsa) case OSPF6_LSTYPE_ROUTER: case OSPF6_LSTYPE_NETWORK: if (IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa->header->type)) { - zlog_debug("%s Examin LSA %s", __PRETTY_FUNCTION__, lsa->name); + zlog_debug("%s Examin LSA %s", __PRETTY_FUNCTION__, + lsa->name); zlog_debug(" Schedule SPF Calculation for %s", OSPF6_AREA(lsa->lsdb->data)->name); } @@ -587,14 +588,14 @@ DEFUN (area_filter_list, if (strmatch(inout, "in")) { PREFIX_LIST_IN(area) = plist; XFREE(MTYPE_OSPF6_PLISTNAME, PREFIX_NAME_IN(area)); - PREFIX_NAME_IN(area) = XSTRDUP(MTYPE_OSPF6_PLISTNAME, - plistname); + PREFIX_NAME_IN(area) = + XSTRDUP(MTYPE_OSPF6_PLISTNAME, plistname); ospf6_abr_reimport(area); } else { PREFIX_LIST_OUT(area) = plist; XFREE(MTYPE_OSPF6_PLISTNAME, PREFIX_NAME_OUT(area)); - PREFIX_NAME_OUT(area) = XSTRDUP(MTYPE_OSPF6_PLISTNAME, - plistname); + PREFIX_NAME_OUT(area) = + XSTRDUP(MTYPE_OSPF6_PLISTNAME, plistname); ospf6_abr_enable_area(area); } diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index b52f1cef6..c23fe99bc 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -164,9 +164,10 @@ int ospf6_orig_as_external_lsa(struct thread *thread) adv_router = oi->area->ospf6->router_id; for (ALL_LSDB_TYPED_ADVRTR(ospf6->lsdb, type, adv_router, lsa)) { if (IS_OSPF6_DEBUG_ASBR) - zlog_debug("%s: Send update of AS-External LSA %s seq 0x%x", - __PRETTY_FUNCTION__, lsa->name, - ntohl(lsa->header->seqnum)); + zlog_debug( + "%s: Send update of AS-External LSA %s seq 0x%x", + __PRETTY_FUNCTION__, lsa->name, + ntohl(lsa->header->seqnum)); ospf6_flood_interface(NULL, lsa, oi); } @@ -216,34 +217,36 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, for (old_route = old; old_route; old_route = old_route->next) { bool route_updated = false; - if (!ospf6_route_is_same(old_route, route) || - (old_route->path.type != route->path.type)) + if (!ospf6_route_is_same(old_route, route) + || (old_route->path.type != route->path.type)) continue; /* Current and New route has same origin, * delete old entry. */ for (ALL_LIST_ELEMENTS(old_route->paths, anode, anext, - o_path)) { + o_path)) { /* Check old route path and route has same * origin. */ - if (o_path->area_id != route->path.area_id || - (memcmp(&(o_path)->origin, &(route)->path.origin, - sizeof(struct ospf6_ls_origin)) != 0)) + if (o_path->area_id != route->path.area_id + || (memcmp(&(o_path)->origin, &(route)->path.origin, + sizeof(struct ospf6_ls_origin)) + != 0)) continue; /* Cost is not same then delete current path */ - if ((o_path->cost == route->path.cost) && - (o_path->u.cost_e2 == route->path.u.cost_e2)) + if ((o_path->cost == route->path.cost) + && (o_path->u.cost_e2 == route->path.u.cost_e2)) continue; if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&old_route->prefix, buf, sizeof(buf)); - zlog_debug("%s: route %s cost old %u new %u is not same, replace route", - __PRETTY_FUNCTION__, buf, - o_path->cost, route->path.cost); + zlog_debug( + "%s: route %s cost old %u new %u is not same, replace route", + __PRETTY_FUNCTION__, buf, o_path->cost, + route->path.cost); } /* Remove selected current rout path's nh from @@ -251,11 +254,11 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, */ for (ALL_LIST_ELEMENTS_RO(o_path->nh_list, nnode, nh)) { for (ALL_LIST_ELEMENTS(old_route->nh_list, - rnode, rnext, rnh)) { + rnode, rnext, rnh)) { if (!ospf6_nexthop_is_same(rnh, nh)) continue; listnode_delete(old_route->nh_list, - rnh); + rnh); ospf6_nexthop_delete(rnh); route_updated = true; } @@ -270,14 +273,16 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, * Update FIB with effective NHs. */ if (listcount(old_route->paths)) { - if (old_route->path.origin.id == - route->path.origin.id && - old_route->path.origin.adv_router == - route->path.origin.adv_router) { + if (old_route->path.origin.id + == route->path.origin.id + && old_route->path.origin.adv_router + == route->path.origin + .adv_router) { struct ospf6_path *h_path; h_path = (struct ospf6_path *) - listgetdata(listhead(old_route->paths)); + listgetdata(listhead( + old_route->paths)); old_route->path.origin.type = h_path->origin.type; old_route->path.origin.id = @@ -288,7 +293,8 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, if (route_updated) { for (ALL_LIST_ELEMENTS(old_route->paths, - anode, anext, o_path)) { + anode, anext, + o_path)) { ospf6_merge_nexthops( old_route->nh_list, o_path->nh_list); @@ -297,18 +303,19 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, * nh_list */ if (ospf6->route_table->hook_add) - (*ospf6->route_table->hook_add) - (old_route); + (*ospf6->route_table->hook_add)( + old_route); break; } } else { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&old_route->prefix, buf, sizeof(buf)); - zlog_debug("%s: route %s old cost %u new cost %u, delete old entry.", - __PRETTY_FUNCTION__, buf, - old_route->path.cost, - route->path.cost); + zlog_debug( + "%s: route %s old cost %u new cost %u, delete old entry.", + __PRETTY_FUNCTION__, buf, + old_route->path.cost, + route->path.cost); } ospf6_route_remove(old_route, ospf6->route_table); @@ -325,21 +332,22 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, /* Current and New Route prefix or route type * is not same skip this current node. */ - if (!ospf6_route_is_same(old_route, route) || - (old_route->path.type != route->path.type)) + if (!ospf6_route_is_same(old_route, route) + || (old_route->path.type != route->path.type)) continue; /* Old Route and New Route have Equal Cost, Merge NHs */ - if ((old_route->path.cost == route->path.cost) && - (old_route->path.u.cost_e2 == route->path.u.cost_e2)) { + if ((old_route->path.cost == route->path.cost) + && (old_route->path.u.cost_e2 == route->path.u.cost_e2)) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&old_route->prefix, buf, sizeof(buf)); - zlog_debug("%s: old route %s path cost %u e2 %u", - __PRETTY_FUNCTION__, buf, - old_route->path.cost, - old_route->path.u.cost_e2); + zlog_debug( + "%s: old route %s path cost %u e2 %u", + __PRETTY_FUNCTION__, buf, + old_route->path.cost, + old_route->path.u.cost_e2); } route_found = true; /* check if this path exists already in @@ -348,10 +356,11 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, */ for (ALL_LIST_ELEMENTS_RO(old_route->paths, anode, o_path)) { - if (o_path->area_id == route->path.area_id && - (memcmp(&(o_path)->origin, - &(route)->path.origin, - sizeof(struct ospf6_ls_origin)) == 0)) + if (o_path->area_id == route->path.area_id + && (memcmp(&(o_path)->origin, + &(route)->path.origin, + sizeof(struct ospf6_ls_origin)) + == 0)) break; } /* If path is not found in old_route paths's list, @@ -370,8 +379,8 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, /* Update RIB/FIB */ if (ospf6->route_table->hook_add) - (*ospf6->route_table->hook_add) - (old_route); + (*ospf6->route_table->hook_add)( + old_route); /* Add the new path to route's path list */ listnode_add_sort(old_route->paths, ecmp_path); @@ -379,20 +388,23 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug("%s: route %s another path added with nh %u, effective paths %u nh %u", + zlog_debug( + "%s: route %s another path added with nh %u, effective paths %u nh %u", __PRETTY_FUNCTION__, buf, listcount(ecmp_path->nh_list), - old_route->paths ? - listcount(old_route->paths) - : 0, + old_route->paths + ? listcount( + old_route + ->paths) + : 0, listcount(old_route->nh_list)); } } else { for (ALL_LIST_ELEMENTS_RO(o_path->nh_list, nnode, nh)) { for (ALL_LIST_ELEMENTS( - old_route->nh_list, - rnode, rnext, rnh)) { + old_route->nh_list, rnode, + rnext, rnh)) { if (!ospf6_nexthop_is_same(rnh, nh)) continue; @@ -405,27 +417,28 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, } list_delete_all_node(o_path->nh_list); ospf6_copy_nexthops(o_path->nh_list, - route->nh_list); + route->nh_list); /* Merge nexthop to existing route's nh_list */ - ospf6_route_merge_nexthops(old_route, - route); + ospf6_route_merge_nexthops(old_route, route); if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { - prefix2str(&route->prefix, - buf, sizeof(buf)); - zlog_debug("%s: existing route %s with effective nh count %u", - __PRETTY_FUNCTION__, buf, - old_route->nh_list ? - listcount(old_route->nh_list) - : 0); + prefix2str(&route->prefix, buf, + sizeof(buf)); + zlog_debug( + "%s: existing route %s with effective nh count %u", + __PRETTY_FUNCTION__, buf, + old_route->nh_list + ? listcount( + old_route + ->nh_list) + : 0); } /* Update RIB/FIB */ if (ospf6->route_table->hook_add) - (*ospf6->route_table->hook_add) - (old_route); - + (*ospf6->route_table->hook_add)( + old_route); } /* Delete the new route its info added to existing * route. @@ -524,9 +537,9 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) prefix2str(&route->prefix, buf, sizeof(buf)); zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u", __PRETTY_FUNCTION__, - (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) - ? 1 : 2, buf, route->path.cost, - route->path.u.cost_e2, + (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 + : 2, + buf, route->path.cost, route->path.u.cost_e2, listcount(route->nh_list)); } @@ -542,7 +555,6 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) */ ospf6_asbr_update_route_ecmp_path(old, route); } - } void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, @@ -587,9 +599,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, } else { route_to_del->path.type = OSPF6_PATH_TYPE_EXTERNAL1; route_to_del->path.metric_type = 1; - route_to_del->path.cost = - asbr_entry->path.cost + - OSPF6_ASBR_METRIC(external); + route_to_del->path.cost = asbr_entry->path.cost + + OSPF6_ASBR_METRIC(external); route_to_del->path.u.cost_e2 = 0; } } @@ -610,15 +621,15 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&prefix, buf, sizeof(buf)); - zlog_debug("%s: Current route %s cost %u e2 %u, route to del cost %u e2 %u", - __PRETTY_FUNCTION__, buf, route->path.cost, - route->path.u.cost_e2, - route_to_del->path.cost, - route_to_del->path.u.cost_e2); + zlog_debug( + "%s: Current route %s cost %u e2 %u, route to del cost %u e2 %u", + __PRETTY_FUNCTION__, buf, route->path.cost, + route->path.u.cost_e2, route_to_del->path.cost, + route_to_del->path.u.cost_e2); } - for (ospf6_route_lock(route); route && - ospf6_route_is_prefix(&prefix, route); route = nroute) { + for (ospf6_route_lock(route); + route && ospf6_route_is_prefix(&prefix, route); route = nroute) { nroute = ospf6_route_next(route); if (route->type != OSPF6_DEST_TYPE_NETWORK) @@ -640,34 +651,36 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, * replace from paths list. */ for (ALL_LIST_ELEMENTS(route->paths, anode, anext, - o_path)) { + o_path)) { if ((o_path->origin.type != lsa->header->type) - || (o_path->origin.adv_router != - lsa->header->adv_router) || - (o_path->origin.id != lsa->header->id)) + || (o_path->origin.adv_router + != lsa->header->adv_router) + || (o_path->origin.id != lsa->header->id)) continue; /* Compare LSA cost with current * route info. */ - if (!asbr_entry && (o_path->cost != - route_to_del->path.cost || - o_path->u.cost_e2 != - route_to_del->path.u.cost_e2)) { + if (!asbr_entry + && (o_path->cost != route_to_del->path.cost + || o_path->u.cost_e2 + != route_to_del->path.u + .cost_e2)) { if (IS_OSPF6_DEBUG_EXAMIN( - AS_EXTERNAL)) { + AS_EXTERNAL)) { prefix2str(&prefix, buf, sizeof(buf)); zlog_debug( - "%s: route %s to delete is not same, cost %u del cost %u. skip", - __PRETTY_FUNCTION__, buf, - route->path.cost, - route_to_del->path.cost); + "%s: route %s to delete is not same, cost %u del cost %u. skip", + __PRETTY_FUNCTION__, + buf, route->path.cost, + route_to_del->path + .cost); } continue; } - if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { + if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&prefix, buf, sizeof(buf)); zlog_debug( "%s: route %s path found with nh %u to remove.", @@ -681,9 +694,10 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, for (ALL_LIST_ELEMENTS_RO(o_path->nh_list, nnode, nh)) { for (ALL_LIST_ELEMENTS(route->nh_list, - rnode, rnext, rnh)) { + rnode, rnext, + rnh)) { if (!ospf6_nexthop_is_same(rnh, - nh)) + nh)) continue; listnode_delete(route->nh_list, rnh); @@ -711,13 +725,15 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug("%s: AS-External %u route %s update paths %u nh %u" - , __PRETTY_FUNCTION__, - (route->path.type == - OSPF6_PATH_TYPE_EXTERNAL1) - ? 1 : 2, buf, - listcount(route->paths), - listcount(route->nh_list)); + zlog_debug( + "%s: AS-External %u route %s update paths %u nh %u", + __PRETTY_FUNCTION__, + (route->path.type + == OSPF6_PATH_TYPE_EXTERNAL1) + ? 1 + : 2, + buf, listcount(route->paths), + listcount(route->nh_list)); } /* Update RIB/FIB with effective nh_list */ @@ -728,13 +744,14 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, * replace route's primary path with * route's paths list head. */ - if (route->path.origin.id == lsa->header->id && - route->path.origin.adv_router == - lsa->header->adv_router) { + if (route->path.origin.id == lsa->header->id + && route->path.origin.adv_router + == lsa->header->adv_router) { struct ospf6_path *h_path; h_path = (struct ospf6_path *) - listgetdata(listhead(route->paths)); + listgetdata( + listhead(route->paths)); route->path.origin.type = h_path->origin.type; route->path.origin.id = @@ -749,36 +766,39 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, /* Compare LSA origin and cost with current route info. * if any check fails skip del this route node. */ - if (asbr_entry && (!ospf6_route_is_same_origin(route, - route_to_del) || - (route->path.type != route_to_del->path.type) || - (route->path.cost != route_to_del->path.cost) || - (route->path.u.cost_e2 != - route_to_del->path.u.cost_e2))) { + if (asbr_entry + && (!ospf6_route_is_same_origin(route, route_to_del) + || (route->path.type != route_to_del->path.type) + || (route->path.cost != route_to_del->path.cost) + || (route->path.u.cost_e2 + != route_to_del->path.u.cost_e2))) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&prefix, buf, sizeof(buf)); - zlog_debug("%s: route %s to delete is not same, cost %u del cost %u. skip", - __PRETTY_FUNCTION__, buf, - route->path.cost, - route_to_del->path.cost); + zlog_debug( + "%s: route %s to delete is not same, cost %u del cost %u. skip", + __PRETTY_FUNCTION__, buf, + route->path.cost, + route_to_del->path.cost); } continue; } - if ((route->path.origin.type != lsa->header->type) || - (route->path.origin.adv_router != - lsa->header->adv_router) || - (route->path.origin.id != lsa->header->id)) + if ((route->path.origin.type != lsa->header->type) + || (route->path.origin.adv_router + != lsa->header->adv_router) + || (route->path.origin.id != lsa->header->id)) continue; } if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug("%s: AS-External %u route remove %s cost %u(%u) nh %u", - __PRETTY_FUNCTION__, - route->path.type == OSPF6_PATH_TYPE_EXTERNAL1 - ? 1 : 2, buf, route->path.cost, - route->path.u.cost_e2, - listcount(route->nh_list)); + zlog_debug( + "%s: AS-External %u route remove %s cost %u(%u) nh %u", + __PRETTY_FUNCTION__, + route->path.type == OSPF6_PATH_TYPE_EXTERNAL1 + ? 1 + : 2, + buf, route->path.cost, route->path.u.cost_e2, + listcount(route->nh_list)); } ospf6_route_remove(route, ospf6->route_table); } @@ -852,8 +872,8 @@ static int ospf6_asbr_routemap_update_timer(struct thread *thread) ospf6->t_distribute_update = NULL; if (ospf6->rmap[arg_type].name) - ospf6->rmap[arg_type].map = route_map_lookup_by_name( - ospf6->rmap[arg_type].name); + ospf6->rmap[arg_type].map = + route_map_lookup_by_name(ospf6->rmap[arg_type].name); if (ospf6->rmap[arg_type].map) { if (IS_OSPF6_DEBUG_ASBR) zlog_debug("%s: route-map %s update, reset redist %s", @@ -876,7 +896,7 @@ void ospf6_asbr_distribute_list_update(int type) if (ospf6->t_distribute_update) return; - args = XCALLOC(MTYPE_OSPF6_DIST_ARGS, sizeof(void *)*2); + args = XCALLOC(MTYPE_OSPF6_DIST_ARGS, sizeof(void *) * 2); args[0] = ospf6; args[1] = (void *)((ptrdiff_t)type); @@ -903,12 +923,13 @@ static void ospf6_asbr_routemap_update(const char *mapname) ospf6->rmap[type].map = route_map_lookup_by_name( ospf6->rmap[type].name); - if (mapname && ospf6->rmap[type].map && - (strcmp(ospf6->rmap[type].name, mapname) == 0)) { + if (mapname && ospf6->rmap[type].map + && (strcmp(ospf6->rmap[type].name, mapname) == 0)) { if (IS_OSPF6_DEBUG_ASBR) - zlog_debug("%s: route-map %s update, reset redist %s", - __PRETTY_FUNCTION__, mapname, - ZROUTE_NAME(type)); + zlog_debug( + "%s: route-map %s update, reset redist %s", + __PRETTY_FUNCTION__, mapname, + ZROUTE_NAME(type)); ospf6_asbr_distribute_list_update(type); } } else @@ -923,8 +944,8 @@ static void ospf6_asbr_routemap_event(route_map_event_t event, const char *name) if (ospf6 == NULL) return; for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { - if ((ospf6->rmap[type].name) && - (strcmp(ospf6->rmap[type].name, name) == 0)) { + if ((ospf6->rmap[type].name) + && (strcmp(ospf6->rmap[type].name, name) == 0)) { ospf6_asbr_distribute_list_update(type); } } @@ -1064,8 +1085,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf)); prefix2str(prefix, pbuf, sizeof(pbuf)); - zlog_debug("Advertise as AS-External Id:%s prefix %s metric %u", - ibuf, pbuf, match->path.metric_type); + zlog_debug( + "Advertise as AS-External Id:%s prefix %s metric %u", + ibuf, pbuf, match->path.metric_type); } match->path.origin.id = htonl(info->id); @@ -1797,8 +1819,7 @@ struct ospf6_lsa_handler as_external_handler = { .lh_short_name = "ASE", .lh_show = ospf6_as_external_lsa_show, .lh_get_prefix_str = ospf6_as_external_lsa_get_prefix_str, - .lh_debug = 0 -}; + .lh_debug = 0}; void ospf6_asbr_init(void) { diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 17733d609..dae10dce0 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -237,8 +237,7 @@ void ospf6_install_lsa(struct ospf6_lsa *lsa) || IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa->header->type)) zlog_debug("%s Install LSA: %s age %d seqnum %x in LSDB.", __PRETTY_FUNCTION__, lsa->name, - ntohs(lsa->header->age), - ntohl(lsa->header->seqnum)); + ntohs(lsa->header->age), ntohl(lsa->header->seqnum)); /* actually install */ lsa->installed = now; @@ -249,9 +248,8 @@ void ospf6_install_lsa(struct ospf6_lsa *lsa) /* RFC2740 section 3.5.2. Sending Link State Update packets */ /* RFC2328 section 13.3 Next step in the flooding procedure */ -void ospf6_flood_interface(struct ospf6_neighbor *from, - struct ospf6_lsa *lsa, - struct ospf6_interface *oi) +void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, + struct ospf6_interface *oi) { struct listnode *node, *nnode; struct ospf6_neighbor *on; @@ -348,9 +346,10 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, if (ospf6->inst_shutdown) { if (is_debug) - zlog_debug("%s: Send LSA %s (age %d) update now", - __PRETTY_FUNCTION__, lsa->name, - ntohs(lsa->header->age)); + zlog_debug( + "%s: Send LSA %s (age %d) update now", + __PRETTY_FUNCTION__, lsa->name, + ntohs(lsa->header->age)); ospf6_lsupdate_send_neighbor_now(on, lsa); continue; } else { @@ -818,15 +817,16 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, zlog_debug("Received is duplicated LSA"); SET_FLAG(new->flag, OSPF6_LSA_DUPLICATE); } - if (old->header->adv_router == - from->ospf6_if->area->ospf6->router_id + if (old->header->adv_router + == from->ospf6_if->area->ospf6->router_id && OSPF6_LSA_IS_MAXAGE(new)) { ospf6_acknowledge_lsa(new, ismore_recent, from); ospf6_lsa_delete(new); if (is_debug) - zlog_debug("%s: Received is self orig MAXAGE LSA %s, discard (ismore_recent %d)", - __PRETTY_FUNCTION__, old->name, - ismore_recent); + zlog_debug( + "%s: Received is self orig MAXAGE LSA %s, discard (ismore_recent %d)", + __PRETTY_FUNCTION__, old->name, + ismore_recent); return; } } @@ -985,18 +985,17 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, /* Neighbor router sent recent age for LSA, * Router could be restarted while current copy is * MAXAGEd and not removed.*/ - if (OSPF6_LSA_IS_MAXAGE(old) && - !OSPF6_LSA_IS_MAXAGE(new)) { + if (OSPF6_LSA_IS_MAXAGE(old) + && !OSPF6_LSA_IS_MAXAGE(new)) { if (is_debug) - zlog_debug("%s: Current copy of LSA %s is MAXAGE, but new has recent Age.", - old->name, - __PRETTY_FUNCTION__); + zlog_debug( + "%s: Current copy of LSA %s is MAXAGE, but new has recent Age.", + old->name, __PRETTY_FUNCTION__); ospf6_lsa_purge(old); if (new->header->adv_router - != from->ospf6_if->area-> - ospf6->router_id) + != from->ospf6_if->area->ospf6->router_id) ospf6_flood(from, new); ospf6_install_lsa(new); diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 5eaf61770..852429221 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -125,7 +125,7 @@ static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi) bw = oi->interface->speed; } else { bw = oi->interface->bandwidth ? oi->interface->bandwidth - : OSPF6_INTERFACE_BANDWIDTH; + : OSPF6_INTERFACE_BANDWIDTH; } refbw = ospf6 ? ospf6->ref_bandwidth : OSPF6_REFERENCE_BANDWIDTH; @@ -1010,8 +1010,7 @@ DEFUN (show_ipv6_ospf6_interface, return CMD_SUCCESS; } -static int ospf6_interface_show_traffic(struct vty *vty, - uint32_t vrf_id, +static int ospf6_interface_show_traffic(struct vty *vty, uint32_t vrf_id, struct interface *intf_ifp, int display_once) { @@ -1023,13 +1022,14 @@ static int ospf6_interface_show_traffic(struct vty *vty, if (!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"); } if (intf_ifp == NULL) { @@ -1040,13 +1040,11 @@ static int ospf6_interface_show_traffic(struct vty *vty, continue; vty_out(vty, - "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", + "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", oi->interface->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); + 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); } } else { oi = intf_ifp->info; @@ -1055,11 +1053,9 @@ static int ospf6_interface_show_traffic(struct vty *vty, vty_out(vty, "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", - oi->interface->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->interface->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); } @@ -1086,9 +1082,7 @@ DEFUN (show_ipv6_ospf6_interface_traffic, intf_name = argv[idx_ifname]->arg; ifp = if_lookup_by_name(intf_name, VRF_DEFAULT); if (ifp == NULL) { - vty_out(vty, - "No such Interface: %s\n", - intf_name); + vty_out(vty, "No such Interface: %s\n", intf_name); return CMD_WARNING; } if (ifp->info == NULL) { @@ -1099,8 +1093,7 @@ DEFUN (show_ipv6_ospf6_interface_traffic, } } - ospf6_interface_show_traffic(vty, VRF_DEFAULT, ifp, - display_once); + ospf6_interface_show_traffic(vty, VRF_DEFAULT, ifp, display_once); return CMD_SUCCESS; @@ -1940,8 +1933,7 @@ void ospf6_interface_init(void) install_element(VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd); install_element(VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); - install_element(VIEW_NODE, - &show_ipv6_ospf6_interface_traffic_cmd); + install_element(VIEW_NODE, &show_ipv6_ospf6_interface_traffic_cmd); install_element(INTERFACE_NODE, &ipv6_ospf6_cost_cmd); install_element(INTERFACE_NODE, &no_ipv6_ospf6_cost_cmd); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 77653ea33..14f12d6b6 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -215,7 +215,8 @@ int ospf6_router_lsa_originate(struct thread *thread) ospf6_router_lsa_options_set(oa, router_lsa); /* describe links for each interfaces */ - lsdesc = (struct ospf6_router_lsdesc *)((caddr_t)router_lsa + lsdesc = (struct ospf6_router_lsdesc + *)((caddr_t)router_lsa + sizeof(struct ospf6_router_lsa)); for (ALL_LIST_ELEMENTS(oa->if_list, node, nnode, oi)) { @@ -253,10 +254,9 @@ int ospf6_router_lsa_originate(struct thread *thread) lsa_header->type = htons(OSPF6_LSTYPE_ROUTER); lsa_header->id = htonl(link_state_id); lsa_header->adv_router = oa->ospf6->router_id; - lsa_header->seqnum = - ospf6_new_ls_seqnum(lsa_header->type, - lsa_header->id, - lsa_header->adv_router, oa->lsdb); + lsa_header->seqnum = ospf6_new_ls_seqnum( + lsa_header->type, lsa_header->id, + lsa_header->adv_router, oa->lsdb); lsa_header->length = htons((caddr_t)lsdesc - (caddr_t)buffer); @@ -273,15 +273,16 @@ int ospf6_router_lsa_originate(struct thread *thread) memset(buffer, 0, sizeof(buffer)); lsa_header = (struct ospf6_lsa_header *)buffer; router_lsa = - (struct ospf6_router_lsa *)((caddr_t)lsa_header + (struct ospf6_router_lsa + *)((caddr_t)lsa_header + sizeof(struct ospf6_lsa_header)); ospf6_router_lsa_options_set(oa, router_lsa); /* describe links for each interfaces */ - lsdesc = (struct ospf6_router_lsdesc *) - ((caddr_t)router_lsa + - sizeof(struct ospf6_router_lsa)); + lsdesc = (struct ospf6_router_lsdesc + *)((caddr_t)router_lsa + + sizeof(struct ospf6_router_lsa)); link_state_id++; } @@ -922,16 +923,15 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) ospf6_lsa_purge(old); /* find previous LSA */ old_next = ospf6_lsdb_lookup( - htons(OSPF6_LSTYPE_INTRA_PREFIX), - htonl(++ls_id), - oa->ospf6->router_id, oa->lsdb); + htons(OSPF6_LSTYPE_INTRA_PREFIX), + htonl(++ls_id), oa->ospf6->router_id, oa->lsdb); while (old_next) { ospf6_lsa_purge(old_next); old_next = ospf6_lsdb_lookup( htons(OSPF6_LSTYPE_INTRA_PREFIX), - htonl(++ls_id), - oa->ospf6->router_id, oa->lsdb); + htonl(++ls_id), oa->ospf6->router_id, + oa->lsdb); } } return 0; @@ -945,7 +945,8 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) /* prepare buffer */ memset(buffer, 0, sizeof(buffer)); lsa_header = (struct ospf6_lsa_header *)buffer; - intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)((caddr_t)lsa_header + intra_prefix_lsa = (struct ospf6_intra_prefix_lsa + *)((caddr_t)lsa_header + sizeof(struct ospf6_lsa_header)); /* Fill Intra-Area-Prefix-LSA */ @@ -999,16 +1000,15 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) ospf6_lsa_purge(old); /* find previous LSA */ old_next = ospf6_lsdb_lookup( - htons(OSPF6_LSTYPE_INTRA_PREFIX), - htonl(++ls_id), - oa->ospf6->router_id, oa->lsdb); + htons(OSPF6_LSTYPE_INTRA_PREFIX), + htonl(++ls_id), oa->ospf6->router_id, oa->lsdb); while (old_next) { ospf6_lsa_purge(old_next); old_next = ospf6_lsdb_lookup( htons(OSPF6_LSTYPE_INTRA_PREFIX), - htonl(++ls_id), - oa->ospf6->router_id, oa->lsdb); + htonl(++ls_id), oa->ospf6->router_id, + oa->lsdb); } } ospf6_route_table_delete(route_advertise); @@ -1030,13 +1030,11 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) lsa_header->type = htons(OSPF6_LSTYPE_INTRA_PREFIX); lsa_header->id = htonl(ls_id++); lsa_header->adv_router = oa->ospf6->router_id; - lsa_header->seqnum = - ospf6_new_ls_seqnum(lsa_header->type, - lsa_header->id, - lsa_header->adv_router, - oa->lsdb); - lsa_header->length = htons((caddr_t)op - - (caddr_t)lsa_header); + lsa_header->seqnum = ospf6_new_ls_seqnum( + lsa_header->type, lsa_header->id, + lsa_header->adv_router, oa->lsdb); + lsa_header->length = + htons((caddr_t)op - (caddr_t)lsa_header); /* LSA checksum */ ospf6_lsa_checksum(lsa_header); @@ -1050,9 +1048,10 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) /* Prepare next buffer */ memset(buffer, 0, sizeof(buffer)); lsa_header = (struct ospf6_lsa_header *)buffer; - intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *) - ((caddr_t)lsa_header - + sizeof(struct ospf6_lsa_header)); + intra_prefix_lsa = + (struct ospf6_intra_prefix_lsa + *)((caddr_t)lsa_header + + sizeof(struct ospf6_lsa_header)); /* Fill Intra-Area-Prefix-LSA */ intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_ROUTER); @@ -1061,8 +1060,10 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) /* Put next set of prefixes to advertise */ prefix_num = 0; - op = (struct ospf6_prefix *)((caddr_t)intra_prefix_lsa - + sizeof(struct ospf6_intra_prefix_lsa)); + op = (struct ospf6_prefix + *)((caddr_t)intra_prefix_lsa + + sizeof(struct + ospf6_intra_prefix_lsa)); } op->prefix_length = route->prefix.prefixlen; @@ -1740,32 +1741,29 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) oa->name); } -struct ospf6_lsa_handler router_handler = { - .lh_type = OSPF6_LSTYPE_ROUTER, - .lh_name = "Router", - .lh_short_name = "Rtr", - .lh_show = ospf6_router_lsa_show, - .lh_get_prefix_str = ospf6_router_lsa_get_nbr_id, - .lh_debug = 0 -}; - -struct ospf6_lsa_handler network_handler = { - .lh_type = OSPF6_LSTYPE_NETWORK, - .lh_name = "Network", - .lh_short_name = "Net", - .lh_show = ospf6_network_lsa_show, - .lh_get_prefix_str = ospf6_network_lsa_get_ar_id, - .lh_debug = 0 -}; - -struct ospf6_lsa_handler link_handler = { - .lh_type = OSPF6_LSTYPE_LINK, - .lh_name = "Link", - .lh_short_name = "Lnk", - .lh_show = ospf6_link_lsa_show, - .lh_get_prefix_str = ospf6_link_lsa_get_prefix_str, - .lh_debug = 0 -}; +struct ospf6_lsa_handler router_handler = {.lh_type = OSPF6_LSTYPE_ROUTER, + .lh_name = "Router", + .lh_short_name = "Rtr", + .lh_show = ospf6_router_lsa_show, + .lh_get_prefix_str = + ospf6_router_lsa_get_nbr_id, + .lh_debug = 0}; + +struct ospf6_lsa_handler network_handler = {.lh_type = OSPF6_LSTYPE_NETWORK, + .lh_name = "Network", + .lh_short_name = "Net", + .lh_show = ospf6_network_lsa_show, + .lh_get_prefix_str = + ospf6_network_lsa_get_ar_id, + .lh_debug = 0}; + +struct ospf6_lsa_handler link_handler = {.lh_type = OSPF6_LSTYPE_LINK, + .lh_name = "Link", + .lh_short_name = "Lnk", + .lh_show = ospf6_link_lsa_show, + .lh_get_prefix_str = + ospf6_link_lsa_get_prefix_str, + .lh_debug = 0}; struct ospf6_lsa_handler intra_prefix_handler = { .lh_type = OSPF6_LSTYPE_INTRA_PREFIX, @@ -1773,8 +1771,7 @@ struct ospf6_lsa_handler intra_prefix_handler = { .lh_short_name = "INP", .lh_show = ospf6_intra_prefix_lsa_show, .lh_get_prefix_str = ospf6_intra_prefix_lsa_get_prefix_str, - .lh_debug = 0 -}; + .lh_debug = 0}; void ospf6_intra_init(void) { diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 2ae17f070..07f0f124e 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -185,13 +185,11 @@ struct ospf6_intra_prefix_lsa { 0, &(oi)->thread_intra_prefix_lsa); \ } while (0) -#define OSPF6_AS_EXTERN_LSA_SCHEDULE(oi) \ +#define OSPF6_AS_EXTERN_LSA_SCHEDULE(oi) \ do { \ if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \ - thread_add_event( \ - master, \ - ospf6_orig_as_external_lsa, oi, \ - 0, &(oi)->thread_as_extern_lsa); \ + thread_add_event(master, ospf6_orig_as_external_lsa, \ + oi, 0, &(oi)->thread_as_extern_lsa); \ } while (0) #define OSPF6_NETWORK_LSA_EXECUTE(oi) \ diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 4a1ba992e..e060879f4 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -518,9 +518,8 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header) lsa_size = ntohs(header->length); /* XXX vulnerable */ /* allocate memory for this LSA */ - new_header = - (struct ospf6_lsa_header *)XMALLOC(MTYPE_OSPF6_LSA_HEADER, - lsa_size); + new_header = (struct ospf6_lsa_header *)XMALLOC(MTYPE_OSPF6_LSA_HEADER, + lsa_size); /* copy LSA from original header */ memcpy(new_header, header, lsa_size); @@ -717,8 +716,8 @@ void ospf6_flush_self_originated_lsas_now(void) ospf6->inst_shutdown = 1; for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { - end = ospf6_lsdb_head(oa->lsdb_self, 0, 0, - ospf6->router_id, &lsa); + end = ospf6_lsdb_head(oa->lsdb_self, 0, 0, ospf6->router_id, + &lsa); while (lsa) { /* RFC 2328 (14.1): Set MAXAGE */ lsa->header->age = htons(OSPF_LSA_MAXAGE); @@ -786,7 +785,8 @@ static char *ospf6_lsa_handler_name(const struct ospf6_lsa_handler *h) unsigned int i; unsigned int size = strlen(h->lh_name); - if (!strcmp(h->lh_name, "unknown") && h->lh_type != OSPF6_LSTYPE_UNKNOWN) { + if (!strcmp(h->lh_name, "unknown") + && h->lh_type != OSPF6_LSTYPE_UNKNOWN) { snprintf(buf, sizeof(buf), "%#04hx", h->lh_type); return buf; } diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 369b381fa..4bf56a8c1 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -142,8 +142,8 @@ struct ospf6_lsa_handler { const char *name; const char *short_name; int (*show)(struct vty *, struct ospf6_lsa *); - char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, int buflen, - int pos); + char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, + int buflen, int pos); } s; #define lh_type s.type #define lh_name s.name diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index 152702391..f17b558e8 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -392,8 +392,7 @@ void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, ospf6_lsa_show_summary_header(vty); end = ospf6_lsdb_head(lsdb, !!type + !!(type && adv_router), - type ? *type : 0, - adv_router ? *adv_router : 0, + type ? *type : 0, adv_router ? *adv_router : 0, &lsa); while (lsa) { if ((!adv_router || lsa->header->adv_router == *adv_router) diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index fe74ddc98..b75d5b70f 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1997,9 +1997,9 @@ static void ospf6_send_lsupdate(struct ospf6_neighbor *on, if (on) { on->ospf6_if->ls_upd_out++; - if ((on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT) || - (on->ospf6_if->state == OSPF6_INTERFACE_DR) || - (on->ospf6_if->state == OSPF6_INTERFACE_BDR)) { + if ((on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT) + || (on->ospf6_if->state == OSPF6_INTERFACE_DR) + || (on->ospf6_if->state == OSPF6_INTERFACE_BDR)) { ospf6_send(on->ospf6_if->linklocal_addr, &allspfrouters6, on->ospf6_if, oh); } else { @@ -2010,9 +2010,9 @@ static void ospf6_send_lsupdate(struct ospf6_neighbor *on, oi->ls_upd_out++; - if ((oi->state == OSPF6_INTERFACE_POINTTOPOINT) || - (oi->state == OSPF6_INTERFACE_DR) || - (oi->state == OSPF6_INTERFACE_BDR)) { + if ((oi->state == OSPF6_INTERFACE_POINTTOPOINT) + || (oi->state == OSPF6_INTERFACE_DR) + || (oi->state == OSPF6_INTERFACE_BDR)) { ospf6_send(oi->linklocal_addr, &allspfrouters6, oi, oh); } else { ospf6_send(oi->linklocal_addr, &alldrouters6, oi, oh); @@ -2065,8 +2065,10 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh - + sizeof(struct ospf6_header)); + lsupdate = (struct ospf6_lsupdate + *)((caddr_t)oh + + sizeof(struct + ospf6_header)); p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); @@ -2110,8 +2112,8 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) oh->length = htons(p - sendbuf); lsupdate->lsa_number = htonl(lsa_cnt); - if (on->ospf6_if->state == - OSPF6_INTERFACE_POINTTOPOINT) { + if (on->ospf6_if->state + == OSPF6_INTERFACE_POINTTOPOINT) { ospf6_send(on->ospf6_if->linklocal_addr, &allspfrouters6, on->ospf6_if, oh); @@ -2123,10 +2125,12 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh - + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + - sizeof(struct ospf6_lsupdate)); + lsupdate = (struct ospf6_lsupdate + *)((caddr_t)oh + + sizeof(struct + ospf6_header)); + p = (u_char *)((caddr_t)lsupdate + + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2186,11 +2190,11 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on, oh->length = htons(p - sendbuf); lsupdate->lsa_number = htonl(lsa_cnt); - if (IS_OSPF6_DEBUG_FLOODING || - IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) + if (IS_OSPF6_DEBUG_FLOODING + || IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) zlog_debug("%s: Send lsupdate with lsa %s (age %u)", - __PRETTY_FUNCTION__, lsa->name, - ntohs(lsa->header->age)); + __PRETTY_FUNCTION__, lsa->name, + ntohs(lsa->header->age)); ospf6_send_lsupdate(on, NULL, oh); @@ -2241,18 +2245,20 @@ int ospf6_lsupdate_send_interface(struct thread *thread) ospf6_send_lsupdate(NULL, oi, oh); if (IS_OSPF6_DEBUG_MESSAGE( - OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) + OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) zlog_debug("%s: LSUpdate length %d", __PRETTY_FUNCTION__, ntohs(oh->length)); memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh - + sizeof(struct ospf6_header)); + lsupdate = (struct ospf6_lsupdate + *)((caddr_t)oh + + sizeof(struct + ospf6_header)); p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2324,13 +2330,13 @@ int ospf6_lsack_send_neighbor(struct thread *thread) on->ospf6_if->ls_ack_out++; ospf6_send(on->ospf6_if->linklocal_addr, - &on->linklocal_addr, - on->ospf6_if, oh); + &on->linklocal_addr, on->ospf6_if, + oh); memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh + - sizeof(struct ospf6_header)); + p = (u_char *)((caddr_t)oh + + sizeof(struct ospf6_header)); lsa_cnt = 0; } } diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 05bc25495..542a24bfc 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -190,8 +190,8 @@ static void ospf6_neighbor_state_change(u_char next_state, } OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(on->ospf6_if->area); - if (prev_state == OSPF6_NEIGHBOR_LOADING && - next_state == OSPF6_NEIGHBOR_FULL) { + if (prev_state == OSPF6_NEIGHBOR_LOADING + && next_state == OSPF6_NEIGHBOR_FULL) { OSPF6_AS_EXTERN_LSA_SCHEDULE(on->ospf6_if); on->ospf6_if->area->full_nbrs++; } diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index ef0a093d1..5b36f6300 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -377,7 +377,7 @@ struct ospf6_path *ospf6_path_dup(struct ospf6_path *path) memcpy(new, path, sizeof(struct ospf6_path)); new->nh_list = list_new(); new->nh_list->cmp = (int (*)(void *, void *))ospf6_nexthop_cmp; - new->nh_list->del = (void (*) (void *))ospf6_nexthop_delete; + new->nh_list->del = (void (*)(void *))ospf6_nexthop_delete; return new; } @@ -388,10 +388,10 @@ struct ospf6_route *ospf6_route_create(void) route = XCALLOC(MTYPE_OSPF6_ROUTE, sizeof(struct ospf6_route)); route->nh_list = list_new(); route->nh_list->cmp = (int (*)(void *, void *))ospf6_nexthop_cmp; - route->nh_list->del = (void (*) (void *))ospf6_nexthop_delete; + route->nh_list->del = (void (*)(void *))ospf6_nexthop_delete; route->paths = list_new(); route->paths->cmp = (int (*)(void *, void *))ospf6_path_cmp; - route->paths->del = (void (*)(void *))ospf6_path_free; + route->paths->del = (void (*)(void *))ospf6_path_free; return route; } @@ -502,13 +502,14 @@ ospf6_route_lookup_identical(struct ospf6_route *route, for (target = ospf6_route_lookup(&route->prefix, table); target; target = target->next) { - if (target->type == route->type && - (memcmp(&target->prefix, &route->prefix, - sizeof(struct prefix)) == 0) && - target->path.type == route->path.type && - target->path.cost == route->path.cost && - target->path.u.cost_e2 == route->path.u.cost_e2 && - ospf6_route_cmp_nexthops(target, route) == 0) + if (target->type == route->type + && (memcmp(&target->prefix, &route->prefix, + sizeof(struct prefix)) + == 0) + && target->path.type == route->path.type + && target->path.cost == route->path.cost + && target->path.u.cost_e2 == route->path.u.cost_e2 + && ospf6_route_cmp_nexthops(target, route) == 0) return target; } return NULL; @@ -647,10 +648,11 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, } if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) - zlog_debug("%s %p: route add %p cost %u: update of %p old cost %u", - ospf6_route_table_name(table), (void *)table, - (void *)route, route->path.cost, (void *)old, - old->path.cost); + zlog_debug( + "%s %p: route add %p cost %u: update of %p old cost %u", + ospf6_route_table_name(table), (void *)table, + (void *)route, route->path.cost, (void *)old, + old->path.cost); else if (IS_OSPF6_DEBUG_ROUTE(TABLE)) zlog_debug("%s: route add: update", ospf6_route_table_name(table)); diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index a44864596..ed1d8bee7 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -914,7 +914,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, if (len) id = htonl(*offset); offset += len; - //offsetlen -= len; // Add back in if we need it again + // offsetlen -= len; // Add back in if we need it again if (exact) { if (v->magic & OSPFv3WWASTABLE) { @@ -1080,8 +1080,8 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, len = (offsetlen < 1 ? 0 : 1); if (len) instid = *offset; - //offset += len; // Add back in if we ever start using again - //offsetlen -= len; + // offset += len; // Add back in if we ever start using again + // offsetlen -= len; if (exact) { oi = ospf6_interface_lookup_by_ifindex(ifindex); @@ -1241,8 +1241,8 @@ static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, len = (offsetlen < 1 ? 0 : 1); if (len) rtrid = htonl(*offset); - //offset += len; // Add back in if we ever start looking at data - //offsetlen -= len; + // offset += len; // Add back in if we ever start looking at data + // offsetlen -= len; if (exact) { oi = ospf6_interface_lookup_by_ifindex(ifindex); diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 29ba1bcec..8d32f3505 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -114,12 +114,12 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa) v->type = OSPF6_VERTEX_TYPE_ROUTER; /* Router LSA use Link ID 0 as base in vertex_id */ ospf6_linkstate_prefix(lsa->header->adv_router, htonl(0), - &v->vertex_id); + &v->vertex_id); } else if (ntohs(lsa->header->type) == OSPF6_LSTYPE_NETWORK) { v->type = OSPF6_VERTEX_TYPE_NETWORK; /* vertex_id */ ospf6_linkstate_prefix(lsa->header->adv_router, lsa->header->id, - &v->vertex_id); + &v->vertex_id); } else assert(0); @@ -131,8 +131,8 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa) __func__, v->name, ((ntohs(lsa->header->type) == OSPF6_LSTYPE_ROUTER) ? "Router" - : "N/W"), ntohs(lsa->header->type), - lsa->name); + : "N/W"), + ntohs(lsa->header->type), lsa->name); /* Associated LSA */ @@ -146,7 +146,7 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa) v->nh_list = list_new(); v->nh_list->cmp = (int (*)(void *, void *))ospf6_nexthop_cmp; - v->nh_list->del = (void (*) (void *))ospf6_nexthop_delete; + v->nh_list->del = (void (*)(void *))ospf6_nexthop_delete; v->parent = NULL; v->child_list = list_new(); @@ -335,28 +335,29 @@ static int ospf6_spf_install(struct ospf6_vertex *v, } else if (route && route->path.cost == v->cost) { if (IS_OSPF6_DEBUG_SPF(PROCESS)) { prefix2str(&route->prefix, pbuf, sizeof(pbuf)); - zlog_debug(" another path found to route %s lsa %s, merge", - pbuf, v->lsa->name); + zlog_debug( + " another path found to route %s lsa %s, merge", + pbuf, v->lsa->name); } ospf6_spf_merge_nexthops_to_route(route, v); prev = (struct ospf6_vertex *)route->route_option; assert(prev->hops <= v->hops); - if ((VERTEX_IS_TYPE(ROUTER, v) && - route->path.origin.id != v->lsa->header->id)) { + if ((VERTEX_IS_TYPE(ROUTER, v) + && route->path.origin.id != v->lsa->header->id)) { if (IS_OSPF6_DEBUG_SPF(PROCESS)) { - zlog_debug("%s: V lsa %s id %u, route id %u are different", - __PRETTY_FUNCTION__, v->lsa->name, - ntohl(v->lsa->header->id), - ntohl(route->path.origin.id)); + zlog_debug( + "%s: V lsa %s id %u, route id %u are different", + __PRETTY_FUNCTION__, v->lsa->name, + ntohl(v->lsa->header->id), + ntohl(route->path.origin.id)); } return 0; } ospf6_vertex_delete(v); return -1; - } /* There should be no case where candidate being installed (variable @@ -554,7 +555,7 @@ void ospf6_spf_calculation(u_int32_t router_id, if (IS_OSPF6_DEBUG_SPF(PROCESS)) zlog_debug( " New candidate: %s hops %d cost %d", - w->name, w->hops, w->cost); + w->name, w->hops, w->cost); pqueue_enqueue(w, candidate_list); } } @@ -970,8 +971,8 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, uint32_t interface_id; caddr_t lsd; - lsa_length = sizeof(struct ospf6_lsa_header) + - sizeof(struct ospf6_router_lsa); + lsa_length = sizeof(struct ospf6_lsa_header) + + sizeof(struct ospf6_router_lsa); total_lsa_length = lsa_length; type = htons(OSPF6_LSTYPE_ROUTER); @@ -991,15 +992,14 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, rtr_lsa = ospf6_lsdb_next(end, rtr_lsa); continue; } - lsa_header = (struct ospf6_lsa_header *) rtr_lsa->header; - total_lsa_length += (ntohs(lsa_header->length) - - lsa_length); + lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; + total_lsa_length += (ntohs(lsa_header->length) - lsa_length); num_lsa++; rtr_lsa = ospf6_lsdb_next(end, rtr_lsa); } if (IS_OSPF6_DEBUG_SPF(PROCESS)) zlog_debug("%s: adv_router %s num_lsa %u to convert.", - __PRETTY_FUNCTION__, ifbuf, num_lsa); + __PRETTY_FUNCTION__, ifbuf, num_lsa); if (num_lsa == 1) return lsa; @@ -1060,13 +1060,14 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, lsd = OSPF6_LSA_HEADER_END(rtr_lsa->header) + 4; interface_id = ROUTER_LSDESC_GET_IFID(lsd); inet_ntop(AF_INET, &interface_id, ifbuf, sizeof(ifbuf)); - zlog_debug("%s: Next Router LSA %s to aggreat with len %u interface_id %s", - __PRETTY_FUNCTION__, rtr_lsa->name, - ntohs(lsa_header->length), ifbuf); + zlog_debug( + "%s: Next Router LSA %s to aggreat with len %u interface_id %s", + __PRETTY_FUNCTION__, rtr_lsa->name, + ntohs(lsa_header->length), ifbuf); } /* Append Next Link State ID LSA */ - lsa_header = (struct ospf6_lsa_header *) rtr_lsa->header; + lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; memcpy(new_header, (OSPF6_LSA_HEADER_END(rtr_lsa->header) + 4), (ntohs(lsa_header->length) - lsa_length)); new_header += (ntohs(lsa_header->length) - lsa_length); @@ -1096,10 +1097,10 @@ void ospf6_remove_temp_router_lsa(struct ospf6_area *area) for (ALL_LSDB(area->temp_router_lsa_lsdb, lsa)) { if (IS_OSPF6_DEBUG_SPF(PROCESS)) - zlog_debug("%s Remove LSA %s lsa->lock %u lsdb count %u", - __PRETTY_FUNCTION__, - lsa->name, lsa->lock, - area->temp_router_lsa_lsdb->count); + zlog_debug( + "%s Remove LSA %s lsa->lock %u lsdb count %u", + __PRETTY_FUNCTION__, lsa->name, lsa->lock, + area->temp_router_lsa_lsdb->count); ospf6_lsdb_remove(lsa, area->temp_router_lsa_lsdb); } } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index afe2d7397..2e1442575 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -403,21 +403,15 @@ DEFUN(no_ospf6_router_id, #if CONFDATE > 20180828 CPP_NOTICE("ospf6: `router-id A.B.C.D` deprecated 2017/08/28") #endif -ALIAS_HIDDEN(ospf6_router_id, - ospf6_router_id_hdn_cmd, - "router-id A.B.C.D", - "Configure OSPF6 Router-ID\n" - V4NOTATION_STR) +ALIAS_HIDDEN(ospf6_router_id, ospf6_router_id_hdn_cmd, "router-id A.B.C.D", + "Configure OSPF6 Router-ID\n" V4NOTATION_STR) #if CONFDATE > 20180828 CPP_NOTICE("ospf6: `no router-id A.B.C.D` deprecated 2017/08/28") #endif -ALIAS_HIDDEN(no_ospf6_router_id, - no_ospf6_router_id_hdn_cmd, +ALIAS_HIDDEN(no_ospf6_router_id, no_ospf6_router_id_hdn_cmd, "no router-id [A.B.C.D]", - NO_STR - "Configure OSPF6 Router-ID\n" - V4NOTATION_STR) + NO_STR "Configure OSPF6 Router-ID\n" V4NOTATION_STR) DEFUN (ospf6_log_adjacency_changes, ospf6_log_adjacency_changes_cmd, diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index bbc1cc18f..58a39156d 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -387,8 +387,8 @@ DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router, lsdb = oa->lsdb_self; else lsdb = oa->lsdb; - if (ospf6_create_single_router_lsa(oa, lsdb, - adv_router) == NULL) { + if (ospf6_create_single_router_lsa(oa, lsdb, adv_router) + == NULL) { vty_out(vty, "Adv router is not found in LSDB."); return CMD_SUCCESS; } |