From a10c287292d8497f1f73e78bbf12504933391b0d Mon Sep 17 00:00:00 2001 From: sri-mohan1 Date: Fri, 2 Sep 2022 00:25:16 +0530 Subject: [PATCH] bgpd: changes for code maintainability these changes are for improving the code maintainability Signed-off-by: sri-mohan1 --- bgpd/bgp_btoa.c | 2 +- bgpd/bgp_dump.c | 4 ++-- bgpd/bgp_fsm.c | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c index 13c42d95f4..aa14d99f18 100644 --- a/bgpd/bgp_btoa.c +++ b/bgpd/bgp_btoa.c @@ -77,7 +77,7 @@ static void attr_parse(struct stream *s, uint16_t len) lim = s->getp + len; - printf("attr_parse s->getp %zd, len %d, lim %d\n", s->getp, len, lim); + printf("%s s->getp %zd, len %d, lim %d\n", __func__, s->getp, len, lim); while (s->getp < lim) { flag = stream_getc(s); diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 720925b20f..2899b5c8c6 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -122,7 +122,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump) ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, &tm); if (ret == 0) { - flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: strftime error"); + flog_warn(EC_BGP_DUMP, "%s: strftime error", __func__); return NULL; } @@ -134,7 +134,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump) bgp_dump->fp = fopen(realpath, "w"); if (bgp_dump->fp == NULL) { - flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: %s: %s", realpath, + flog_warn(EC_BGP_DUMP, "%s: %s: %s", __func__, realpath, strerror(errno)); umask(oldumask); return NULL; diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index b570c84d8b..5534e54808 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -953,7 +953,7 @@ void bgp_start_routeadv(struct bgp *bgp) struct listnode *node, *nnode; struct peer *peer; - zlog_info("bgp_start_routeadv(), update hold status %d", + zlog_info("%s, update hold status %d", __func__, bgp->main_peers_update_hold); if (bgp->main_peers_update_hold) @@ -1687,9 +1687,8 @@ static void bgp_connect_check(struct thread *thread) static int bgp_connect_success(struct peer *peer) { if (peer->fd < 0) { - flog_err(EC_BGP_CONNECT, - "bgp_connect_success peer's fd is negative value %d", - peer->fd); + flog_err(EC_BGP_CONNECT, "%s peer's fd is negative value %d", + __func__, peer->fd); bgp_stop(peer); return -1; } @@ -1910,7 +1909,7 @@ int bgp_start(struct peer *peer) peer->host, peer->fd); if (peer->fd < 0) { flog_err(EC_BGP_FSM, - "bgp_start peer's fd is negative value %d", + "%s peer's fd is negative value %d", __func__, peer->fd); return -1; } -- 2.39.5