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
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);
void bb_die_memory_exhausted(void) NORETURN FAST_FUNC;
void bb_logenv_override(void) FAST_FUNC;
+#if ENABLE_FEATURE_SYSLOG_INFO
+void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+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
*/
#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";
}
# if ENABLE_FEATURE_SYSLOG
if (logmode & LOGMODE_SYSLOG) {
- syslog(LOG_ERR, "%s", msgc);
+ syslog(syslog_level, "%s", msgc);
}
# endif
free(msgc);
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
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);
/* 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:
);
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());
* 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);
}
}
process_cron_update_file();
log5("wakeup dt=%ld", dt);
if (dt < -60 * 60 || dt > 60 * 60) {
- bb_error_msg("time disparity of %ld minutes detected", dt / 60);
+ bb_info_msg("time disparity of %ld minutes detected", dt / 60);
/* and we do not run any jobs in this case */
} else if (dt > 0) {
/* Usual case: time advances forward, as expected */
/* 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)
}
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);
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)) {
* 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);
{
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);
}
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)
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;
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;
}
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();
(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
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;
}
}
/* | (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;
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");
}
* 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)
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();
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
}
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: */
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->p_raw_delay,
return -1;
}
# if ENABLE_TFTP_DEBUG
- bb_error_msg("using blksize %u", blksize);
+ bb_info_msg("using blksize %u", blksize);
# endif
return blksize;
}
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
#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
*/
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);
}
*/
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);
}
*/
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),
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,
/* 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);
|| 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.
/* 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();
d6_run_script_no_option("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_n)) | 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;
}
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_no_option("deconfig");
state = INIT_SELECTING;
client_config.first_secs = 0; /* make secs field count from 0 */
timeout = INT_MAX;
continue;
case SIGTERM:
- bb_error_msg("received %s", "SIGTERM");
+ bb_info_msg("received %s", "SIGTERM");
goto ret0;
}
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.d6_options,
packet_end, "nak");
if (state != REQUESTING)
}
option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID);
if (!option) {
- bb_error_msg("no server ID, ignoring packet");
+ bb_info_msg("no server ID, ignoring packet");
continue;
/* still selecting - this server looks bad */
}
free(client6_data.ia_na);
client6_data.ia_na = d6_copy_option(packet.d6_options, packet_end, D6_OPT_IA_NA);
if (!client6_data.ia_na) {
- bb_error_msg("no %s option, ignoring packet", "IA_NA");
+ bb_info_msg("no %s option, ignoring packet", "IA_NA");
continue;
}
if (client6_data.ia_na->len < (4 + 4 + 4) + (2 + 2 + 16 + 4 + 4)) {
- bb_error_msg("%s option is too short:%d bytes",
+ bb_info_msg("%s option is too short:%d bytes",
"IA_NA", client6_data.ia_na->len);
continue;
}
D6_OPT_IAADDR
);
if (!iaaddr) {
- bb_error_msg("no %s option, ignoring packet", "IAADDR");
+ bb_info_msg("no %s option, ignoring packet", "IAADDR");
continue;
}
if (iaaddr->len < (16 + 4 + 4)) {
- bb_error_msg("%s option is too short:%d bytes",
+ bb_info_msg("%s option is too short:%d bytes",
"IAADDR", iaaddr->len);
continue;
}
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;
}
free(client6_data.ia_pd);
client6_data.ia_pd = d6_copy_option(packet.d6_options, packet_end, D6_OPT_IA_PD);
if (!client6_data.ia_pd) {
- bb_error_msg("no %s option, ignoring packet", "IA_PD");
+ bb_info_msg("no %s option, ignoring packet", "IA_PD");
continue;
}
if (client6_data.ia_pd->len < (4 + 4 + 4) + (2 + 2 + 4 + 4 + 1 + 16)) {
- bb_error_msg("%s option is too short:%d bytes",
+ bb_info_msg("%s option is too short:%d bytes",
"IA_PD", client6_data.ia_pd->len);
continue;
}
D6_OPT_IAPREFIX
);
if (!iaprefix) {
- bb_error_msg("no %s option, ignoring packet", "IAPREFIX");
+ bb_info_msg("no %s option, ignoring packet", "IAPREFIX");
continue;
}
if (iaprefix->len < (4 + 4 + 1 + 16)) {
- bb_error_msg("%s option is too short:%d bytes",
+ bb_info_msg("%s option is too short:%d bytes",
"IAPREFIX", iaprefix->len);
continue;
}
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;
}
/*if (client_config.pidfile) - remove_pidfile has its own check */
remove_pidfile(client_config.pidfile);
return retval;
-}
if (dhcp_verbose < 2)
return;
- bb_error_msg(
+ bb_info_msg(
" xid %x"
, packet->d6_xid32
);
}
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");
*/
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);
}
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);
}
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);
}
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
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.
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;
}
/* 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);
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.
/* 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... */
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_n)) | 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;
}
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 */
timeout = INT_MAX;
continue;
case SIGTERM:
- bb_error_msg("received %s", "SIGTERM");
+ bb_info_msg("received %s", "SIGTERM");
goto ret0;
}
message = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
if (message == NULL) {
- bb_error_msg("no message type option, ignoring packet");
+ bb_info_msg("no message type option, ignoring packet");
continue;
}
* might work too.
* "Next server" and router are definitely wrong ones to use, though...
*/
-/* We used to ignore pcakets without DHCP_SERVER_ID.
+/* We used to ignore packets without DHCP_SERVER_ID.
* I've got user reports from people who run "address-less" servers.
* They either supply DHCP_SERVER_ID of 0.0.0.0 or don't supply it at all.
* They say ISC DHCP client supports this case.
server_addr = 0;
temp = udhcp_get_option32(&packet, DHCP_SERVER_ID);
if (!temp) {
- bb_error_msg("no server ID, using 0.0.0.0");
+ bb_info_msg("no server ID, using 0.0.0.0");
} else {
/* it IS unaligned sometimes, don't "optimize" */
move_from_unaligned32(server_addr, temp);
temp = udhcp_get_option32(&packet, DHCP_LEASE_TIME);
if (!temp) {
- bb_error_msg("no lease time with ACK, using 1 hour lease");
+ bb_info_msg("no lease time with ACK, using 1 hour lease");
lease_seconds = 60 * 60;
} else {
/* it IS unaligned sometimes, don't "optimize" */
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);
#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;
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");
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
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;
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);
}
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);
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;
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;
}
continue;
}
if (packet.hlen != 6) {
- bb_error_msg("MAC length != 6, ignoring packet");
+ bb_info_msg("MAC length != 6, ignoring packet");
continue;
}
if (packet.op != BOOTREQUEST) {
- bb_error_msg("not a REQUEST, ignoring packet");
+ bb_info_msg("not a REQUEST, ignoring packet");
continue;
}
state = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
if (state == NULL || state[0] < DHCP_MINTYPE || state[0] > DHCP_MAXTYPE) {
- bb_error_msg("no or bad message type option, ignoring packet");
+ bb_info_msg("no or bad message type option, ignoring packet");
continue;
}
/* 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;
if (dhcp_verbose < 2)
return;
- bb_error_msg(
+ bb_info_msg(
//" op %x"
//" htype %x"
" hlen %x"
//, packet->options[]
);
*bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
- bb_error_msg(" chaddr %s", buf);
+ bb_info_msg(" chaddr %s", buf);
}
#endif
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");
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);
#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,