[PATCH 1/1] Optionally re-introduce bb_info_msg()

James Byrne james.byrne at origamienergy.com
Wed May 9 17:04:08 UTC 2018


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 Ubuntu 5.4.0-6ubuntu1~16.04.9)

function                                             old     new   delta
bb_info_msg                                            -     182    +182
bb_vinfo_msg                                           -      24     +24
udhcpd_main                                         1609    1620     +11
udhcpc_main                                         2730    2736      +6
static.log7                                          192     196      +4
log8                                                 190     191      +1
log5                                                 190     191      +1
crondlog                                              41       -     -41
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 5/0 up/down: 229/-41)           Total: 188
bytes
   text    data     bss     dec     hex filename
 934580    4263    1856  940699   e5a9b busybox_old
 934768    4263    1856  940887   e5b57 busybox_unstripped

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                                          192     198      +6
log8                                                 190     193      +3
log5                                                 190     193      +3
syslog_level                                           1       -      -1
bb_verror_msg                                        572     570      -2
crondlog                                              41       -     -41
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-44)            Total: -32
bytes
   text    data     bss     dec     hex filename
 934580    4263    1856  940699   e5a9b busybox_old
 934549    4262    1856  940667   e5a7b busybox_unstripped

Signed-off-by: James Byrne <james.byrne at origamienergy.com>
---
 Config.in                    |  9 +++++++++
 include/libbb.h              |  9 ++++++++-
 libbb/verror_msg.c           | 22 ++++++++++++++++++++--
 loginutils/chpasswd.c        |  2 +-
 loginutils/passwd.c          |  2 +-
 loginutils/sulogin.c         |  6 +++---
 miscutils/crond.c            |  4 +---
 miscutils/devfsd.c           |  2 +-
 networking/ifplugd.c         | 20 ++++++++++----------
 networking/ntpd.c            |  4 ++--
 networking/udhcp/common.c    |  2 +-
 networking/udhcp/common.h    |  6 +++---
 networking/udhcp/d6_dhcpc.c  | 30 +++++++++++++++---------------
 networking/udhcp/d6_packet.c |  4 ++--
 networking/udhcp/dhcpc.c     | 34 +++++++++++++++++-----------------
 networking/udhcp/dhcpd.c     | 16 ++++++++--------
 networking/udhcp/packet.c    |  6 +++---
 networking/zcip.c            |  4 ++--
 18 files changed, 107 insertions(+), 75 deletions(-)

diff --git a/Config.in b/Config.in
index 51ff01e..c7aa0af 100644
--- a/Config.in
+++ b/Config.in
@@ -334,6 +334,15 @@ config FEATURE_CLEAN_UP
        Don't enable this unless you have a really good reason to clean
        things up manually.

+config FEATURE_SYSLOG_INFO
+       bool "Support LOG_INFO level syslog messages"
+       default y
+       depends on FEATURE_SYSLOG
+       help
+       Applets which send their output to syslog use either LOG_INFO or
+       LOG_ERR log levels, but by disabling this option all messages will
+       be logged at the LOG_ERR level, saving just under 200 bytes.
+
 # These are auto-selected by other options

 config FEATURE_SYSLOG
diff --git a/include/libbb.h b/include/libbb.h
index a605c7f..b0bdf93 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1279,7 +1279,6 @@ enum {
        LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
 };
 extern const char *msg_eol;
-extern smallint syslog_level;
 extern smallint logmode;
 extern uint8_t xfunc_error_retval;
 extern void (*die_func)(void);
@@ -1299,6 +1298,14 @@ void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
 void bb_die_memory_exhausted(void) NORETURN FAST_FUNC;
 void bb_logenv_override(void) FAST_FUNC;

+#if ENABLE_FEATURE_SYSLOG_INFO
+extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+extern void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC;
+#else
+#define bb_info_msg bb_error_msg
+#define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL)
+#endif
+
 /* We need to export XXX_main from libbusybox
  * only if we build "individual" binaries
  */
diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c
index 22c3035..6d34599 100644
--- a/libbb/verror_msg.c
+++ b/libbb/verror_msg.c
@@ -12,7 +12,7 @@
 #endif

 #if ENABLE_FEATURE_SYSLOG
-smallint syslog_level = LOG_ERR;
+static smallint syslog_level = LOG_ERR;
 #endif
 smallint logmode = LOGMODE_STDIO;
 const char *msg_eol = "\n";
@@ -154,7 +154,7 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr)
        }
 # if ENABLE_FEATURE_SYSLOG
        if (logmode & LOGMODE_SYSLOG) {
-               syslog(LOG_ERR, "%s", msgc);
+               syslog(syslog_level, "%s", msgc);
        }
 # endif
        free(msgc);
@@ -180,3 +180,21 @@ void FAST_FUNC bb_error_msg(const char *s, ...)
        bb_verror_msg(s, p, NULL);
        va_end(p);
 }
+
+#if ENABLE_FEATURE_SYSLOG_INFO
+void FAST_FUNC bb_vinfo_msg(const char *s, va_list p)
+{
+       syslog_level = LOG_INFO;
+       bb_verror_msg(s, p, NULL);
+       syslog_level = LOG_ERR;
+}
+
+void FAST_FUNC bb_info_msg(const char *s, ...)
+{
+       va_list p;
+
+       va_start(p, s);
+       bb_vinfo_msg(s, p);
+       va_end(p);
+}
+#endif
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index 652e4f1..e04e87a 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -106,7 +106,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
                if (rc < 0)
                        bb_error_msg_and_die("an error occurred updating password for %s", name);
                if (rc)
-                       bb_error_msg("password for '%s' changed", name);
+                       bb_info_msg("password for '%s' changed", name);
                logmode = LOGMODE_STDIO;
                free(name);
                free(free_me);
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 59f47fc..2ae9031 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -228,7 +228,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv)
        /* LOGMODE_BOTH */
        if (rc < 0)
                bb_error_msg_and_die("can't update password file %s", filename);
-       bb_error_msg("password for %s changed by %s", name, myname);
+       bb_info_msg("password for %s changed by %s", name, myname);

        /*if (ENABLE_FEATURE_CLEAN_UP) free(newp); - can't, it may be non-malloced */
  skip:
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index 27ea5df..9bb4d36 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -68,17 +68,17 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
                );
                if (r < 0) {
                        /* ^D, ^C, timeout, or read error */
-                       bb_error_msg("normal startup");
+                       bb_info_msg("normal startup");
                        return 0;
                }
                if (r > 0) {
                        break;
                }
                bb_do_delay(LOGIN_FAIL_DELAY);
-               bb_error_msg("Login incorrect");
+               bb_info_msg("Login incorrect");
        }

-       bb_error_msg("starting shell for system maintenance");
+       bb_info_msg("starting shell for system maintenance");

        IF_SELINUX(renew_current_security_context());

diff --git a/miscutils/crond.c b/miscutils/crond.c
index f6580a9..79c8ef0 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -181,9 +181,7 @@ static void crondlog(unsigned level, const char *msg, va_list va)
                 * need not touch syslog_level
                 * (they are ok with LOG_ERR default).
                 */
-               syslog_level = LOG_INFO;
-               bb_verror_msg(msg, va, /* strerr: */ NULL);
-               syslog_level = LOG_ERR;
+               bb_vinfo_msg(msg, va);
        }
 }

diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 814714f..a1ed144 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -343,7 +343,7 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";

 /* Busybox stuff */
 #if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG
-#define info_logger(p, fmt, args...)                 bb_error_msg(fmt, ## args)
+#define info_logger(p, fmt, args...)                 bb_info_msg(fmt, ## args)
 #define msg_logger(p, fmt, args...)                  bb_error_msg(fmt, ## args)
 #define msg_logger_and_die(p, fmt, args...)          bb_error_msg_and_die(fmt, ## args)
 #define error_logger(p, fmt, args...)                bb_perror_msg(fmt, ## args)
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 9a67d24..d12f5e8 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -326,7 +326,7 @@ static int run_script(const char *action)
        char *argv[5];
        int r;

