isisd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
This commit is contained in:
sri-mohan1 2022-08-29 19:05:24 +05:30
parent 1f46f33f9a
commit 11106e287f
3 changed files with 29 additions and 29 deletions

View File

@ -82,7 +82,7 @@ int isis_ldp_sync_state_update(struct ldp_igp_sync_if_state state)
return 0;
/* received ldp-sync interface state from LDP */
ils_debug("ldp_sync: rcvd %s from LDP if %s",
ils_debug("%s: rcvd %s from LDP if %s", __func__,
state.sync_start ? "sync-start" : "sync-complete", ifp->name);
if (state.sync_start)
isis_ldp_sync_if_start(circuit, false);
@ -106,7 +106,7 @@ int isis_ldp_sync_announce_update(struct ldp_igp_sync_announce announce)
if (announce.proto != ZEBRA_ROUTE_LDP)
return 0;
ils_debug("ldp_sync: rcvd announce from LDP");
ils_debug("%s: rcvd announce from LDP", __func__);
/* LDP just started up:
* set cost to LSInfinity
@ -128,8 +128,7 @@ void isis_ldp_sync_state_req_msg(struct isis_circuit *circuit)
struct ldp_igp_sync_if_state_req request;
struct interface *ifp = circuit->interface;
ils_debug("ldp_sync: send state request to LDP for %s",
ifp->name);
ils_debug("%s: send state request to LDP for %s", __func__, ifp->name);
memset(&request, 0, sizeof(request));
strlcpy(request.name, ifp->name, sizeof(ifp->name));
@ -159,7 +158,7 @@ void isis_ldp_sync_if_start(struct isis_circuit *circuit,
if (ldp_sync_info &&
ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED &&
ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) {
ils_debug("ldp_sync: start on if %s state: %s",
ils_debug("%s: start on if %s state: %s", __func__,
circuit->interface->name, "Holding down until Sync");
ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
isis_ldp_sync_set_if_metric(circuit, true);
@ -246,7 +245,8 @@ static int isis_ldp_sync_adj_state_change(struct isis_adjacency *adj)
else
ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED;
ils_debug("ldp_sync: down on if %s", circuit->interface->name);
ils_debug("%s: down on if %s", __func__,
circuit->interface->name);
ldp_sync_if_down(circuit->ldp_sync_info);
}
@ -362,8 +362,8 @@ static void isis_ldp_sync_holddown_timer(struct thread *thread)
ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_UP;
ldp_sync_info->t_holddown = NULL;
ils_debug("ldp_sync: holddown timer expired for %s state:sync achieved",
circuit->interface->name);
ils_debug("%s: holddown timer expired for %s state:sync achieved",
__func__, circuit->interface->name);
isis_ldp_sync_set_if_metric(circuit, true);
}
@ -383,7 +383,7 @@ void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit)
ldp_sync_info->holddown == LDP_IGP_SYNC_HOLDDOWN_DEFAULT)
return;
ils_debug("ldp_sync: start holddown timer for %s time %d",
ils_debug("%s: start holddown timer for %s time %d", __func__,
circuit->interface->name, ldp_sync_info->holddown);
thread_add_timer(master, isis_ldp_sync_holddown_timer,
@ -413,7 +413,7 @@ void isis_ldp_sync_handle_client_close(struct zapi_client_close_info *info)
* set cost to LSInfinity
* send request to LDP for LDP-SYNC state for each interface
*/
zlog_err("ldp_sync: LDP down");
zlog_err("%s: LDP down", __func__);
for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
if (!CHECK_FLAG(area->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE))
@ -488,7 +488,7 @@ void isis_if_ldp_sync_enable(struct isis_circuit *circuit)
if (circuit->interface->vrf->vrf_id != VRF_DEFAULT)
return;
ils_debug("ldp_sync: enable if %s", circuit->interface->name);
ils_debug("%s: enable if %s", __func__, circuit->interface->name);
if (!CHECK_FLAG(area->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE))
return;
@ -507,7 +507,7 @@ void isis_if_ldp_sync_enable(struct isis_circuit *circuit)
isis_ldp_sync_state_req_msg(circuit);
} else {
ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED;
ils_debug("ldp_sync: Sync only runs on P2P links %s",
ils_debug("%s: Sync only runs on P2P links %s", __func__,
circuit->interface->name);
}
}
@ -525,7 +525,7 @@ void isis_if_ldp_sync_disable(struct isis_circuit *circuit)
if (if_is_loopback(circuit->interface))
return;
ils_debug("ldp_sync: remove if %s", circuit->interface->name);
ils_debug("%s: remove if %s", __func__, circuit->interface->name);
if (!CHECK_FLAG(area->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE))
return;

View File

