diff options
| -rw-r--r-- | bgpd/bgp_attr.c | 4 | ||||
| -rw-r--r-- | lib/bfd.c | 16 | ||||
| -rw-r--r-- | lib/bfd.h | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_abr.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_area.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 12 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 24 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.c | 11 | ||||
| -rw-r--r-- | ospf6d/ospf6_nssa.c | 53 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 12 | ||||
| -rw-r--r-- | ospf6d/ospf6d.c | 36 | ||||
| -rw-r--r-- | ospf6d/ospf6d.h | 22 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 8 |
13 files changed, 139 insertions, 71 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index c2017495a6..632cae8c7d 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -831,10 +831,6 @@ static void *bgp_attr_hash_alloc(void *p) if (vnc_subtlvs) bgp_attr_set_vnc_subtlvs(val, NULL); #endif - if (val->srv6_l3vpn) - val->srv6_l3vpn = NULL; - if (val->srv6_vpn) - val->srv6_vpn = NULL; attr->refcnt = 0; return attr; @@ -310,8 +310,8 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args) stream_putw(s, args->family); stream_put(s, &args->src, addrlen); - /* Send the expected TTL. */ - stream_putc(s, args->ttl); + /* Send the expected hops. */ + stream_putc(s, args->hops); /* Send interface name if any. */ if (args->mhop) { @@ -349,8 +349,8 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args) stream_putw(s, args->family); stream_put(s, &args->src, addrlen); - /* Send the expected TTL. */ - stream_putc(s, args->ttl); + /* Send the expected hops. */ + stream_putc(s, args->hops); } else { /* Multi hop indicator. */ stream_putc(s, 0); @@ -396,7 +396,7 @@ struct bfd_session_params *bfd_sess_new(bsp_status_update updatecb, void *arg) /* Set defaults. */ bsp->args.detection_multiplier = BFD_DEF_DETECT_MULT; - bsp->args.ttl = 1; + bsp->args.hops = 1; bsp->args.min_rx = BFD_DEF_MIN_RX; bsp->args.min_tx = BFD_DEF_MIN_TX; bsp->args.vrf_id = VRF_DEFAULT; @@ -648,13 +648,13 @@ void bfd_sess_set_vrf(struct bfd_session_params *bsp, vrf_id_t vrf_id) void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t hops) { - if (bsp->args.ttl == hops) + if (bsp->args.hops == hops) return; /* If already installed, remove the old setting. */ _bfd_sess_remove(bsp); - bsp->args.ttl = hops; + bsp->args.hops = hops; bsp->args.mhop = (hops > 1); } @@ -692,7 +692,7 @@ enum bfd_session_state bfd_sess_status(const struct bfd_session_params *bsp) uint8_t bfd_sess_hop_count(const struct bfd_session_params *bsp) { - return bsp->args.ttl; + return bsp->args.hops; } const char *bfd_sess_profile(const struct bfd_session_params *bsp) @@ -385,8 +385,8 @@ struct bfd_session_arg { /** Multi hop indicator. */ uint8_t mhop; - /** Expected TTL. */ - uint8_t ttl; + /** Expected hops. */ + uint8_t hops; /** C bit (Control Plane Independent bit) indicator. */ uint8_t cbit; diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 663b9b7982..443759344e 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -1176,7 +1176,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (lsa->header->adv_router == router_lsa->router_id) { if (is_debug) zlog_debug( - "Ignorning Inter-Router LSA for an ABR (%s)", + "Ignoring Inter-Router LSA for an ABR (%s)", buf); if (old) ospf6_route_remove(old, table); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 7e8e34a221..417fc69694 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -1075,6 +1075,8 @@ DEFUN(show_ipv6_ospf6_spf_tree, show_ipv6_ospf6_spf_tree_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1142,6 +1144,8 @@ DEFUN(show_ipv6_ospf6_area_spf_tree, show_ipv6_ospf6_area_spf_tree_cmd, } } + OSPF6_CMD_CHECK_VRF(false, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1230,6 +1234,8 @@ DEFUN(show_ipv6_ospf6_simulate_spf_tree_root, } } + OSPF6_CMD_CHECK_VRF(false, all_vrf, ospf6); + return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 5cb6244bbc..568cf29f66 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1409,8 +1409,6 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, struct ospf6_external_info tinfo; struct ospf6_route *route, *match; struct ospf6_external_info *info; - struct prefix prefix_id; - char ibuf[16]; struct ospf6_redist *red; red = ospf6_redist_lookup(ospf6, type, 0); @@ -1496,14 +1494,6 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, else ospf6_route_add_nexthop(match, ifindex, NULL); - if (IS_OSPF6_DEBUG_ASBR) { - inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, - sizeof(ibuf)); - zlog_debug( - "Advertise as AS-External Id:%s prefix %pFX metric %u", - ibuf, prefix, match->path.metric_type); - } - match->path.origin.id = htonl(info->id); ospf6_handle_external_lsa_origination(ospf6, match, prefix); @@ -2553,6 +2543,8 @@ DEFUN(show_ipv6_ospf6_redistribute, show_ipv6_ospf6_redistribute_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a0c921f419..ae9f13bc10 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -971,6 +971,10 @@ static const char *ospf6_iftype_str(uint8_t iftype) return "UNKNOWN"; } +#if CONFDATE > 20220709 +CPP_NOTICE("Time to remove ospf6Enabled from JSON output") +#endif + /* show specified interface structure */ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, json_object *json_obj, bool use_json) @@ -1260,14 +1264,13 @@ struct in6_addr *ospf6_interface_get_global_address(struct interface *ifp) static int show_ospf6_interface_common(struct vty *vty, vrf_id_t vrf_id, int argc, struct cmd_token **argv, int idx_ifname, int intf_idx, - int json_idx) + int json_idx, bool uj) { struct vrf *vrf = vrf_lookup_by_id(vrf_id); struct interface *ifp; json_object *json; json_object *json_int; - bool uj = use_json(argc, argv); if (uj) { json = json_object_new_object(); @@ -1323,6 +1326,7 @@ DEFUN(show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_ifname_cmd, const char *vrf_name = NULL; bool all_vrf = false; int idx_vrf = 0; + bool uj = use_json(argc, argv); OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); if (idx_vrf > 0) { @@ -1335,13 +1339,15 @@ DEFUN(show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_ifname_cmd, if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { show_ospf6_interface_common(vty, ospf6->vrf_id, argc, argv, idx_ifname, intf_idx, - json_idx); + json_idx, uj); if (!all_vrf) break; } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1457,14 +1463,13 @@ static int ospf6_interface_show_traffic(struct vty *vty, static int ospf6_interface_show_traffic_common(struct vty *vty, int argc, struct cmd_token **argv, - vrf_id_t vrf_id) + vrf_id_t vrf_id, bool uj) { int idx_ifname = 0; int display_once = 0; char *intf_name = NULL; struct interface *ifp = NULL; json_object *json = NULL; - bool uj = use_json(argc, argv); if (uj) json = json_object_new_object(); @@ -1525,19 +1530,22 @@ DEFUN(show_ipv6_ospf6_interface_traffic, show_ipv6_ospf6_interface_traffic_cmd, const char *vrf_name = NULL; bool all_vrf = false; int idx_vrf = 0; + bool uj = use_json(argc, argv); OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { ospf6_interface_show_traffic_common(vty, argc, argv, - ospf6->vrf_id); + ospf6->vrf_id, uj); if (!all_vrf) break; } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1601,6 +1609,8 @@ DEFUN(show_ipv6_ospf6_interface_ifname_prefix, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1651,6 +1661,8 @@ DEFUN(show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 1a8fedea0c..afa504d13c 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -1111,12 +1111,15 @@ DEFUN(show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } static int ospf6_neighbor_show_common(struct vty *vty, int argc, struct cmd_token **argv, - struct ospf6 *ospf6, int idx_ipv4) + struct ospf6 *ospf6, int idx_ipv4, + bool uj) { struct ospf6_neighbor *on; struct ospf6_interface *oi; @@ -1126,7 +1129,6 @@ static int ospf6_neighbor_show_common(struct vty *vty, int argc, json_object *json, bool use_json); uint32_t router_id; json_object *json = NULL; - bool uj = use_json(argc, argv); showfunc = ospf6_neighbor_show_detail; if (uj) @@ -1164,6 +1166,7 @@ DEFUN(show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, const char *vrf_name = NULL; bool all_vrf = false; int idx_vrf = 0; + bool uj = use_json(argc, argv); OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); if (idx_vrf > 0) @@ -1172,13 +1175,15 @@ DEFUN(show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { ospf6_neighbor_show_common(vty, argc, argv, ospf6, - idx_ipv4); + idx_ipv4, uj); if (!all_vrf) break; } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index cd1be3a5b7..042907d0f6 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -135,7 +135,7 @@ static void ospf6_flush_translated_lsa(struct ospf6_area *area) zlog_debug("%s: finish area %s", __func__, area->name); } -/* Check NSSA status for all nssa areas*/ +/* Check NSSA status for all nssa areas */ void ospf6_abr_nssa_check_status(struct ospf6 *ospf6) { struct ospf6_area *area; @@ -271,7 +271,7 @@ static void ospf6_abr_announce_aggregates(struct ospf6 *ospf6) struct listnode *node; if (IS_OSPF6_DEBUG_ABR) - zlog_debug("ospf6_abr_announce_aggregates(): Start"); + zlog_debug("%s: Start", __func__); for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, area)) { if (IS_OSPF6_DEBUG_ABR) @@ -285,7 +285,7 @@ static void ospf6_abr_announce_aggregates(struct ospf6 *ospf6) } if (IS_OSPF6_DEBUG_ABR) - zlog_debug("ospf6_abr_announce_aggregates(): Stop"); + zlog_debug("%s: Stop", __func__); } /* Flush the summary LSA's which are not approved.*/ @@ -387,7 +387,7 @@ static void ospf6_abr_unapprove_translates(struct ospf6 *ospf6) uint16_t type; if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_unapprove_translates(): Start"); + zlog_debug("%s: Start", __func__); type = htons(OSPF6_LSTYPE_AS_EXTERNAL); for (ALL_LSDB_TYPED(ospf6->lsdb, type, lsa)) { @@ -401,10 +401,10 @@ static void ospf6_abr_unapprove_translates(struct ospf6 *ospf6) } if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_unapprove_translates(): Stop"); + zlog_debug("%s: Stop", __func__); } -/* Generate the translated external lsa from NSSA lsa */ +/* Generate the translated external lsa from NSSA lsa */ static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area, struct ospf6_lsa *type7) { @@ -536,10 +536,10 @@ static void ospf6_ls_retransmit_delete_nbr_as(struct ospf6 *ospf6, ospf6_flood_clear_area(lsa, area); if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("%s : finish lsa %s", __func__, lsa->name); + zlog_debug("%s : finish lsa %s", __func__, lsa->name); } -/* Refresh translated AS-external-LSA. */ +/* Refresh translated AS-external-LSA. */ struct ospf6_lsa *ospf6_translated_nssa_refresh(struct ospf6_area *area, struct ospf6_lsa *type7, struct ospf6_lsa *type5) @@ -575,8 +575,9 @@ struct ospf6_lsa *ospf6_translated_nssa_refresh(struct ospf6_area *area, match = ospf6_route_lookup(&prefix, ospf6->external_table); if (match) type5 = ospf6_lsdb_lookup( - OSPF6_LSTYPE_AS_EXTERNAL, match->path.origin.id, - ospf6->router_id, ospf6->lsdb); + htons(OSPF6_LSTYPE_AS_EXTERNAL), + match->path.origin.id, ospf6->router_id, + ospf6->lsdb); } if (type5) { @@ -604,7 +605,6 @@ struct ospf6_lsa *ospf6_translated_nssa_refresh(struct ospf6_area *area, __func__, &type7->header->id); return NULL; } - UNSET_FLAG(new->flag, OSPF6_LSA_UNAPPROVED); } if (IS_OSPF6_DEBUG_NSSA) @@ -615,7 +615,7 @@ struct ospf6_lsa *ospf6_translated_nssa_refresh(struct ospf6_area *area, static void ospf6_abr_translate_nssa(struct ospf6_area *area, struct ospf6_lsa *lsa) { - /* Incoming Type-7 or later aggregated Type-7 + /* Incoming Type-7 or aggregated Type-7 * * LSA is skipped if P-bit is off. * @@ -707,7 +707,7 @@ static void ospf6_abr_translate_nssa(struct ospf6_area *area, struct ospf6_lsa * static void ospf6_abr_process_nssa_translates(struct ospf6 *ospf6) { /* Scan through all NSSA_LSDB records for all areas; - * If P-bit is on, translate all Type-7's to 5's and aggregate or\ + * If P-bit is on, translate all Type-7's to 5's and aggregate or * flood install as approved in Type-5 LSDB with XLATE Flag on * later, do same for all aggregates... At end, DISCARD all * remaining UNAPPROVED Type-5's (Aggregate is for future ) */ @@ -739,7 +739,7 @@ static void ospf6_abr_process_nssa_translates(struct ospf6 *ospf6) type = htons(OSPF6_LSTYPE_TYPE_7); for (ALL_LSDB_TYPED(oa->lsdb, type, lsa)) { zlog_debug("%s : lsa %s , id %pI4 , adv router %pI4", - lsa->name, __func__, &lsa->header->id, + __func__, lsa->name, &lsa->header->id, &lsa->header->adv_router); ospf6_abr_translate_nssa(oa, lsa); } @@ -783,7 +783,7 @@ static void ospf6_abr_remove_unapproved_translates(struct ospf6 *ospf6) /* All AREA PROCESS should have APPROVED necessary LSAs */ /* Remove any left over and not APPROVED */ if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_remove_unapproved_translates(): Start"); + zlog_debug("%s: Start", __func__); type = htons(OSPF6_LSTYPE_AS_EXTERNAL); for (ALL_LSDB_TYPED(ospf6->lsdb, type, lsa)) { @@ -798,7 +798,7 @@ static void ospf6_abr_remove_unapproved_translates(struct ospf6 *ospf6) } if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf_abr_remove_unapproved_translates(): Stop"); + zlog_debug("%s: Stop", __func__); } static void ospf6_abr_nssa_type_7_default_create(struct ospf6 *ospf6, @@ -897,17 +897,17 @@ static void ospf6_abr_nssa_task(struct ospf6 *ospf6) /* Each area must confirm TranslatorRole */ if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_nssa_task(): Start"); + zlog_debug("%s: Start", __func__); /* For all Global Entries flagged "local-translate", unset APPROVED */ if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_nssa_task(): unapprove translates"); + zlog_debug("%s: unapprove translates", __func__); ospf6_abr_unapprove_translates(ospf6); /* Originate Type-7 aggregates */ if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_nssa_task(): send NSSA aggregates"); + zlog_debug("%s: send NSSA aggregates", __func__); ospf6_abr_send_nssa_aggregates(ospf6); /* For all NSSAs, Type-7s, translate to 5's, INSTALL/FLOOD, or @@ -915,17 +915,16 @@ static void ospf6_abr_nssa_task(struct ospf6 *ospf6) * Install or Approve in Type-5 Global LSDB */ if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_nssa_task(): process translates"); + zlog_debug("%s: process translates", __func__); ospf6_abr_process_nssa_translates(ospf6); /* Flush any unapproved previous translates from Global Data Base */ if (IS_OSPF6_DEBUG_NSSA) - zlog_debug( - "ospf6_abr_nssa_task(): remove unapproved translates"); + zlog_debug("%s: remove unapproved translates", __func__); ospf6_abr_remove_unapproved_translates(ospf6); if (IS_OSPF6_DEBUG_NSSA) - zlog_debug("ospf6_abr_nssa_task(): Stop"); + zlog_debug("%s: Stop", __func__); } int ospf6_redistribute_check(struct ospf6 *ospf6, struct ospf6_route *route, @@ -1021,10 +1020,10 @@ static void ospf6_nssa_flush_area(struct ospf6_area *area) /* Flush the translated LSA */ if (ospf6_check_and_set_router_abr(ospf6)) { - type = htons(OSPF6_LSTYPE_AS_EXTERNAL); type5 = ospf6_lsdb_lookup( - htons(type), lsa->external_lsa_id, - ospf6->router_id, ospf6->lsdb); + htons(OSPF6_LSTYPE_AS_EXTERNAL), + lsa->external_lsa_id, ospf6->router_id, + ospf6->lsdb); if (type5 && CHECK_FLAG(type5->flag, OSPF6_LSA_LOCAL_XLT)) { type5->header->age = htons(OSPF_LSA_MAXAGE); @@ -1376,7 +1375,7 @@ DEFPY (no_area_nssa_range, range = ospf6_route_lookup((struct prefix *)prefix, oa->nssa_range_table); if (range == NULL) { - vty_out(vty, "%% range %s does not exists.\n", prefix_str); + vty_out(vty, "%% range %s does not exist.\n", prefix_str); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 6bff52fc56..5fcfc7e701 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -1536,6 +1536,8 @@ DEFUN(show_ipv6_ospf6, show_ipv6_ospf6_cmd, if (uj) json_object_free(json); + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1574,6 +1576,8 @@ DEFUN(show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1607,6 +1611,8 @@ DEFUN(show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1641,6 +1647,8 @@ DEFUN(show_ipv6_ospf6_route_match_detail, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1676,6 +1684,8 @@ DEFUN(show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -2091,6 +2101,8 @@ DEFPY (show_ipv6_ospf6_external_aggregator, vty_json(vty, json); } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index d9f730586b..cc5a0f7870 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -421,6 +421,8 @@ DEFUN(show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -471,6 +473,8 @@ DEFUN(show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -512,6 +516,8 @@ DEFUN(show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -557,6 +563,8 @@ DEFUN(show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -625,6 +633,8 @@ DEFUN_HIDDEN( } } + OSPF6_CMD_CHECK_VRF(false, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -681,6 +691,8 @@ DEFUN(show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -740,6 +752,8 @@ DEFUN(show_ipv6_ospf6_database_type_router, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -789,6 +803,8 @@ DEFUN(show_ipv6_ospf6_database_id_router, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -838,6 +854,8 @@ DEFUN(show_ipv6_ospf6_database_adv_router_linkstate_id, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -899,6 +917,8 @@ DEFUN(show_ipv6_ospf6_database_type_id_router, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -967,6 +987,8 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1008,6 +1030,8 @@ DEFUN(show_ipv6_ospf6_database_self_originated, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1065,6 +1089,8 @@ DEFUN(show_ipv6_ospf6_database_type_self_originated, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1127,6 +1153,8 @@ DEFUN(show_ipv6_ospf6_database_type_self_originated_linkstate_id, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1187,6 +1215,8 @@ DEFUN(show_ipv6_ospf6_database_type_id_self_originated, } } + OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1263,6 +1293,8 @@ DEFUN(show_ipv6_ospf6_border_routers, show_ipv6_ospf6_border_routers_cmd, } } + OSPF6_CMD_CHECK_VRF(false, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1306,6 +1338,8 @@ DEFUN(show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd, } } + OSPF6_CMD_CHECK_VRF(false, all_vrf, ospf6); + return CMD_SUCCESS; } @@ -1346,6 +1380,8 @@ DEFUN(show_ipv6_ospf6_linkstate_detail, show_ipv6_ospf6_linkstate_detail_cmd, } } + OSPF6_CMD_CHECK_VRF(false, all_vrf, ospf6); + return CMD_SUCCESS; } diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index 041a9b1df9..43549de741 100644 --- a/ospf6d/ospf6d.h +++ b/ospf6d/ospf6d.h @@ -93,14 +93,24 @@ extern struct thread_master *master; #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n" #define OSPF6_LS_ID_STR "Specify Link State ID\n" +#define OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6) \ + do { \ + if (uj == false && all_vrf == false && ospf6 == NULL) { \ + vty_out(vty, "%% OSPFv3 instance not found\n"); \ + return CMD_SUCCESS; \ + } \ + } while (0) + #define IS_OSPF6_ASBR(O) ((O)->flag & OSPF6_FLAG_ASBR) #define OSPF6_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"); \ - } else { \ - vrf_name = VRF_DEFAULT_NAME; \ - } + do { \ + if (argv_find(argv, argc, "vrf", &idx_vrf)) { \ + vrf_name = argv[idx_vrf + 1]->arg; \ + all_vrf = strmatch(vrf_name, "all"); \ + } else { \ + vrf_name = VRF_DEFAULT_NAME; \ + } \ + } while (0) #define OSPF6_FALSE false #define OSPF6_TRUE true diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 2df6103a6f..45dbed0abd 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9919,7 +9919,7 @@ DEFUN (ospf_external_route_aggregation, ret = ospf_asbr_external_aggregator_set(ospf, &p, tag); if (ret == OSPF_INVALID) - vty_out(vty, "Inavlid configuration!!\n"); + vty_out(vty, "Invalid configuration!!\n"); return CMD_SUCCESS; } @@ -9960,7 +9960,7 @@ DEFUN (no_ospf_external_route_aggregation, ret = ospf_asbr_external_aggregator_unset(ospf, &p, tag); if (ret == OSPF_INVALID) - vty_out(vty, "Inavlid configuration!!\n"); + vty_out(vty, "Invalid configuration!!\n"); return CMD_SUCCESS; } @@ -10245,7 +10245,7 @@ DEFUN (ospf_external_route_aggregation_no_adrvertise, ret = ospf_asbr_external_rt_no_advertise(ospf, &p); if (ret == OSPF_INVALID) - vty_out(vty, "Inavlid configuration!!\n"); + vty_out(vty, "Invalid configuration!!\n"); return CMD_SUCCESS; } @@ -10281,7 +10281,7 @@ DEFUN (no_ospf_external_route_aggregation_no_adrvertise, ret = ospf_asbr_external_rt_advertise(ospf, &p); if (ret == OSPF_INVALID) - vty_out(vty, "Inavlid configuration!!\n"); + vty_out(vty, "Invalid configuration!!\n"); return CMD_SUCCESS; } |