-       bb_error_msg("executing '%s %s %s'", G.script_name, G.iface, action);
+       bb_info_msg("executing '%s %s %s'", G.script_name, G.iface, action);

        argv[0] = (char*) G.script_name;
        argv[1] = (char*) G.iface;
@@ -345,7 +345,7 @@ static int run_script(const char *action)
        bb_unsetenv_and_free(env_PREVIOUS);
        bb_unsetenv_and_free(env_CURRENT);

-       bb_error_msg("exit code: %d", r & 0xff);
+       bb_info_msg("exit code: %d", r & 0xff);
        return (option_mask32 & FLAG_IGNORE_RETVAL) ? 0 : r;
 }

@@ -365,7 +365,7 @@ static void up_iface(void)
        if (!(ifrequest.ifr_flags & IFF_UP)) {
                ifrequest.ifr_flags |= IFF_UP;
                /* Let user know we mess up with interface */
-               bb_error_msg("upping interface");
+               bb_info_msg("upping interface");
                if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) {
                        if (errno != ENODEV && errno != EADDRNOTAVAIL)
                                xfunc_die();
@@ -414,7 +414,7 @@ static void maybe_up_new_iface(void)
                                (uint8_t)(ifrequest.ifr_hwaddr.sa_data[5]));
                }

-               bb_error_msg("using interface %s%s with driver<%s> (version: %s)",
+               bb_info_msg("using interface %s%s with driver<%s> (version: %s)",
                        G.iface, buf, driver_info.driver, driver_info.version);
        }
 #endif
@@ -447,7 +447,7 @@ static smallint detect_link(void)
                        logmode = sv_logmode;
                        if (status != IFSTATUS_ERR) {
                                G.api_method_num = i;
-                               bb_error_msg("using %s detection mode", method_table[i].name);
+                               bb_info_msg("using %s detection mode", method_table[i].name);
                                break;
                        }
                }
@@ -632,7 +632,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
                /* | (1 << SIGCHLD) - run_script does not use it anymore */
                , record_signo);

