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>
This commit is contained in:
committed by
Denys Vlasenko
parent
f3a064f495
commit
253c4e787a
@@ -191,7 +191,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
|
||||
|
||||
@@ -274,16 +274,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
|
||||
|
||||
@@ -670,7 +670,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);
|
||||
}
|
||||
|
||||
@@ -727,7 +727,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);
|
||||
}
|
||||
|
||||
@@ -800,7 +800,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),
|
||||
@@ -830,7 +830,7 @@ int send_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cur_ipv6)
|
||||
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,
|
||||
@@ -1033,7 +1033,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);
|
||||
@@ -1061,10 +1061,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.
|
||||
@@ -1274,7 +1274,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();
|
||||
|
||||
@@ -1363,7 +1363,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
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);
|
||||
@@ -1376,7 +1376,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
} 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;
|
||||
}
|
||||
@@ -1439,7 +1439,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_no_option("deconfig");
|
||||
state = INIT_SELECTING;
|
||||
client_config.first_secs = 0; /* make secs field count from 0 */
|
||||
@@ -1484,7 +1484,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;
|
||||
}
|
||||
|
||||
@@ -1544,7 +1544,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.d6_options,
|
||||
packet_end, "nak");
|
||||
if (state != REQUESTING)
|
||||
@@ -1561,7 +1561,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
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 */
|
||||
}
|
||||
@@ -1670,11 +1670,11 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
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;
|
||||
}
|
||||
@@ -1683,11 +1683,11 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
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;
|
||||
}
|
||||
@@ -1698,7 +1698,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;
|
||||
}
|
||||
@@ -1708,11 +1708,11 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
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;
|
||||
}
|
||||
@@ -1721,17 +1721,17 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
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;
|
||||
}
|
||||
@@ -1781,4 +1781,3 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
||||
/*if (client_config.pidfile) - remove_pidfile has its own check */
|
||||
remove_pidfile(client_config.pidfile);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -730,7 +730,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);
|
||||
}
|
||||
|
||||
@@ -774,7 +774,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);
|
||||
}
|
||||
|
||||
@@ -815,7 +815,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);
|
||||
}
|
||||
|
||||
@@ -844,7 +844,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
|
||||
@@ -866,7 +866,7 @@ 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.
|
||||
@@ -969,7 +969,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;
|
||||
}
|
||||
|
||||
@@ -1117,7 +1117,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);
|
||||
@@ -1151,11 +1151,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.
|
||||
@@ -1391,7 +1391,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... */
|
||||
@@ -1481,7 +1481,7 @@ 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_n)) | OPT_f);
|
||||
@@ -1494,7 +1494,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
} 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;
|
||||
}
|
||||
@@ -1570,7 +1570,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 */
|
||||
@@ -1615,7 +1615,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;
|
||||
}
|
||||
|
||||
@@ -1662,7 +1662,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1691,7 +1691,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
* 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.
|
||||
@@ -1699,7 +1699,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
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);
|
||||
@@ -1726,7 +1726,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
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" */
|
||||
@@ -1759,7 +1759,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);
|
||||
|
||||
@@ -1778,7 +1778,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;
|
||||
|
||||
@@ -1831,7 +1831,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");
|
||||
|
||||
@@ -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;
|
||||
@@ -722,7 +722,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);
|
||||
}
|
||||
@@ -755,7 +755,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);
|
||||
@@ -865,7 +865,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;
|
||||
@@ -944,12 +944,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;
|
||||
}
|
||||
@@ -973,16 +973,16 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1001,7 +1001,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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user