lib: Convert to builtin printf functionality

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-03-10 13:05:51 -05:00 committed by David Lamparter
parent d47b448de5
commit a0ee6f3224
2 changed files with 11 additions and 17 deletions

View file

@ -1783,7 +1783,6 @@ static int vty_accept(struct thread *thread)
int accept_sock; int accept_sock;
struct prefix p; struct prefix p;
struct access_list *acl = NULL; struct access_list *acl = NULL;
char buf[SU_ADDRSTRLEN];
accept_sock = THREAD_FD(thread); accept_sock = THREAD_FD(thread);
@ -1804,8 +1803,8 @@ static int vty_accept(struct thread *thread)
if (!sockunion2hostprefix(&su, &p)) { if (!sockunion2hostprefix(&su, &p)) {
close(vty_sock); close(vty_sock);
zlog_info("Vty unable to convert prefix from sockunion %s", zlog_info("Vty unable to convert prefix from sockunion %pSU",
sockunion2str(&su, buf, SU_ADDRSTRLEN)); &su);
return -1; return -1;
} }
@ -1813,8 +1812,7 @@ static int vty_accept(struct thread *thread)
if (p.family == AF_INET && vty_accesslist_name) { if (p.family == AF_INET && vty_accesslist_name) {
if ((acl = access_list_lookup(AFI_IP, vty_accesslist_name)) if ((acl = access_list_lookup(AFI_IP, vty_accesslist_name))
&& (access_list_apply(acl, &p) == FILTER_DENY)) { && (access_list_apply(acl, &p) == FILTER_DENY)) {
zlog_info("Vty connection refused from %s", zlog_info("Vty connection refused from %pSU", &su);
sockunion2str(&su, buf, SU_ADDRSTRLEN));
close(vty_sock); close(vty_sock);
/* continue accepting connections */ /* continue accepting connections */
@ -1829,8 +1827,7 @@ static int vty_accept(struct thread *thread)
if ((acl = access_list_lookup(AFI_IP6, if ((acl = access_list_lookup(AFI_IP6,
vty_ipv6_accesslist_name)) vty_ipv6_accesslist_name))
&& (access_list_apply(acl, &p) == FILTER_DENY)) { && (access_list_apply(acl, &p) == FILTER_DENY)) {
zlog_info("Vty connection refused from %s", zlog_info("Vty connection refused from %pSU", &su);
sockunion2str(&su, buf, SU_ADDRSTRLEN));
close(vty_sock); close(vty_sock);
/* continue accepting connections */ /* continue accepting connections */
@ -1847,8 +1844,7 @@ static int vty_accept(struct thread *thread)
zlog_info("can't set sockopt to vty_sock : %s", zlog_info("can't set sockopt to vty_sock : %s",
safe_strerror(errno)); safe_strerror(errno));
zlog_info("Vty connection from %s", zlog_info("Vty connection from %pSU", &su);
sockunion2str(&su, buf, SU_ADDRSTRLEN));
vty_create(vty_sock, &su); vty_create(vty_sock, &su);
@ -2444,9 +2440,8 @@ bool vty_read_config(struct nb_config *config, const char *config_file,
confp = vty_use_backup_config(fullpath); confp = vty_use_backup_config(fullpath);
if (confp) if (confp)
flog_warn( flog_warn(EC_LIB_BACKUP_CONFIG,
EC_LIB_BACKUP_CONFIG, "using backup configuration file!");
"WARNING: using backup configuration file!");
else { else {
flog_err( flog_err(
EC_LIB_VTY, EC_LIB_VTY,
@ -2495,9 +2490,8 @@ bool vty_read_config(struct nb_config *config, const char *config_file,
confp = vty_use_backup_config(config_default_dir); confp = vty_use_backup_config(config_default_dir);
if (confp) { if (confp) {
flog_warn( flog_warn(EC_LIB_BACKUP_CONFIG,
EC_LIB_BACKUP_CONFIG, "using backup configuration file!");
"WARNING: using backup configuration file!");
fullpath = config_default_dir; fullpath = config_default_dir;
} else { } else {
flog_err(EC_LIB_VTY, flog_err(EC_LIB_VTY,
@ -2625,7 +2619,7 @@ int vty_config_node_exit(struct vty *vty)
/* Check if there's a pending confirmed commit. */ /* Check if there's a pending confirmed commit. */
if (vty->t_confirmed_commit_timeout) { if (vty->t_confirmed_commit_timeout) {
vty_out(vty, vty_out(vty,
"WARNING: exiting with a pending confirmed commit. Rolling back to previous configuration.\n\n"); "exiting with a pending confirmed commit. Rolling back to previous configuration.\n\n");
nb_cli_confirmed_commit_rollback(vty); nb_cli_confirmed_commit_rollback(vty);
nb_cli_confirmed_commit_clean(vty); nb_cli_confirmed_commit_clean(vty);
} }

View file

@ -2340,7 +2340,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
* "peer" */ * "peer" */
flog_err( flog_err(
EC_LIB_ZAPI_ENCODE, EC_LIB_ZAPI_ENCODE,
"warning: interface %s address %pFX with peer flag set, but no peer address!", "interface %s address %pFX with peer flag set, but no peer address!",
ifp->name, ifc->address); ifp->name, ifc->address);
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
} }