-       bb_error_msg("started: %s", bb_banner);
+       bb_info_msg("started: %s", bb_banner);

        if (opts & FLAG_MONITOR) {
                struct ifreq ifrequest;
@@ -649,7 +649,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
        iface_status_str = strstatus(iface_status);

        if (opts & FLAG_MONITOR) {
-               bb_error_msg("interface %s",
+               bb_info_msg("interface %s",
                        G.iface_exists ? "exists"
                        : "doesn't exist, waiting");
        }
@@ -657,7 +657,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
         * by potentially lying that it really exists */

        if (G.iface_exists) {
-               bb_error_msg("link is %s", iface_status_str);
+               bb_info_msg("link is %s", iface_status_str);
        }

        if ((!(opts & FLAG_NO_STARTUP)
@@ -712,7 +712,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
                        if (G.iface_exists < 0) /* error */
                                goto exiting;
                        if (iface_exists_old != G.iface_exists) {
-                               bb_error_msg("interface %sappeared",
+                               bb_info_msg("interface %sappeared",
                                                G.iface_exists ? "" : "dis");
                                if (G.iface_exists)
                                        maybe_up_new_iface();
@@ -730,7 +730,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
                iface_status_str = strstatus(iface_status);

                if (iface_status_old != iface_status) {
-                       bb_error_msg("link is %s", iface_status_str);
+                       bb_info_msg("link is %s", iface_status_str);

                        if (delay_time) {
                                /* link restored its old status before
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 6cd4970..aa65769 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1037,7 +1037,7 @@ step_time(double offset)
        }
        tval = tvn.tv_sec;
        strftime_YYYYMMDDHHMMSS(buf, sizeof(buf), &tval);
-       bb_error_msg("setting time to %s.%06u (offset %+fs)", buf, (unsigned)tvn.tv_usec, offset);
+       bb_info_msg("setting time to %s.%06u (offset %+fs)", buf, (unsigned)tvn.tv_usec, offset);
        //maybe? G.FREQHOLD_cnt = 0;

        /* Correct various fields which contain time-relative values: */
@@ -2020,7 +2020,7 @@ recv_and_process_peer_pkt(peer_t *p)

        p->reachable_bits |= 1;
        if ((MAX_VERBOSE && G.verbose) || (option_mask32 & OPT_w)) {
-               bb_error_msg("reply from %s: offset:%+f delay:%f status:0x%02x strat:%d refid:0x%08x rootdelay:%f reach:0x%02x",
+               bb_info_msg("reply from %s: offset:%+f delay:%f status:0x%02x strat:%d refid:0x%08x rootdelay:%f reach:0x%02x",
                        p->p_dotted,
                        offset,
                        p->lastpkt_delay,
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index fbf9c68..77ccd13 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -185,7 +185,7 @@ static void log_option(const char *pfx, const uint8_t *opt)
        if (dhcp_verbose >= 2) {
                char buf[256 * 2 + 2];
                *bin2hex(buf, (void*) (opt + OPT_DATA), opt[OPT_LEN]) = '\0';
-               bb_error_msg("%s: 0x%02x %s", pfx, opt[OPT_CODE], buf);
+               bb_info_msg("%s: 0x%02x %s", pfx, opt[OPT_CODE], buf);
        }
 }
 #else
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 13059f1..88a4f37 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -263,16 +263,16 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code)
 #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
 # define IF_UDHCP_VERBOSE(...) __VA_ARGS__
 extern unsigned dhcp_verbose;
-# define log1(...) do { if (dhcp_verbose >= 1) bb_error_msg(__VA_ARGS__); } while (0)
+# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0)
 # if CONFIG_UDHCP_DEBUG >= 2
 void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC;
-#  define log2(...) do { if (dhcp_verbose >= 2) bb_error_msg(__VA_ARGS__); } while (0)
+#  define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0)
 # else
 #  define udhcp_dump_packet(...) ((void)0)
 #  define log2(...) ((void)0)
 # endif
 # if CONFIG_UDHCP_DEBUG >= 3
-#  define log3(...) do { if (dhcp_verbose >= 3) bb_error_msg(__VA_ARGS__); } while (0)
+#  define log3(...) do { if (dhcp_verbose >= 3) bb_info_msg(__VA_ARGS__); } while (0)
 # else
 #  define log3(...) ((void)0)
 # endif
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 85d9da7..458a22c 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -596,7 +596,7 @@ static NOINLINE int send_d6_discover(uint32_t xid, struct in6_addr *requested_ip
         */
        opt_ptr = add_d6_client_options(opt_ptr);

-       bb_error_msg("sending %s", "discover");
+       bb_info_msg("sending %s", "discover");
        return d6_mcast_from_client_config_ifindex(&packet, opt_ptr);
 }

@@ -653,7 +653,7 @@ static NOINLINE int send_d6_select(uint32_t xid)
         */
        opt_ptr = add_d6_client_options(opt_ptr);

-       bb_error_msg("sending %s", "select");
+       bb_info_msg("sending %s", "select");
        return d6_mcast_from_client_config_ifindex(&packet, opt_ptr);
 }

@@ -726,7 +726,7 @@ static NOINLINE int send_d6_renew(uint32_t xid, struct in6_addr *server_ipv6, st
         */
        opt_ptr = add_d6_client_options(opt_ptr);

-       bb_error_msg("sending %s", "renew");
+       bb_info_msg("sending %s", "renew");
        if (server_ipv6) {
                return d6_send_kernel_packet(
                        &packet, (opt_ptr - (uint8_t*) &packet),
@@ -756,7 +756,7 @@ static int send_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cu
        if (client6_data.ia_pd)
                opt_ptr = mempcpy(opt_ptr, client6_data.ia_pd, client6_data.ia_pd->len + 2+2);

-       bb_error_msg("sending %s", "release");
+       bb_info_msg("sending %s", "release");
        return d6_send_kernel_packet(
                &packet, (opt_ptr - (uint8_t*) &packet),
                our_cur_ipv6, CLIENT_PORT6,
@@ -960,7 +960,7 @@ static void change_listen_mode(int new_mode)
 /* Called only on SIGUSR1 */
 static void perform_renew(void)
 {
-       bb_error_msg("performing DHCP renew");
+       bb_info_msg("performing DHCP renew");
        switch (state) {
        case BOUND:
                change_listen_mode(LISTEN_KERNEL);
@@ -988,10 +988,10 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou
         || state == REBINDING
         || state == RENEW_REQUESTED
        ) {
-               bb_error_msg("unicasting a release");
+               bb_info_msg("unicasting a release");
                send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */
        }
-       bb_error_msg("entering released state");
+       bb_info_msg("entering released state");
 /*
  * We can be here on: SIGUSR2,
  * or on exit (SIGTERM) and -R "release on quit" is specified.
@@ -1199,7 +1199,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
        /* Create pidfile */
        write_pidfile(client_config.pidfile);
        /* Goes to stdout (unless NOMMU) and possibly syslog */
-       bb_error_msg("started, v"BB_VER);
+       bb_info_msg("started, v"BB_VER);
        /* Set up the signal pipe */
        udhcp_sp_setup();

@@ -1288,14 +1288,14 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                d6_run_script(NULL, "leasefail");
 #if BB_MMU /* -b is not supported on NOMMU */
                                if (opt & OPT_b) { /* background if no lease */
-                                       bb_error_msg("no lease, forking to background");
+                                       bb_info_msg("no lease, forking to background");
                                        client_background();
                                        /* do not background again! */
                                        opt = ((opt & ~OPT_b) | OPT_f);
                                } else
 #endif
                                if (opt & OPT_n) { /* abort if no lease */
-                                       bb_error_msg("no lease, failing");
+                                       bb_info_msg("no lease, failing");
                                        retval = 1;
                                        goto ret;
                                }
@@ -1358,7 +1358,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Timed out, enter init state */
-                               bb_error_msg("lease lost, entering init state");
+                               bb_info_msg("lease lost, entering init state");
                                d6_run_script(NULL, "deconfig");
                                state = INIT_SELECTING;
                                client_config.first_secs = 0; /* make secs field count from 0 */
@@ -1405,7 +1405,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                        timeout = INT_MAX;
                        continue;
                case SIGTERM:
-                       bb_error_msg("received %s", "SIGTERM");
+                       bb_info_msg("received %s", "SIGTERM");
                        goto ret0;
                }

@@ -1465,7 +1465,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE);
                                if (option && (option->data[0] | option->data[1]) != 0) {
                                        /* return to init state */
-                                       bb_error_msg("received DHCP NAK (%u)", option->data[4]);
+                                       bb_info_msg("received DHCP NAK (%u)", option->data[4]);
                                        d6_run_script(&packet, "nak");
                                        if (state != REQUESTING)
                                                d6_run_script(NULL, "deconfig");
@@ -1618,7 +1618,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                        move_from_unaligned32(lease_seconds, iaaddr->data + 16 + 4);
                                        lease_seconds = ntohl(lease_seconds);
 /// TODO: check for 0 lease time?
-                                       bb_error_msg("%s obtained, lease time %u",
+                                       bb_info_msg("%s obtained, lease time %u",
                                                "IPv6", /*inet_ntoa(temp_addr),*/ (unsigned)lease_seconds);
                                        address_timeout = lease_seconds;
                                }
@@ -1651,7 +1651,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                        }
                                        move_from_unaligned32(lease_seconds, iaprefix->data + 4);
                                        lease_seconds = ntohl(lease_seconds);
-                                       bb_error_msg("%s obtained, lease time %u",
+                                       bb_info_msg("%s obtained, lease time %u",
                                                "prefix", /*inet_ntoa(temp_addr),*/ (unsigned)lease_seconds);
                                        prefix_timeout = lease_seconds;
                                }
diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c
index 493943d..01d1c93 100644
--- a/networking/udhcp/d6_packet.c
+++ b/networking/udhcp/d6_packet.c
@@ -17,7 +17,7 @@ void FAST_FUNC d6_dump_packet(struct d6_packet *packet)
        if (dhcp_verbose < 2)
                return;

-       bb_error_msg(
+       bb_info_msg(
                " xid %x"
                , packet->d6_xid32
        );
@@ -40,7 +40,7 @@ int FAST_FUNC d6_recv_kernel_packet(struct in6_addr *peer_ipv6
        }

        if (bytes < offsetof(struct d6_packet, d6_options)) {
-               bb_error_msg("packet with bad magic, ignoring");
+               bb_info_msg("packet with bad magic, ignoring");
                return -2;
        }
        log1("received %s", "a packet");
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index bd9e8fd..1ee8c18 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -728,7 +728,7 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
         */
        add_client_options(&packet);

-       bb_error_msg("sending %s", "discover");
+       bb_info_msg("sending %s", "discover");
        return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
 }

@@ -772,7 +772,7 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste
        add_client_options(&packet);

        temp_addr.s_addr = requested;
-       bb_error_msg("sending select for %s", inet_ntoa(temp_addr));
+       bb_info_msg("sending select for %s", inet_ntoa(temp_addr));
        return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
 }

@@ -813,7 +813,7 @@ static NOINLINE int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
        add_client_options(&packet);

        temp_addr.s_addr = server;
-       bb_error_msg("sending renew to %s", inet_ntoa(temp_addr));
+       bb_info_msg("sending renew to %s", inet_ntoa(temp_addr));
        return bcast_or_ucast(&packet, ciaddr, server);
 }

@@ -842,7 +842,7 @@ static NOINLINE int send_decline(/*uint32_t xid,*/ uint32_t server, uint32_t req

        udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);

-       bb_error_msg("sending %s", "decline");
+       bb_info_msg("sending %s", "decline");
        return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
 }
 #endif
@@ -862,7 +862,7 @@ static int send_release(uint32_t server, uint32_t ciaddr)

        udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);

-       bb_error_msg("sending %s", "release");
+       bb_info_msg("sending %s", "release");
        /* Note: normally we unicast here since "server" is not zero.
         * However, there _are_ people who run "address-less" DHCP servers,
         * and reportedly ISC dhcp client and Windows allow that.
@@ -965,7 +965,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
  skip_udp_sum_check:

        if (packet.data.cookie != htonl(DHCP_MAGIC)) {
-               bb_error_msg("packet with bad magic, ignoring");
+               bb_info_msg("packet with bad magic, ignoring");
                return -2;
        }

@@ -1113,7 +1113,7 @@ static void change_listen_mode(int new_mode)
 /* Called only on SIGUSR1 */
 static void perform_renew(void)
 {
-       bb_error_msg("performing DHCP renew");
+       bb_info_msg("performing DHCP renew");
        switch (state) {
        case BOUND:
                change_listen_mode(LISTEN_KERNEL);
@@ -1147,11 +1147,11 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip)
                temp_addr.s_addr = server_addr;
                strcpy(buffer, inet_ntoa(temp_addr));
                temp_addr.s_addr = requested_ip;
-               bb_error_msg("unicasting a release of %s to %s",
+               bb_info_msg("unicasting a release of %s to %s",
                                inet_ntoa(temp_addr), buffer);
                send_release(server_addr, requested_ip); /* unicast */
        }
-       bb_error_msg("entering released state");
+       bb_info_msg("entering released state");
 /*
  * We can be here on: SIGUSR2,
  * or on exit (SIGTERM) and -R "release on quit" is specified.
@@ -1384,7 +1384,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
        /* Create pidfile */
        write_pidfile(client_config.pidfile);
        /* Goes to stdout (unless NOMMU) and possibly syslog */
-       bb_error_msg("started, v"BB_VER);
+       bb_info_msg("started, v"BB_VER);
        /* Set up the signal pipe */
        udhcp_sp_setup();
        /* We want random_xid to be random... */
@@ -1474,14 +1474,14 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                udhcp_run_script(NULL, "leasefail");
 #if BB_MMU /* -b is not supported on NOMMU */
                                if (opt & OPT_b) { /* background if no lease */
-                                       bb_error_msg("no lease, forking to background");
+                                       bb_info_msg("no lease, forking to background");
                                        client_background();
                                        /* do not background again! */
                                        opt = ((opt & ~OPT_b) | OPT_f);
                                } else
 #endif
                                if (opt & OPT_n) { /* abort if no lease */
-                                       bb_error_msg("no lease, failing");
+                                       bb_info_msg("no lease, failing");
                                        retval = 1;
                                        goto ret;
                                }
@@ -1557,7 +1557,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Timed out, enter init state */
-                               bb_error_msg("lease lost, entering init state");
+                               bb_info_msg("lease lost, entering init state");
                                udhcp_run_script(NULL, "deconfig");
                                state = INIT_SELECTING;
                                client_config.first_secs = 0; /* make secs field count from 0 */
@@ -1604,7 +1604,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                        timeout = INT_MAX;
                        continue;
                case SIGTERM:
-                       bb_error_msg("received %s", "SIGTERM");
+                       bb_info_msg("received %s", "SIGTERM");
                        goto ret0;
                }

@@ -1747,7 +1747,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                                        client_config.interface,
                                                        arpping_ms)
                                        ) {
-                                               bb_error_msg("offered address is in use "
+                                               bb_info_msg("offered address is in use "
                                                        "(got ARP reply), declining");
                                                send_decline(/*xid,*/ server_addr, packet.yiaddr);

@@ -1766,7 +1766,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
 #endif
                                /* enter bound state */
                                temp_addr.s_addr = packet.yiaddr;
-                               bb_error_msg("lease of %s obtained, lease time %u",
+                               bb_info_msg("lease of %s obtained, lease time %u",
                                        inet_ntoa(temp_addr), (unsigned)lease_seconds);
                                requested_ip = packet.yiaddr;

@@ -1819,7 +1819,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                                goto non_matching_svid;
                                }
                                /* return to init state */
-                               bb_error_msg("received %s", "DHCP NAK");
+                               bb_info_msg("received %s", "DHCP NAK");
                                udhcp_run_script(&packet, "nak");
                                if (state != REQUESTING)
                                        udhcp_run_script(NULL, "deconfig");
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 19f94a2..9fb163c 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -104,7 +104,7 @@ static void log_static_leases(struct static_lease **st_lease_pp)

        cur = *st_lease_pp;
        while (cur) {
-               bb_error_msg("static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x",
+               bb_info_msg("static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x",
                        cur->mac[0], cur->mac[1], cur->mac[2],
                        cur->mac[3], cur->mac[4], cur->mac[5],
                        cur->nip
@@ -242,7 +242,7 @@ static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac, unsigne
                return r;

        temp.s_addr = nip;
-       bb_error_msg("%s belongs to someone, reserving it for %u seconds",
+       bb_info_msg("%s belongs to someone, reserving it for %u seconds",
                inet_ntoa(temp), (unsigned)server_config.conflict_time);
        add_lease(NULL, nip, server_config.conflict_time, NULL, 0);
        return 0;
@@ -721,7 +721,7 @@ static NOINLINE void send_offer(struct dhcp_packet *oldpacket,
        add_server_options(&packet);

        addr.s_addr = packet.yiaddr;
-       bb_error_msg("sending OFFER of %s", inet_ntoa(addr));
+       bb_info_msg("sending OFFER of %s", inet_ntoa(addr));
        /* send_packet emits error message itself if it detects failure */
        send_packet(&packet, /*force_bcast:*/ 0);
 }
@@ -754,7 +754,7 @@ static NOINLINE void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr)
        add_server_options(&packet);

        addr.s_addr = yiaddr;
-       bb_error_msg("sending ACK to %s", inet_ntoa(addr));
+       bb_info_msg("sending ACK to %s", inet_ntoa(addr));
        send_packet(&packet, /*force_bcast:*/ 0);

        p_host_name = (const char*) udhcp_get_option(oldpacket, DHCP_HOST_NAME);
@@ -864,7 +864,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
        write_pidfile(server_config.pidfile);
        /* if (!..) bb_perror_msg("can't create pidfile %s", pidfile); */

-       bb_error_msg("started, v"BB_VER);
+       bb_info_msg("started, v"BB_VER);

        option = udhcp_find_option(server_config.options, DHCP_LEASE_TIME);
        server_config.max_lease_sec = DEFAULT_LEASE_TIME;
@@ -943,12 +943,12 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)

                if (pfds[0].revents) switch (udhcp_sp_read()) {
                case SIGUSR1:
-                       bb_error_msg("received %s", "SIGUSR1");
+                       bb_info_msg("received %s", "SIGUSR1");
                        write_leases();
                        /* why not just reset the timeout, eh */
                        goto continue_with_autotime;
                case SIGTERM:
-                       bb_error_msg("received %s", "SIGTERM");
+                       bb_info_msg("received %s", "SIGTERM");
                        write_leases();
                        goto ret0;
                }
@@ -1000,7 +1000,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
                /* Look for a static/dynamic lease */
                static_lease_nip = get_static_nip_by_mac(server_config.static_leases, &packet.chaddr);
                if (static_lease_nip) {
-                       bb_error_msg("found static lease: %x", static_lease_nip);
+                       bb_info_msg("found static lease: %x", static_lease_nip);
                        memcpy(&fake_lease.lease_mac, &packet.chaddr, 6);
                        fake_lease.lease_nip = static_lease_nip;
                        fake_lease.expires = 0;
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index fc2bb54..f740387 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -40,7 +40,7 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
        if (dhcp_verbose < 2)
                return;

-       bb_error_msg(
+       bb_info_msg(
                //" op %x"
                //" htype %x"
                " hlen %x"
@@ -73,7 +73,7 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
                //, packet->options[]
        );
        *bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
-       bb_error_msg(" chaddr %s", buf);
+       bb_info_msg(" chaddr %s", buf);
 }
 #endif

@@ -92,7 +92,7 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd)
        if (bytes < offsetof(struct dhcp_packet, options)
         || packet->cookie != htonl(DHCP_MAGIC)
        ) {
-               bb_error_msg("packet with bad magic, ignoring");
+               bb_info_msg("packet with bad magic, ignoring");
                return -2;
        }
        log1("received %s", "a packet");
diff --git a/networking/zcip.c b/networking/zcip.c
index 94e49ad..7ca7eb7 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -195,7 +195,7 @@ static int run(char *argv[3], const char *param, uint32_t nip)
                putenv(env_ip);
                fmt -= 3;
        }
-       bb_error_msg(fmt, argv[2], argv[0], addr);
+       bb_info_msg(fmt, argv[2], argv[0], addr);
        status = spawn_and_wait(argv + 1);
        if (nip != 0)
                bb_unsetenv_and_free(env_ip);
@@ -339,7 +339,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
 #if BB_MMU
                bb_daemonize(0 /*was: DAEMON_CHDIR_ROOT*/);
 #endif
-               bb_error_msg("start, interface %s", argv_intf);
+               bb_info_msg("start, interface %s", argv_intf);
        }

        // Run the dynamic address negotiation protocol,
--
2.7.4

The contents of this email and any attachment are confidential to the intended recipient(s). If you are not an intended recipient: (i) do not use, disclose, distribute, copy or publish this email or its contents; (ii) please contact the sender immediately; and (iii) delete this email. Origami Energy Limited (company number 8619644); Origami Storage Limited (company number 10436515) and OSSPV001 Limited (company number 10933403), each registered in England and each with a registered office at: Ashcombe Court, Woolsack Way, Godalming, GU7 1LQ.


More information about the busybox mailing list