aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/arpping.c2
-rw-r--r--networking/udhcp/common.c8
-rw-r--r--networking/udhcp/common.h6
-rw-r--r--networking/udhcp/d6_dhcpc.c60
-rw-r--r--networking/udhcp/d6_packet.c10
-rw-r--r--networking/udhcp/d6_socket.c2
-rw-r--r--networking/udhcp/dhcpc.c70
-rw-r--r--networking/udhcp/dhcpd.c34
-rw-r--r--networking/udhcp/files.c2
-rw-r--r--networking/udhcp/leases.c2
-rw-r--r--networking/udhcp/packet.c12
-rw-r--r--networking/udhcp/socket.c4
-rw-r--r--networking/udhcp/static_leases.c2
13 files changed, 107 insertions, 107 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index fad2283c3..c98027316 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -132,6 +132,6 @@ int FAST_FUNC arpping(uint32_t test_nip,
ret:
close(s);
- log1("%srp reply received for this address", rv ? "No a" : "A");
+ log1("%srp reply received for this address", rv ? "no a" : "A");
return rv;
}
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 680852ce4..1c1863451 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -183,7 +183,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_info_msg("%s: 0x%02x %s", pfx, opt[OPT_CODE], buf);
+ bb_error_msg("%s: 0x%02x %s", pfx, opt[OPT_CODE], buf);
}
}
#else
@@ -269,7 +269,7 @@ uint8_t* FAST_FUNC udhcp_get_option(struct dhcp_packet *packet, int code)
}
/* log3 because udhcpc uses it a lot - very noisy */
- log3("Option 0x%02x not found", code);
+ log3("option 0x%02x not found", code);
return NULL;
}
@@ -402,7 +402,7 @@ static NOINLINE void attach_option(
struct option_set *new, **curr;
/* make a new option */
- log2("Attaching option %02x to list", optflag->code);
+ log2("attaching option %02x to list", optflag->code);
new = xmalloc(sizeof(*new));
new->data = xmalloc(length + OPT_DATA);
new->data[OPT_CODE] = optflag->code;
@@ -422,7 +422,7 @@ static NOINLINE void attach_option(
unsigned old_len;
/* add it to an existing option */
- log2("Attaching option %02x to existing member of list", optflag->code);
+ log2("attaching option %02x to existing member of list", optflag->code);
old_len = existing->data[OPT_LEN];
if (old_len + length < 255) {
/* actually 255 is ok too, but adding a space can overlow it */
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index d20659e2f..496ab11a1 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -256,16 +256,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_info_msg(__VA_ARGS__); } while (0)
+# define log1(...) do { if (dhcp_verbose >= 1) bb_error_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_info_msg(__VA_ARGS__); } while (0)
+# define log2(...) do { if (dhcp_verbose >= 2) bb_error_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_info_msg(__VA_ARGS__); } while (0)
+# define log3(...) do { if (dhcp_verbose >= 3) bb_error_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 4e9b705b9..422254d62 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -251,7 +251,7 @@ static void d6_run_script(struct d6_packet *packet, const char *name)
envp = fill_envp(packet);
/* call script */
- log1("Executing %s %s", client_config.script, name);
+ log1("executing %s %s", client_config.script, name);
argv[0] = (char*) client_config.script;
argv[1] = (char*) name;
argv[2] = NULL;
@@ -428,7 +428,7 @@ static NOINLINE int send_d6_discover(uint32_t xid, struct in6_addr *requested_ip
*/
opt_ptr = add_d6_client_options(opt_ptr);
- bb_info_msg("Sending discover...");
+ bb_error_msg("sending %s", "discover");
return d6_mcast_from_client_config_ifindex(&packet, opt_ptr);
}
@@ -481,7 +481,7 @@ static NOINLINE int send_d6_select(uint32_t xid)
*/
opt_ptr = add_d6_client_options(opt_ptr);
- bb_info_msg("Sending select...");
+ bb_error_msg("sending %s", "select");
return d6_mcast_from_client_config_ifindex(&packet, opt_ptr);
}
@@ -550,7 +550,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_info_msg("Sending renew...");
+ bb_error_msg("sending %s", "renew");
if (server_ipv6)
return d6_send_kernel_packet(
&packet, (opt_ptr - (uint8_t*) &packet),
@@ -573,7 +573,7 @@ static int send_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cu
/* IA NA (contains our current IP) */
opt_ptr = d6_store_blob(opt_ptr, client6_data.ia_na, client6_data.ia_na->len + 2+2);
- bb_info_msg("Sending release...");
+ bb_error_msg("sending %s", "release");
return d6_send_kernel_packet(
&packet, (opt_ptr - (uint8_t*) &packet),
our_cur_ipv6, CLIENT_PORT6,
@@ -592,19 +592,19 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6
bytes = safe_read(fd, &packet, sizeof(packet));
if (bytes < 0) {
- log1("Packet read error, ignoring");
+ log1("packet read error, ignoring");
/* NB: possible down interface, etc. Caller should pause. */
return bytes; /* returns -1 */
}
if (bytes < (int) (sizeof(packet.ip6) + sizeof(packet.udp))) {
- log1("Packet is too short, ignoring");
+ log1("packet is too short, ignoring");
return -2;
}
if (bytes < sizeof(packet.ip6) + ntohs(packet.ip6.ip6_plen)) {
/* packet is bigger than sizeof(packet), we did partial read */
- log1("Oversized packet, ignoring");
+ log1("oversized packet, ignoring");
return -2;
}
@@ -618,7 +618,7 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6
/* || bytes > (int) sizeof(packet) - can't happen */
|| packet.udp.len != packet.ip6.ip6_plen
) {
- log1("Unrelated/bogus packet, ignoring");
+ log1("unrelated/bogus packet, ignoring");
return -2;
}
@@ -630,11 +630,11 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6
// check = packet.udp.check;
// packet.udp.check = 0;
// if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
-// log1("Packet with bad UDP checksum received, ignoring");
+// log1("packet with bad UDP checksum received, ignoring");
// return -2;
// }
- log1("Received a packet");
+ log1("received %s", "a packet");
d6_dump_packet(&packet.data);
bytes -= sizeof(packet.ip6) + sizeof(packet.udp);
@@ -722,10 +722,10 @@ static int d6_raw_socket(int ifindex)
};
#endif
- log1("Opening raw socket on ifindex %d", ifindex); //log2?
+ log1("opening raw socket on ifindex %d", ifindex); //log2?
fd = xsocket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IPV6));
- log1("Got raw socket fd %d", fd); //log2?
+ log1("got raw socket fd %d", fd); //log2?
sock.sll_family = AF_PACKET;
sock.sll_protocol = htons(ETH_P_IPV6);
@@ -738,18 +738,18 @@ static int d6_raw_socket(int ifindex)
/* Ignoring error (kernel may lack support for this) */
if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter_prog,
sizeof(filter_prog)) >= 0)
- log1("Attached filter to raw socket fd %d", fd); // log?
+ log1("attached filter to raw socket fd %d", fd); // log?
}
#endif
- log1("Created raw socket");
+ log1("created raw socket");
return fd;
}
static void change_listen_mode(int new_mode)
{
- log1("Entering listen mode: %s",
+ log1("entering listen mode: %s",
new_mode != LISTEN_NONE
? (new_mode == LISTEN_KERNEL ? "kernel" : "raw")
: "none"
@@ -770,7 +770,7 @@ static void change_listen_mode(int new_mode)
/* Called only on SIGUSR1 */
static void perform_renew(void)
{
- bb_info_msg("Performing a DHCP renew");
+ bb_error_msg("performing DHCP renew");
switch (state) {
case BOUND:
change_listen_mode(LISTEN_KERNEL);
@@ -794,11 +794,11 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou
{
/* send release packet */
if (state == BOUND || state == RENEWING || state == REBINDING) {
- bb_info_msg("Unicasting a release");
+ bb_error_msg("unicasting a release");
send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */
d6_run_script(NULL, "deconfig");
}
- bb_info_msg("Entering released state");
+ bb_error_msg("entering released state");
change_listen_mode(LISTEN_NONE);
state = RELEASED;
@@ -1034,7 +1034,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_info_msg("%s (v"BB_VER") started", applet_name);
+ bb_error_msg("started, v"BB_VER);
/* Set up the signal pipe */
udhcp_sp_setup();
/* We want random_xid to be random... */
@@ -1074,7 +1074,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
retval = 0;
/* If we already timed out, fall through with retval = 0, else... */
if ((int)tv.tv_sec > 0) {
- log1("Waiting on select %u seconds", (int)tv.tv_sec);
+ log1("waiting on select %u seconds", (int)tv.tv_sec);
timestamp_before_wait = (unsigned)monotonic_sec();
retval = select(max_fd + 1, &rfds, NULL, NULL, &tv);
if (retval < 0) {
@@ -1124,14 +1124,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_info_msg("No lease, forking to background");
+ bb_error_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_info_msg("No lease, failing");
+ bb_error_msg("no lease, failing");
retval = 1;
goto ret;
}
@@ -1159,7 +1159,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
state = RENEWING;
client_config.first_secs = 0; /* make secs field count from 0 */
change_listen_mode(LISTEN_KERNEL);
- log1("Entering renew state");
+ log1("entering renew state");
/* fall right through */
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
case_RENEW_REQUESTED:
@@ -1179,7 +1179,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
continue;
}
/* Timed out, enter rebinding state */
- log1("Entering rebinding state");
+ log1("entering rebinding state");
state = REBINDING;
/* fall right through */
case REBINDING:
@@ -1194,7 +1194,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
continue;
}
/* Timed out, enter init state */
- bb_info_msg("Lease lost, entering init state");
+ bb_error_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 */
@@ -1242,7 +1242,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
timeout = INT_MAX;
continue;
case SIGTERM:
- bb_info_msg("Received SIGTERM");
+ bb_error_msg("received %s", "SIGTERM");
goto ret0;
}
@@ -1260,7 +1260,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
len = d6_recv_raw_packet(&srv6_buf, &packet, sockfd);
if (len == -1) {
/* Error is severe, reopen socket */
- bb_info_msg("Read error: %s, reopening socket", strerror(errno));
+ bb_error_msg("read error: %s, reopening socket", strerror(errno));
sleep(discover_timeout); /* 3 seconds by default */
change_listen_mode(listen_mode); /* just close and reopen */
}
@@ -1298,7 +1298,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[4] != 0) {
/* return to init state */
- bb_info_msg("Received DHCP NAK (%u)", option->data[4]);
+ bb_error_msg("received DHCP NAK (%u)", option->data[4]);
d6_run_script(&packet, "nak");
if (state != REQUESTING)
d6_run_script(NULL, "deconfig");
@@ -1453,7 +1453,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
lease_seconds = 0x0fffffff;
/* enter bound state */
timeout = lease_seconds / 2;
- bb_info_msg("Lease obtained, lease time %u",
+ bb_error_msg("lease obtained, lease time %u",
/*inet_ntoa(temp_addr),*/ (unsigned)lease_seconds);
d6_run_script(&packet, state == REQUESTING ? "bound" : "renew");
diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c
index b340b5db6..e166f520d 100644
--- a/networking/udhcp/d6_packet.c
+++ b/networking/udhcp/d6_packet.c
@@ -17,8 +17,8 @@ void FAST_FUNC d6_dump_packet(struct d6_packet *packet)
if (dhcp_verbose < 2)
return;
- bb_info_msg(
- " xid %x"
+ bb_error_msg(
+ "xid %x"
, packet->d6_xid32
);
//*bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
@@ -35,15 +35,15 @@ int FAST_FUNC d6_recv_kernel_packet(struct in6_addr *peer_ipv6
memset(packet, 0, sizeof(*packet));
bytes = safe_read(fd, packet, sizeof(*packet));
if (bytes < 0) {
- log1("Packet read error, ignoring");
+ log1("packet read error, ignoring");
return bytes; /* returns -1 */
}
if (bytes < offsetof(struct d6_packet, d6_options)) {
- bb_info_msg("Packet with bad magic, ignoring");
+ bb_error_msg("packet with bad magic, ignoring");
return -2;
}
- log1("Received a packet");
+ log1("received %s", "a packet");
d6_dump_packet(packet);
return bytes;
diff --git a/networking/udhcp/d6_socket.c b/networking/udhcp/d6_socket.c
index 56f69f6a1..910f296a3 100644
--- a/networking/udhcp/d6_socket.c
+++ b/networking/udhcp/d6_socket.c
@@ -13,7 +13,7 @@ int FAST_FUNC d6_listen_socket(int port, const char *inf)
int fd;
struct sockaddr_in6 addr;
- log1("Opening listen socket on *:%d %s", port, inf);
+ log1("opening listen socket on *:%d %s", port, inf);
fd = xsocket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
setsockopt_reuseaddr(fd);
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index dfd5ca606..660b943ce 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -561,7 +561,7 @@ static void udhcp_run_script(struct dhcp_packet *packet, const char *name)
envp = fill_envp(packet);
/* call script */
- log1("Executing %s %s", client_config.script, name);
+ log1("executing %s %s", client_config.script, name);
argv[0] = (char*) client_config.script;
argv[1] = (char*) name;
argv[2] = NULL;
@@ -714,7 +714,7 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
*/
add_client_options(&packet);
- bb_info_msg("Sending discover...");
+ bb_error_msg("sending %s", "discover");
return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
}
@@ -758,7 +758,7 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste
add_client_options(&packet);
addr.s_addr = requested;
- bb_info_msg("Sending select for %s...", inet_ntoa(addr));
+ bb_error_msg("sending select for %s", inet_ntoa(addr));
return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
}
@@ -797,7 +797,7 @@ static NOINLINE int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
*/
add_client_options(&packet);
- bb_info_msg("Sending renew...");
+ bb_error_msg("sending %s", "renew");
return bcast_or_ucast(&packet, ciaddr, server);
}
@@ -826,7 +826,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_info_msg("Sending decline...");
+ bb_error_msg("sending %s", "decline");
return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
}
#endif
@@ -846,7 +846,7 @@ static int send_release(uint32_t server, uint32_t ciaddr)
udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);
- bb_info_msg("Sending release...");
+ bb_error_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.
@@ -881,7 +881,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
if (bytes < 0) {
if (errno == EINTR)
continue;
- log1("Packet read error, ignoring");
+ log1("packet read error, ignoring");
/* NB: possible down interface, etc. Caller should pause. */
return bytes; /* returns -1 */
}
@@ -889,13 +889,13 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
}
if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) {
- log1("Packet is too short, ignoring");
+ log1("packet is too short, ignoring");
return -2;
}
if (bytes < ntohs(packet.ip.tot_len)) {
/* packet is bigger than sizeof(packet), we did partial read */
- log1("Oversized packet, ignoring");
+ log1("oversized packet, ignoring");
return -2;
}
@@ -910,7 +910,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
/* || bytes > (int) sizeof(packet) - can't happen */
|| ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip))
) {
- log1("Unrelated/bogus packet, ignoring");
+ log1("unrelated/bogus packet, ignoring");
return -2;
}
@@ -918,7 +918,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
check = packet.ip.check;
packet.ip.check = 0;
if (check != inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip))) {
- log1("Bad IP header checksum, ignoring");
+ log1("bad IP header checksum, ignoring");
return -2;
}
@@ -943,17 +943,17 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
check = packet.udp.check;
packet.udp.check = 0;
if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
- log1("Packet with bad UDP checksum received, ignoring");
+ log1("packet with bad UDP checksum received, ignoring");
return -2;
}
skip_udp_sum_check:
if (packet.data.cookie != htonl(DHCP_MAGIC)) {
- bb_info_msg("Packet with bad magic, ignoring");
+ bb_error_msg("packet with bad magic, ignoring");
return -2;
}
- log1("Received a packet");
+ log1("received %s", "a packet");
udhcp_dump_packet(&packet.data);
bytes -= sizeof(packet.ip) + sizeof(packet.udp);
@@ -992,14 +992,14 @@ static int udhcp_raw_socket(int ifindex)
int fd;
struct sockaddr_ll sock;
- log1("Opening raw socket on ifindex %d", ifindex); //log2?
+ log1("opening raw socket on ifindex %d", ifindex); //log2?
fd = xsocket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
/* ^^^^^
* SOCK_DGRAM: remove link-layer headers on input (SOCK_RAW keeps them)
* ETH_P_IP: want to receive only packets with IPv4 eth type
*/
- log1("Got raw socket fd"); //log2?
+ log1("got raw socket fd"); //log2?
sock.sll_family = AF_PACKET;
sock.sll_protocol = htons(ETH_P_IP);
@@ -1055,23 +1055,23 @@ static int udhcp_raw_socket(int ifindex)
/* Ignoring error (kernel may lack support for this) */
if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter_prog,
sizeof(filter_prog)) >= 0)
- log1("Attached filter to raw socket fd"); // log?
+ log1("attached filter to raw socket fd"); // log?
}
#endif
if (setsockopt_1(fd, SOL_PACKET, PACKET_AUXDATA) != 0) {
if (errno != ENOPROTOOPT)
- log1("Can't set PACKET_AUXDATA on raw socket");
+ log1("can't set PACKET_AUXDATA on raw socket");
}
- log1("Created raw socket");
+ log1("created raw socket");
return fd;
}
static void change_listen_mode(int new_mode)
{
- log1("Entering listen mode: %s",
+ log1("entering listen mode: %s",
new_mode != LISTEN_NONE
? (new_mode == LISTEN_KERNEL ? "kernel" : "raw")
: "none"
@@ -1092,7 +1092,7 @@ static void change_listen_mode(int new_mode)
/* Called only on SIGUSR1 */
static void perform_renew(void)
{
- bb_info_msg("Performing a DHCP renew");
+ bb_error_msg("performing DHCP renew");
switch (state) {
case BOUND:
change_listen_mode(LISTEN_KERNEL);
@@ -1122,12 +1122,12 @@ 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_info_msg("Unicasting a release of %s to %s",
+ bb_error_msg("unicasting a release of %s to %s",
inet_ntoa(temp_addr), buffer);
send_release(server_addr, requested_ip); /* unicast */
udhcp_run_script(NULL, "deconfig");
}
- bb_info_msg("Entering released state");
+ bb_error_msg("entering released state");
change_listen_mode(LISTEN_NONE);
state = RELEASED;
@@ -1395,7 +1395,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_info_msg("%s (v"BB_VER") started", applet_name);
+ bb_error_msg("started, v"BB_VER);
/* Set up the signal pipe */
udhcp_sp_setup();
/* We want random_xid to be random... */
@@ -1434,7 +1434,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
retval = 0;
/* If we already timed out, fall through with retval = 0, else... */
if ((int)tv.tv_sec > 0) {
- log1("Waiting on select %u seconds", (int)tv.tv_sec);
+ log1("waiting on select %u seconds", (int)tv.tv_sec);
timestamp_before_wait = (unsigned)monotonic_sec();
retval = select(max_fd + 1, &rfds, NULL, NULL, &tv);
if (retval < 0) {
@@ -1485,14 +1485,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_info_msg("No lease, forking to background");
+ bb_error_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_info_msg("No lease, failing");
+ bb_error_msg("no lease, failing");
retval = 1;
goto ret;
}
@@ -1520,7 +1520,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
state = RENEWING;
client_config.first_secs = 0; /* make secs field count from 0 */
change_listen_mode(LISTEN_KERNEL);
- log1("Entering renew state");
+ log1("entering renew state");
/* fall right through */
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
case_RENEW_REQUESTED:
@@ -1540,7 +1540,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
continue;
}
/* Timed out, enter rebinding state */
- log1("Entering rebinding state");
+ log1("entering rebinding state");
state = REBINDING;
/* fall right through */
case REBINDING:
@@ -1555,7 +1555,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
continue;
}
/* Timed out, enter init state */
- bb_info_msg("Lease lost, entering init state");
+ bb_error_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 */
@@ -1603,7 +1603,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
timeout = INT_MAX;
continue;
case SIGTERM:
- bb_info_msg("Received SIGTERM");
+ bb_error_msg("received %s", "SIGTERM");
goto ret0;
}
@@ -1621,7 +1621,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
len = udhcp_recv_raw_packet(&packet, sockfd);
if (len == -1) {
/* Error is severe, reopen socket */
- bb_info_msg("Read error: %s, reopening socket", strerror(errno));
+ bb_error_msg("read error: %s, reopening socket", strerror(errno));
sleep(discover_timeout); /* 3 seconds by default */
change_listen_mode(listen_mode); /* just close and reopen */
}
@@ -1744,7 +1744,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
client_config.interface,
arpping_ms)
) {
- bb_info_msg("Offered address is in use "
+ bb_error_msg("offered address is in use "
"(got ARP reply), declining");
send_decline(/*xid,*/ server_addr, packet.yiaddr);
@@ -1763,7 +1763,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
#endif
/* enter bound state */
temp_addr.s_addr = packet.yiaddr;
- bb_info_msg("Lease of %s obtained, lease time %u",
+ bb_error_msg("lease of %s obtained, lease time %u",
inet_ntoa(temp_addr), (unsigned)lease_seconds);
requested_ip = packet.yiaddr;
@@ -1817,7 +1817,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
goto non_matching_svid;
}
/* return to init state */
- bb_info_msg("Received DHCP NAK");
+ bb_error_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 2de074f9b..79677ee93 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -61,11 +61,11 @@ static void send_packet_to_client(struct dhcp_packet *dhcp_pkt, int force_broadc
|| (dhcp_pkt->flags & htons(BROADCAST_FLAG))
|| dhcp_pkt->ciaddr == 0
) {
- log1("Broadcasting packet to client");
+ log1("broadcasting packet to client");
ciaddr = INADDR_BROADCAST;
chaddr = MAC_BCAST_ADDR;
} else {
- log1("Unicasting packet to client ciaddr");
+ log1("unicasting packet to client ciaddr");
ciaddr = dhcp_pkt->ciaddr;
chaddr = dhcp_pkt->chaddr;
}
@@ -79,7 +79,7 @@ static void send_packet_to_client(struct dhcp_packet *dhcp_pkt, int force_broadc
/* Send a packet to gateway_nip using the kernel ip stack */
static void send_packet_to_relay(struct dhcp_packet *dhcp_pkt)
{
- log1("Forwarding packet to relay");
+ log1("forwarding packet to relay");
udhcp_send_kernel_packet(dhcp_pkt,
server_config.server_nip, SERVER_PORT,
@@ -214,7 +214,7 @@ static NOINLINE void send_offer(struct dhcp_packet *oldpacket,
add_server_options(&packet);
addr.s_addr = packet.yiaddr;
- bb_info_msg("Sending OFFER of %s", inet_ntoa(addr));
+ bb_error_msg("sending OFFER of %s", inet_ntoa(addr));
/* send_packet emits error message itself if it detects failure */
send_packet(&packet, /*force_bcast:*/ 0);
}
@@ -226,7 +226,7 @@ static NOINLINE void send_NAK(struct dhcp_packet *oldpacket)
init_packet(&packet, oldpacket, DHCPNAK);
- log1("Sending NAK");
+ log1("sending NAK");
send_packet(&packet, /*force_bcast:*/ 1);
}
@@ -247,7 +247,7 @@ static NOINLINE void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr)
add_server_options(&packet);
addr.s_addr = yiaddr;
- bb_info_msg("Sending ACK to %s", inet_ntoa(addr));
+ bb_error_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);
@@ -361,7 +361,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_info_msg("%s (v"BB_VER") started", applet_name);
+ bb_error_msg("started, v"BB_VER);
option = udhcp_find_option(server_config.options, DHCP_LEASE_TIME);
server_config.max_lease_sec = DEFAULT_LEASE_TIME;
@@ -427,18 +427,18 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
goto continue_with_autotime;
}
if (retval < 0 && errno != EINTR) {
- log1("Error on select");
+ log1("error on select");
continue;
}
switch (udhcp_sp_read(&rfds)) {
case SIGUSR1:
- bb_info_msg("Received SIGUSR1");
+ bb_error_msg("received %s", "SIGUSR1");
write_leases();
/* why not just reset the timeout, eh */
goto continue_with_autotime;
case SIGTERM:
- bb_info_msg("Received SIGTERM");
+ bb_error_msg("received %s", "SIGTERM");
write_leases();
goto ret0;
case 0: /* no signal: read a packet */
@@ -451,7 +451,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
if (bytes < 0) {
/* bytes can also be -2 ("bad packet data") */
if (bytes == -1 && errno != EINTR) {
- log1("Read error: %s, reopening socket", strerror(errno));
+ log1("read error: %s, reopening socket", strerror(errno));
close(server_socket);
server_socket = -1;
}
@@ -486,7 +486,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_info_msg("Found static lease: %x", static_lease_nip);
+ bb_error_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;
@@ -504,13 +504,13 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
switch (state[0]) {
case DHCPDISCOVER:
- log1("Received DISCOVER");
+ log1("received %s", "DISCOVER");
send_offer(&packet, static_lease_nip, lease, requested_ip_opt, arpping_ms);
break;
case DHCPREQUEST:
- log1("Received REQUEST");
+ log1("received %s", "REQUEST");
/* RFC 2131:
o DHCPREQUEST generated during SELECTING state:
@@ -635,7 +635,7 @@ o DHCPREQUEST generated during REBINDING state:
* chaddr must be filled in,
* ciaddr must be 0 (we do not check this)
*/
- log1("Received DECLINE");
+ log1("received %s", "DECLINE");
if (server_id_opt
&& requested_ip_opt
&& lease /* chaddr matches this lease */
@@ -655,7 +655,7 @@ o DHCPREQUEST generated during REBINDING state:
* chaddr must be filled in,
* ciaddr must be filled in
*/
- log1("Received RELEASE");
+ log1("received %s", "RELEASE");
if (server_id_opt
&& lease /* chaddr matches this lease */
&& packet.ciaddr == lease->lease_nip
@@ -665,7 +665,7 @@ o DHCPREQUEST generated during REBINDING state:
break;
case DHCPINFORM:
- log1("Received INFORM");
+ log1("received %s", "INFORM");
send_inform(&packet);
break;
}
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 5b90e26d2..7b57c6258 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -226,7 +226,7 @@ void FAST_FUNC read_leases(const char *file)
#endif
}
}
- log1("Read %d leases", i);
+ log1("read %d leases", i);
ret:
close(fd);
}
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 411b74962..6642e396d 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -133,7 +133,7 @@ static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac, unsigne
return r;
temp.s_addr = nip;
- bb_info_msg("%s belongs to someone, reserving it for %u seconds",
+ bb_error_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;
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 148f52551..0a31f2643 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -38,8 +38,8 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
if (dhcp_verbose < 2)
return;
- bb_info_msg(
- //" op %x"
+ bb_error_msg(
+ //"op %x"
//" htype %x"
" hlen %x"
//" hops %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_info_msg(" chaddr %s", buf);
+ bb_error_msg("chaddr %s", buf);
}
#endif
@@ -85,17 +85,17 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd)
memset(packet, 0, sizeof(*packet));
bytes = safe_read(fd, packet, sizeof(*packet));
if (bytes < 0) {
- log1("Packet read error, ignoring");
+ log1("packet read error, ignoring");
return bytes; /* returns -1 */
}
if (bytes < offsetof(struct dhcp_packet, options)
|| packet->cookie != htonl(DHCP_MAGIC)
) {
- bb_info_msg("Packet with bad magic, ignoring");
+ bb_error_msg("packet with bad magic, ignoring");
return -2;
}
- log1("Received a packet");
+ log1("received %s", "a packet");
udhcp_dump_packet(packet);
return bytes;
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index a42106960..4fd79f423 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -56,7 +56,7 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t
close(fd);
return -1;
}
- log1("Adapter index %d", ifr->ifr_ifindex);
+ log1("adapter index %d", ifr->ifr_ifindex);
*ifindex = ifr->ifr_ifindex;
}
@@ -82,7 +82,7 @@ int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
struct sockaddr_in addr;
char *colon;
- log1("Opening listen socket on *:%d %s", port, inf);
+ log1("opening listen socket on *:%d %s", port, inf);
fd = xsocket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
setsockopt_reuseaddr(fd);
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c
index f4a24ab62..b7f9e5c59 100644
--- a/networking/udhcp/static_leases.c
+++ b/networking/udhcp/static_leases.c
@@ -66,7 +66,7 @@ void FAST_FUNC log_static_leases(struct static_lease **st_lease_pp)
cur = *st_lease_pp;
while (cur) {
- bb_info_msg("static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x",
+ bb_error_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