diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-01-30 16:08:25 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-01-31 21:15:42 +0100 |
commit | d5dea3506e4bb55ebea5a225c70e24e8d6c800ac (patch) | |
tree | 0692150aabb29769357007ac2a095808c52e0952 /pathd | |
parent | pimd: Add missing enums to switch statement (diff) | |
download | frr-d5dea3506e4bb55ebea5a225c70e24e8d6c800ac.tar.xz frr-d5dea3506e4bb55ebea5a225c70e24e8d6c800ac.zip |
pathd: Add missing enum's to switch statement
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'pathd')
-rw-r--r-- | pathd/path_cli.c | 4 | ||||
-rw-r--r-- | pathd/path_nb_config.c | 5 | ||||
-rw-r--r-- | pathd/path_pcep.c | 2 | ||||
-rw-r--r-- | pathd/path_pcep_config.c | 13 | ||||
-rw-r--r-- | pathd/path_pcep_controller.c | 20 | ||||
-rw-r--r-- | pathd/path_pcep_debug.c | 72 | ||||
-rw-r--r-- | pathd/path_pcep_lib.c | 96 | ||||
-rw-r--r-- | pathd/path_pcep_pcc.c | 25 | ||||
-rw-r--r-- | pathd/path_ted.c | 2 | ||||
-rw-r--r-- | pathd/pathd.c | 30 |
10 files changed, 220 insertions, 49 deletions
diff --git a/pathd/path_cli.c b/pathd/path_cli.c index b88453c68..66680357d 100644 --- a/pathd/path_cli.c +++ b/pathd/path_cli.c @@ -1079,9 +1079,11 @@ static const char *objfun_type_name(enum objfun_type type) return "mss"; case OBJFUN_MSN: return "msn"; - default: + case OBJFUN_UNDEFINED: return NULL; } + + assert(!"Reached end of function we should never hit"); } DEFPY_NOSH(show_debugging_pathd, show_debugging_pathd_cmd, diff --git a/pathd/path_nb_config.c b/pathd/path_nb_config.c index e1fbb37f5..25d2ef47f 100644 --- a/pathd/path_nb_config.c +++ b/pathd/path_nb_config.c @@ -239,7 +239,10 @@ void pathd_srte_segment_list_segment_nai_apply_finish( args->dnode, "./local-prefix-len"); local_prefix_len = atoi(local_prefix_len_buf); break; - default: + case SRTE_SEGMENT_NAI_TYPE_NONE: + case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY_LINK_LOCAL_ADDRESSES: + case SRTE_SEGMENT_NAI_TYPE_IPV6_LOCAL_IFACE: + case SRTE_SEGMENT_NAI_TYPE_IPV6_ALGORITHM: break; } diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c index ce631eb7b..8a7825907 100644 --- a/pathd/path_pcep.c +++ b/pathd/path_pcep.c @@ -210,7 +210,7 @@ int pcep_main_event_handler(enum pcep_main_event_type type, int pcc_id, ret = pcep_main_event_remove_candidate_segments( (const char *)payload, true); break; - default: + case PCEP_MAIN_EVENT_UNDEFINED: flog_warn(EC_PATH_PCEP_RECOVERABLE_INTERNAL_ERROR, "Unexpected event received in the main thread: %u", type); diff --git a/pathd/path_pcep_config.c b/pathd/path_pcep_config.c index 873b0ccd3..e2feabb03 100644 --- a/pathd/path_pcep_config.c +++ b/pathd/path_pcep_config.c @@ -270,7 +270,8 @@ path_pcep_config_list_path_hops(struct srte_segment_list *segment_list) sizeof(struct ipaddr)); hop->nai.remote_iface = segment->nai_remote_iface; break; - default: + case SRTE_SEGMENT_NAI_TYPE_NONE: + case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY_LINK_LOCAL_ADDRESSES: break; } last_hop = hop; @@ -489,9 +490,12 @@ status_int_to_ext(enum srte_policy_status status) return PCEP_LSP_OPERATIONAL_GOING_UP; case SRTE_POLICY_STATUS_GOING_DOWN: return PCEP_LSP_OPERATIONAL_GOING_DOWN; - default: + case SRTE_POLICY_STATUS_DOWN: + case SRTE_POLICY_STATUS_UNKNOWN: return PCEP_LSP_OPERATIONAL_DOWN; } + + assert(!"Reached end of function where we are not expecting to"); } enum pcep_sr_subobj_nai pcep_nai_type(enum srte_segment_nai_type type) @@ -539,7 +543,10 @@ enum srte_segment_nai_type srte_nai_type(enum pcep_sr_subobj_nai type) return SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY; case PCEP_SR_SUBOBJ_NAI_UNNUMBERED_IPV4_ADJACENCY: return SRTE_SEGMENT_NAI_TYPE_IPV4_UNNUMBERED_ADJACENCY; - default: + case PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY: + case PCEP_SR_SUBOBJ_NAI_UNKNOWN: return SRTE_SEGMENT_NAI_TYPE_NONE; } + + assert(!"Reached end of function where we were not expecting to"); } diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index b9f2ba3c6..380d1ab22 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -603,7 +603,9 @@ void pcep_thread_timer_handler(struct thread *thread) pcep_thread_remove_candidate_path_segments(ctrl_state, pcc_state); break; - default: + case TM_PCEPLIB_TIMER: + case TM_UNDEFINED: + case TM_MAX: flog_warn(EC_PATH_PCEP_RECOVERABLE_INTERNAL_ERROR, "Unknown controller timer triggered: %u", timer_type); break; @@ -823,7 +825,7 @@ void pcep_thread_event_handler(struct thread *thread) pcep_pcc_send_error(ctrl_state, pcc_state, error, (bool)sub_type); break; - default: + case EV_PCEPLIB_EVENT: flog_warn(EC_PATH_PCEP_RECOVERABLE_INTERNAL_ERROR, "Unexpected event received in controller thread: %u", type); @@ -1074,10 +1076,16 @@ const char *timer_type_name(enum pcep_ctrl_timer_type type) return "PCEPLIB_TIMER"; case TM_TIMEOUT: return "TIMEOUT"; - default: + case TM_CALCULATE_BEST_PCE: + return "BEST_PCE"; + case TM_SESSION_TIMEOUT_PCC: + return "TIMEOUT_PCC"; + case TM_MAX: return "UNKNOWN"; } -}; + + assert(!"Reached end of function where we did not expect to"); +} const char *timeout_type_name(enum pcep_ctrl_timeout_type type) { @@ -1086,7 +1094,9 @@ const char *timeout_type_name(enum pcep_ctrl_timeout_type type) return "UNDEFINED"; case TO_COMPUTATION_REQUEST: return "COMPUTATION_REQUEST"; - default: + case TO_MAX: return "UNKNOWN"; } + + assert(!"Reached end of function where we did not expect to"); } diff --git a/pathd/path_pcep_debug.c b/pathd/path_pcep_debug.c index b0802ae6c..4ae587c91 100644 --- a/pathd/path_pcep_debug.c +++ b/pathd/path_pcep_debug.c @@ -90,9 +90,9 @@ const char *pcc_status_name(enum pcc_status status) return "SYNCHRONIZING"; case PCEP_PCC_OPERATING: return "OPERATING"; - default: - return "UNKNOWN"; } + + assert(!"Reached end of function where we do not expect to"); } const char *pcep_event_type_name(pcep_event_type event_type) @@ -118,9 +118,13 @@ const char *pcep_event_type_name(pcep_event_type event_type) return "PCC_RCVD_MAX_INVALID_MSGS"; case PCC_RCVD_MAX_UNKOWN_MSGS: return "PCC_RCVD_MAX_UNKOWN_MSGS"; - default: - return "UNKNOWN"; + case PCC_CONNECTION_FAILURE: + return "PCC_CONNECTION_FAILURE"; + case PCC_SENT_INVALID_OPEN: + return "PCC_SENT_INVALID_OPEN"; } + + assert(!"Reached end of function where we do not expect to"); } const char *pcep_error_type_name(enum pcep_error_type error_type) @@ -640,9 +644,11 @@ const char *pcep_message_type_name(enum pcep_message_types pcep_message_type) return "INITIATE"; case PCEP_TYPE_START_TLS: return "START_TLS"; - default: + case PCEP_TYPE_MAX: return "UNKNOWN"; } + + assert(!"Reached end of function where we are not expecting to"); } const char *pcep_object_class_name(enum pcep_object_classes obj_class) @@ -694,9 +700,11 @@ const char *pcep_object_class_name(enum pcep_object_classes obj_class) return "SERVER_IND"; case PCEP_OBJ_CLASS_ASSOCIATION: return "ASSOCIATION"; - default: + case PCEP_OBJ_CLASS_MAX: return "UNKNOWN"; } + + assert(!"Reached end of function where we are not expecting to"); } const char *pcep_object_type_name(enum pcep_object_classes obj_class, @@ -769,9 +777,9 @@ const char *pcep_lsp_status_name(enum pcep_lsp_operational_status status) return "GOING_DOWN"; case PCEP_LSP_OPERATIONAL_GOING_UP: return "GOING_UP"; - default: - return "UNKNOWN"; } + + assert(!"Reached end of function where we do not expect to"); } @@ -818,9 +826,11 @@ const char *pcep_tlv_type_name(enum pcep_object_tlv_types tlv_type) return "UNKNOWN"; case PCEP_OBJ_TLV_TYPE_ARBITRARY: return "ARBITRARY"; - default: - return "UNKNOWN"; + case PCEP_OBJ_TYPE_CISCO_BSID: + return "CISCO_BSID"; } + + assert(!"Reached end of function where we do not expect to"); } const char *pcep_ro_type_name(enum pcep_ro_subobj_types ro_type) @@ -839,9 +849,11 @@ const char *pcep_ro_type_name(enum pcep_ro_subobj_types ro_type) return "ASN"; case RO_SUBOBJ_TYPE_SR: return "SR"; - default: + case RO_SUBOBJ_UNKNOWN: return "UNKNOWN"; } + + assert(!"Reached end of function where we do not expect to"); } const char *pcep_nai_type_name(enum pcep_sr_subobj_nai nai_type) @@ -861,9 +873,11 @@ const char *pcep_nai_type_name(enum pcep_sr_subobj_nai nai_type) return "UNNUMBERED_IPV4_ADJACENCY"; case PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY: return "LINK_LOCAL_IPV6_ADJACENCY"; - default: + case PCEP_SR_SUBOBJ_NAI_UNKNOWN: return "UNKNOWN"; } + + assert(!"Reached end of function where we do not expect to"); } const char *pcep_metric_type_name(enum pcep_metric_types type) @@ -1115,7 +1129,7 @@ void _format_path(int ps, struct path *path) PATHD_FORMAT("%*sendpoint: %pI6\n", ps3, "", &path->nbkey.endpoint.ipaddr_v6); break; - default: + case IPADDR_NONE: PATHD_FORMAT("%*sendpoint: NONE\n", ps3, ""); break; } @@ -1300,7 +1314,9 @@ void _format_path_hop(int ps, struct path_hop *hop) &hop->nai.remote_addr.ipaddr_v6, hop->nai.remote_iface); break; - default: + case PCEP_SR_SUBOBJ_NAI_ABSENT: + case PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY: + case PCEP_SR_SUBOBJ_NAI_UNKNOWN: PATHD_FORMAT("%*sNAI: UNSUPPORTED\n", ps, ""); break; } @@ -1580,7 +1596,11 @@ void _format_pcep_object_ro_details(int ps, struct pcep_object_ro_subobj *ro) case RO_SUBOBJ_TYPE_SR: _format_pcep_object_ro_sr(ps, (struct pcep_ro_subobj_sr *)ro); break; - default: + case RO_SUBOBJ_TYPE_IPV6: + case RO_SUBOBJ_TYPE_LABEL: + case RO_SUBOBJ_TYPE_UNNUM: + case RO_SUBOBJ_TYPE_ASN: + case RO_SUBOBJ_UNKNOWN: PATHD_FORMAT("%*s...\n", ps, ""); break; } @@ -1668,7 +1688,9 @@ void _format_pcep_object_ro_sr(int ps, struct pcep_ro_subobj_sr *obj) PATHD_FORMAT("%*sNAI: %pI4(%u)/%pI4(%u)\n", ps, "", laddr4, *liface, raddr4, *riface); break; - default: + case PCEP_SR_SUBOBJ_NAI_ABSENT: + case PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY: + case PCEP_SR_SUBOBJ_NAI_UNKNOWN: PATHD_FORMAT("%*sNAI: UNSUPPORTED\n", ps, ""); break; } @@ -1731,7 +1753,23 @@ void _format_pcep_object_tlv_details(int ps, ps, (struct pcep_object_tlv_path_setup_type *)tlv_header); break; - default: + case PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR: + case PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST: + case PCEP_OBJ_TLV_TYPE_VENDOR_INFO: + case PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE: + case PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC: + case PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION: + case PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_NAME: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE: + case PCEP_OBJ_TLV_TYPE_UNKNOWN: + case PCEP_OBJ_TYPE_CISCO_BSID: + case PCEP_OBJ_TLV_TYPE_ARBITRARY: PATHD_FORMAT("%*s...\n", ps, ""); break; } diff --git a/pathd/path_pcep_lib.c b/pathd/path_pcep_lib.c index 6b247b705..1ce01a162 100644 --- a/pathd/path_pcep_lib.c +++ b/pathd/path_pcep_lib.c @@ -767,7 +767,9 @@ double_linked_list *pcep_lib_format_path(struct pcep_caps *caps, .s_addr, hop->nai.remote_iface); break; - default: + case PCEP_SR_SUBOBJ_NAI_ABSENT: + case PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY: + case PCEP_SR_SUBOBJ_NAI_UNKNOWN: break; } } @@ -854,7 +856,24 @@ void pcep_lib_parse_open(struct pcep_caps *caps, struct pcep_object_open *open) case PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST: pcep_lib_parse_open_objfun_list(caps, tlv_header); break; - default: + case PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR: + case PCEP_OBJ_TLV_TYPE_VENDOR_INFO: + case PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE: + case PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC: + case PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION: + case PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_NAME: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE: + case PCEP_OBJ_TLV_TYPE_UNKNOWN: + case PCEP_OBJ_TLV_TYPE_ARBITRARY: + case PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME: + case PCEP_OBJ_TYPE_CISCO_BSID: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEP_TLV, "Unexpected OPEN's TLV %s (%u)", pcep_tlv_type_name(tlv_header->type), @@ -915,7 +934,26 @@ void pcep_lib_parse_rp(struct path *path, struct pcep_object_rp *rp) case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE: // TODO: enforce the path setup type is SR_TE_PST break; - default: + case PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR: + case PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST: + case PCEP_OBJ_TLV_TYPE_VENDOR_INFO: + case PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE: + case PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC: + case PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION: + case PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID: + case PCEP_OBJ_TLV_TYPE_SR_PCE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_NAME: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE: + case PCEP_OBJ_TLV_TYPE_STATEFUL_PCE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_UNKNOWN: + case PCEP_OBJ_TLV_TYPE_ARBITRARY: + case PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME: + case PCEP_OBJ_TYPE_CISCO_BSID: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE_CAPABILITY: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEP_TLV, "Unexpected RP's TLV %s (%u)", pcep_tlv_type_name(tlv->type), tlv->type); @@ -945,7 +983,26 @@ void pcep_lib_parse_srp(struct path *path, struct pcep_object_srp *srp) case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE: // TODO: enforce the path setup type is SR_TE_PST break; - default: + case PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR: + case PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST: + case PCEP_OBJ_TLV_TYPE_VENDOR_INFO: + case PCEP_OBJ_TLV_TYPE_STATEFUL_PCE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME: + case PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE: + case PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC: + case PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION: + case PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID: + case PCEP_OBJ_TLV_TYPE_SR_PCE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_NAME: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE: + case PCEP_OBJ_TLV_TYPE_UNKNOWN: + case PCEP_OBJ_TYPE_CISCO_BSID: + case PCEP_OBJ_TLV_TYPE_ARBITRARY: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEP_TLV, "Unexpected SRP's TLV %s (%u)", pcep_tlv_type_name(tlv->type), tlv->type); @@ -991,7 +1048,25 @@ void pcep_lib_parse_lsp(struct path *path, struct pcep_object_lsp *lsp) path->binding_sid = ntohl(path->binding_sid); path->binding_sid = (path->binding_sid >> 12); break; - default: + case PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR: + case PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST: + case PCEP_OBJ_TLV_TYPE_VENDOR_INFO: + case PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS: + case PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE: + case PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC: + case PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION: + case PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID: + case PCEP_OBJ_TLV_TYPE_SR_PCE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE: + case PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_NAME: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_ID: + case PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE: + case PCEP_OBJ_TLV_TYPE_STATEFUL_PCE_CAPABILITY: + case PCEP_OBJ_TLV_TYPE_UNKNOWN: + case PCEP_OBJ_TLV_TYPE_ARBITRARY: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEP_TLV, "Unexpected LSP TLV %s (%u)", pcep_tlv_type_name(tlv->type), tlv->type); @@ -1082,7 +1157,12 @@ void pcep_lib_parse_ero(struct path *path, struct pcep_object_ro *ero) hop = pcep_lib_parse_ero_sr( hop, (struct pcep_ro_subobj_sr *)obj); break; - default: + case RO_SUBOBJ_TYPE_IPV4: + case RO_SUBOBJ_TYPE_IPV6: + case RO_SUBOBJ_TYPE_LABEL: + case RO_SUBOBJ_TYPE_UNNUM: + case RO_SUBOBJ_TYPE_ASN: + case RO_SUBOBJ_UNKNOWN: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEP_ERO_SUBOBJ, "Unexpected ERO sub-object %s (%u)", pcep_ro_type_name(obj->ro_subobj_type), @@ -1181,7 +1261,9 @@ struct path_hop *pcep_lib_parse_ero_sr(struct path_hop *next, assert(n->data != NULL); hop->nai.remote_iface = *(uint32_t *)n->data; break; - default: + case PCEP_SR_SUBOBJ_NAI_ABSENT: + case PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY: + case PCEP_SR_SUBOBJ_NAI_UNKNOWN: hop->has_nai = false; flog_warn(EC_PATH_PCEP_UNEXPECTED_SR_NAI, "Unexpected SR segment NAI type %s (%u)", diff --git a/pathd/path_pcep_pcc.c b/pathd/path_pcep_pcc.c index a1c56f93a..524c77c1f 100644 --- a/pathd/path_pcep_pcc.c +++ b/pathd/path_pcep_pcc.c @@ -450,9 +450,11 @@ int pcep_pcc_disable(struct ctrl_state *ctrl_state, struct pcc_state *pcc_state) pcc_state->sess = NULL; pcc_state->status = PCEP_PCC_DISCONNECTED; return 0; - default: + case PCEP_PCC_INITIALIZED: return 1; } + + assert(!"Reached end of function where we are not expecting to"); } void pcep_pcc_sync_path(struct ctrl_state *ctrl_state, @@ -614,7 +616,8 @@ void pcep_pcc_timeout_handler(struct ctrl_state *ctrl_state, free_req_entry(req); } break; - default: + case TO_UNDEFINED: + case TO_MAX: break; } } @@ -674,7 +677,7 @@ void pcep_pcc_pathd_event_handler(struct ctrl_state *ctrl_state, if (pcc_state->caps.is_stateful) send_report(pcc_state, path); return; - default: + case PCEP_PATH_UNDEFINED: flog_warn(EC_PATH_PCEP_RECOVERABLE_INTERNAL_ERROR, "Unexpected pathd event received by pcc %s: %u", pcc_state->tag, type); @@ -748,7 +751,7 @@ void pcep_pcc_pcep_event_handler(struct ctrl_state *ctrl_state, || pcc_state->status == PCEP_PCC_OPERATING); handle_pcep_message(ctrl_state, pcc_state, event->message); break; - default: + case PCC_CONNECTION_FAILURE: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEPLIB_EVENT, "Unexpected event from pceplib: %s", format_pcep_event(event)); @@ -1179,7 +1182,15 @@ void handle_pcep_message(struct ctrl_state *ctrl_state, case PCEP_TYPE_PCREP: handle_pcep_comp_reply(ctrl_state, pcc_state, msg); break; - default: + case PCEP_TYPE_OPEN: + case PCEP_TYPE_KEEPALIVE: + case PCEP_TYPE_PCREQ: + case PCEP_TYPE_PCNOTF: + case PCEP_TYPE_ERROR: + case PCEP_TYPE_CLOSE: + case PCEP_TYPE_REPORT: + case PCEP_TYPE_START_TLS: + case PCEP_TYPE_MAX: flog_warn(EC_PATH_PCEP_UNEXPECTED_PCEP_MESSAGE, "Unexpected pcep message from pceplib: %s", format_pcep_message(msg)); @@ -1953,9 +1964,11 @@ static uint32_t hash_nbkey(const struct lsp_nb_key *nbkey) case IPADDR_V6: return jhash(&nbkey->endpoint.ipaddr_v6, sizeof(nbkey->endpoint.ipaddr_v6), hash); - default: + case IPADDR_NONE: return hash; } + + assert(!"Reached end of function where we were not expecting to"); } static int cmp_nbkey(const struct lsp_nb_key *a, const struct lsp_nb_key *b) diff --git a/pathd/path_ted.c b/pathd/path_ted.c index 5fc8a1f03..5be63a68c 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -527,7 +527,7 @@ uint32_t path_ted_config_write(struct vty *vty) case IMPORT_OSPFv3: vty_out(vty, " mpls-te import ospfv3\n"); break; - default: + case IMPORT_UNKNOWN: break; } } diff --git a/pathd/pathd.c b/pathd/pathd.c index 167c88aea..2ca4f4cc9 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -281,7 +281,8 @@ int srte_segment_entry_set_nai(struct srte_segment_entry *segment, segment->nai_local_iface = local_iface; status = srte_ted_do_query_type_e(segment, &pre, local_iface); break; - default: + case SRTE_SEGMENT_NAI_TYPE_NONE: + case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY_LINK_LOCAL_ADDRESSES: segment->nai_local_addr.ipa_type = IPADDR_NONE; segment->nai_local_iface = 0; segment->nai_remote_addr.ipa_type = IPADDR_NONE; @@ -472,7 +473,11 @@ int srte_policy_update_ted_sid(void) s_entry, &prefix_cli, s_entry->nai_algorithm); break; - default: + case SRTE_SEGMENT_NAI_TYPE_NONE: + case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE: + case SRTE_SEGMENT_NAI_TYPE_IPV6_NODE: + case SRTE_SEGMENT_NAI_TYPE_IPV4_UNNUMBERED_ADJACENCY: + case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY_LINK_LOCAL_ADDRESSES: break; } } @@ -1025,9 +1030,11 @@ static uint32_t filter_type_to_flag(enum affinity_filter_type type) return F_CANDIDATE_HAS_INCLUDE_ANY; case AFFINITY_FILTER_INCLUDE_ALL: return F_CANDIDATE_HAS_INCLUDE_ALL; - default: + case AFFINITY_FILTER_UNDEFINED: return 0; } + + assert(!"Reached end of function we should never hit"); } static const char *filter_type_name(enum affinity_filter_type type) @@ -1039,9 +1046,11 @@ static const char *filter_type_name(enum affinity_filter_type type) return "include-any"; case AFFINITY_FILTER_INCLUDE_ALL: return "include-all"; - default: + case AFFINITY_FILTER_UNDEFINED: return "unknown"; } + + assert(!"Reached end of function we should never hit"); } /** @@ -1155,7 +1164,9 @@ void srte_candidate_status_update(struct srte_candidate *candidate, int status) case SRTE_POLICY_STATUS_GOING_UP: case SRTE_POLICY_STATUS_DOWN: return; - default: + case SRTE_POLICY_STATUS_UNKNOWN: + case SRTE_POLICY_STATUS_UP: + case SRTE_POLICY_STATUS_GOING_DOWN: policy->status = SRTE_POLICY_STATUS_DOWN; srte_policy_status_log(policy); break; @@ -1165,7 +1176,10 @@ void srte_candidate_status_update(struct srte_candidate *candidate, int status) switch (policy->status) { case SRTE_POLICY_STATUS_UP: return; - default: + case SRTE_POLICY_STATUS_UNKNOWN: + case SRTE_POLICY_STATUS_DOWN: + case SRTE_POLICY_STATUS_GOING_DOWN: + case SRTE_POLICY_STATUS_GOING_UP: policy->status = SRTE_POLICY_STATUS_UP; srte_policy_status_log(policy); break; @@ -1263,9 +1277,11 @@ const char *srte_origin2str(enum srte_protocol_origin origin) return "BGP"; case SRTE_ORIGIN_LOCAL: return "Local"; - default: + case SRTE_ORIGIN_UNDEFINED: return "Unknown"; } + + assert(!"Reached end of function we should never hit"); } void path_policy_show_debugging(struct vty *vty) |