diff options
author | James Byrne <james.byrne@origamienergy.com> | 2019-04-12 17:01:51 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-30 10:51:27 +0200 |
commit | 253c4e787a799a3e1f92957ed791b5222f8d2f64 (patch) | |
tree | 36204e05aaaf2cdcbd89eaadeff0193f99b063bf /networking/dnsd.c | |
parent | f3a064f4956e113978e74486300dcd1e3e044efa (diff) | |
download | busybox-w32-253c4e787a799a3e1f92957ed791b5222f8d2f64.tar.gz busybox-w32-253c4e787a799a3e1f92957ed791b5222f8d2f64.tar.bz2 busybox-w32-253c4e787a799a3e1f92957ed791b5222f8d2f64.zip |
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 37a80309d..f2c6bddc6 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c | |||
@@ -133,7 +133,7 @@ static struct dns_entry *parse_conf_file(const char *fileconf) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | if (OPT_verbose) | 135 | if (OPT_verbose) |
136 | bb_error_msg("name:%s, ip:%s", token[0], token[1]); | 136 | bb_info_msg("name:%s, ip:%s", token[0], token[1]); |
137 | 137 | ||
138 | /* sizeof(*m) includes 1 byte for m->name[0] */ | 138 | /* sizeof(*m) includes 1 byte for m->name[0] */ |
139 | m = xzalloc(sizeof(*m) + strlen(token[0]) + 1); | 139 | m = xzalloc(sizeof(*m) + strlen(token[0]) + 1); |
@@ -438,7 +438,7 @@ static int process_packet(struct dns_entry *conf_data, | |||
438 | answstr = table_lookup(conf_data, type, query_string); | 438 | answstr = table_lookup(conf_data, type, query_string); |
439 | #if DEBUG | 439 | #if DEBUG |
440 | /* Shows lengths instead of dots, unusable for !DEBUG */ | 440 | /* Shows lengths instead of dots, unusable for !DEBUG */ |
441 | bb_error_msg("'%s'->'%s'", query_string, answstr); | 441 | bb_info_msg("'%s'->'%s'", query_string, answstr); |
442 | #endif | 442 | #endif |
443 | outr_rlen = 4; | 443 | outr_rlen = 4; |
444 | if (answstr && type == htons(REQ_PTR)) { | 444 | if (answstr && type == htons(REQ_PTR)) { |
@@ -474,7 +474,7 @@ static int process_packet(struct dns_entry *conf_data, | |||
474 | * RCODE = 0 "success" | 474 | * RCODE = 0 "success" |
475 | */ | 475 | */ |
476 | if (OPT_verbose) | 476 | if (OPT_verbose) |
477 | bb_error_msg("returning positive reply"); | 477 | bb_info_msg("returning positive reply"); |
478 | outr_flags = htons(0x8000 | 0x0400 | 0); | 478 | outr_flags = htons(0x8000 | 0x0400 | 0); |
479 | /* we have one answer */ | 479 | /* we have one answer */ |
480 | head->nansw = htons(1); | 480 | head->nansw = htons(1); |
@@ -539,7 +539,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv) | |||
539 | 539 | ||
540 | { | 540 | { |
541 | char *p = xmalloc_sockaddr2dotted(&lsa->u.sa); | 541 | char *p = xmalloc_sockaddr2dotted(&lsa->u.sa); |
542 | bb_error_msg("accepting UDP packets on %s", p); | 542 | bb_info_msg("accepting UDP packets on %s", p); |
543 | free(p); | 543 | free(p); |
544 | } | 544 | } |
545 | 545 | ||
@@ -557,7 +557,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv) | |||
557 | continue; | 557 | continue; |
558 | } | 558 | } |
559 | if (OPT_verbose) | 559 | if (OPT_verbose) |
560 | bb_error_msg("got UDP packet"); | 560 | bb_info_msg("got UDP packet"); |
561 | buf[r] = '\0'; /* paranoia */ | 561 | buf[r] = '\0'; /* paranoia */ |
562 | r = process_packet(conf_data, conf_ttl, buf); | 562 | r = process_packet(conf_data, conf_ttl, buf); |
563 | if (r <= 0) | 563 | if (r <= 0) |