@ -103,15 +103,15 @@ static int isis_multicast_join(int fd, int registerto, int if_num)
#ifdef EXTREME_DEBUG
if (IS_DEBUG_EVENTS)
zlog_debug(
"isis_multicast_join(): fd=%d, reg_to=%d, if_num=%d, address = %02x:%02x:%02x:%02x:%02x:%02x",
fd, registerto, if_num, mreq.mr_address[0],
"%s: fd=%d, reg_to=%d, if_num=%d, address = %02x:%02x:%02x:%02x:%02x:%02x",
__func__, fd, registerto, if_num, mreq.mr_address[0],
mreq.mr_address[1], mreq.mr_address[2],
mreq.mr_address[3], mreq.mr_address[4],
mreq.mr_address[5]);
#endif /* EXTREME_DEBUG */
if (setsockopt(fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mreq,
sizeof(struct packet_mreq))) {
zlog_warn("isis_multicast_join(): setsockopt(): %s",
zlog_warn("%s: setsockopt(): %s", __func__,
safe_strerror(errno));
return ISIS_WARNING;
}
@ -131,13 +131,13 @@ static int open_packet_socket(struct isis_circuit *circuit)
vrf->name);
if (fd < 0) {
zlog_warn("open_packet_socket(): socket() failed %s",
zlog_warn("%s: socket() failed %s", __func__,
safe_strerror(errno));
return ISIS_WARNING;
}
if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &bpf, sizeof(bpf))) {
zlog_warn("open_packet_socket(): SO_ATTACH_FILTER failed: %s",
zlog_warn("%s: SO_ATTACH_FILTER failed: %s", __func__,
safe_strerror(errno));
}
@ -151,7 +151,7 @@ static int open_packet_socket(struct isis_circuit *circuit)
if (bind(fd, (struct sockaddr *)(&s_addr), sizeof(struct sockaddr_ll))
< 0) {
zlog_warn("open_packet_socket(): bind() failed: %s",
zlog_warn("%s: bind() failed: %s", __func__,
safe_strerror(errno));
close(fd);
return ISIS_WARNING;
@ -208,7 +208,7 @@ int isis_sock_init(struct isis_circuit *circuit)
circuit->tx = isis_send_pdu_p2p;
circuit->rx = isis_recv_pdu_p2p;
} else {
zlog_warn("isis_sock_init(): unknown circuit type");
zlog_warn("%s: unknown circuit type", __func__);
retval = ISIS_WARNING;
break;
}
@ -243,8 +243,8 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
|| (s_addr.sll_ifindex != (int)circuit->interface->ifindex)) {
if (bytesread < 0) {
zlog_warn(
"isis_recv_packet_bcast(): ifname %s, fd %d, bytesread %d, recvfrom(): %s",
circuit->interface->name, circuit->fd,
"%s: ifname %s, fd %d, bytesread %d, recvfrom(): %s",
__func__, circuit->interface->name, circuit->fd,
bytesread, safe_strerror(errno));
}
if (s_addr.sll_ifindex != (int)circuit->interface->ifindex) {
@ -261,7 +261,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
(socklen_t *)&addr_len);
if (bytesread < 0)
zlog_warn("isis_recv_pdu_bcast(): recvfrom() failed");
zlog_warn("%s: recvfrom() failed", __func__);
return ISIS_WARNING;
}
@ -276,7 +276,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
(struct sockaddr *)&s_addr,
(socklen_t *)&addr_len);
if (bytesread < 0)
zlog_warn("isis_recv_pdu_bcast(): recvfrom() failed");
zlog_warn("%s: recvfrom() failed", __func__);
return ISIS_WARNING;
}
@ -321,7 +321,7 @@ int isis_recv_pdu_p2p(struct isis_circuit *circuit, uint8_t *ssnpa)
(struct sockaddr *)&s_addr,
(socklen_t *)&addr_len);
if (bytesread < 0)
zlog_warn("isis_recv_pdu_p2p(): recvfrom() failed");
zlog_warn("%s: recvfrom() failed", __func__);
return ISIS_WARNING;
}
@ -329,7 +329,7 @@ int isis_recv_pdu_p2p(struct isis_circuit *circuit, uint8_t *ssnpa)
* ISO over GRE we exit with pain :)
*/
if (ntohs(s_addr.sll_protocol) != 0x00FE) {
zlog_warn("isis_recv_pdu_p2p(): protocol mismatch(): %X",
zlog_warn("%s: protocol mismatch(): %X", __func__,
ntohs(s_addr.sll_protocol));
return ISIS_WARNING;
}

View File

@ -844,8 +844,7 @@ static int isis_spf_process_lsp(struct isis_spftree *spftree,
lspfragloop:
if (lsp->hdr.seqno == 0) {
zlog_warn(
"isis_spf_process_lsp(): lsp with 0 seq_num - ignore");
zlog_warn("%s: lsp with 0 seq_num - ignore", __func__);
return ISIS_WARNING;
}
@ -1780,7 +1779,8 @@ void isis_run_spf(struct isis_spftree *spftree)
break;
case SPFTREE_COUNT:
zlog_err(
"isis_run_spf should never be called with SPFTREE_COUNT as argument!");
"%s should never be called with SPFTREE_COUNT as argument!",
__func__);
exit(1);
}