diff options
author | James Byrne | 2019-04-12 17:01:51 +0000 |
---|---|---|
committer | Denys Vlasenko | 2019-04-30 10:51:27 +0200 |
commit | 253c4e787a799a3e1f92957ed791b5222f8d2f64 (patch) | |
tree | 36204e05aaaf2cdcbd89eaadeff0193f99b063bf /networking/dnsd.c | |
parent | f3a064f4956e113978e74486300dcd1e3e044efa (diff) | |
download | busybox-253c4e787a799a3e1f92957ed791b5222f8d2f64.zip busybox-253c4e787a799a3e1f92957ed791b5222f8d2f64.tar.gz |
Optionally re-introduce bb_info_msg()
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was
eliminated and calls to it changed to be bb_error_msg(). The downside of
this is that daemons now log all messages to syslog at the LOG_ERR level
which makes it hard to filter errors from informational messages.
This change optionally re-introduces bb_info_msg(), controlled by a new
option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that
were removed (only in applets that set logmode to LOGMODE_SYSLOG or
LOGMODE_BOTH), and also changes informational messages in ifplugd and
ntpd.
The code size change of this is as follows (using 'defconfig' on x86_64
with gcc 7.3.0-27ubuntu1~18.04)
function old new delta
bb_info_msg - 182 +182
bb_vinfo_msg - 27 +27
static.log7 194 198 +4
log8 190 191 +1
log5 190 191 +1
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes
If you don't care about everything being logged at LOG_ERR level
then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller:
function old new delta
static.log7 194 200 +6
log8 190 193 +3
log5 190 193 +3
syslog_level 1 - -1
bb_verror_msg 583 581 -2
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/dnsd.c')
-rw-r--r-- | networking/dnsd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c index 37a8030..f2c6bdd 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -133,7 +133,7 @@ static struct dns_entry *parse_conf_file(const char *fileconf) } if (OPT_verbose) - bb_error_msg("name:%s, ip:%s", token[0], token[1]); + bb_info_msg("name:%s, ip:%s", token[0], token[1]); /* sizeof(*m) includes 1 byte for m->name[0] */ m = xzalloc(sizeof(*m) + strlen(token[0]) + 1); @@ -438,7 +438,7 @@ static int process_packet(struct dns_entry *conf_data, answstr = table_lookup(conf_data, type, query_string); #if DEBUG /* Shows lengths instead of dots, unusable for !DEBUG */ - bb_error_msg("'%s'->'%s'", query_string, answstr); + bb_info_msg("'%s'->'%s'", query_string, answstr); #endif outr_rlen = 4; if (answstr && type == htons(REQ_PTR)) { @@ -474,7 +474,7 @@ static int process_packet(struct dns_entry *conf_data, * RCODE = 0 "success" */ if (OPT_verbose) - bb_error_msg("returning positive reply"); + bb_info_msg("returning positive reply"); outr_flags = htons(0x8000 | 0x0400 | 0); /* we have one answer */ head->nansw = htons(1); @@ -539,7 +539,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv) { char *p = xmalloc_sockaddr2dotted(&lsa->u.sa); - bb_error_msg("accepting UDP packets on %s", p); + bb_info_msg("accepting UDP packets on %s", p); free(p); } @@ -557,7 +557,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv) continue; } if (OPT_verbose) - bb_error_msg("got UDP packet"); + bb_info_msg("got UDP packet"); buf[r] = '\0'; /* paranoia */ r = process_packet(conf_data, conf_ttl, buf); if (r <= 0) |