summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index dfd5ca6..660b943 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");