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/ospf_vty.c | |
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/ospf_vty.c')
-rw-r--r-- | ospfd/ospf_vty.c | 897 |
1 files changed, 401 insertions, 496 deletions
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. */ |