udhcpc[6]: make log2 messages for chaddr field indented like the rest
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 29 Sep 2017 16:02:01 +0000 (18:02 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 29 Sep 2017 16:02:01 +0000 (18:02 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/udhcp/d6_packet.c
networking/udhcp/dhcpc.c
networking/udhcp/packet.c

index a0656c1dab54989cef71cac161e7f4fcb9bb4a97..493943d72f434999a4a052bad5111afc730a3bcb 100644 (file)
@@ -18,7 +18,7 @@ void FAST_FUNC d6_dump_packet(struct d6_packet *packet)
                return;
 
        bb_error_msg(
                return;
 
        bb_error_msg(
-               "xid %x"
+               " xid %x"
                , packet->d6_xid32
        );
        //*bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
                , packet->d6_xid32
        );
        //*bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
index 2ae8bcc4de6337a52489e690308948815229cde8..4548d4ac7df5e6799171516eb85dd82f37297cbb 100644 (file)
@@ -1534,6 +1534,13 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                         */
                                        if (send_renew(xid, server_addr, requested_ip) >= 0) {
                                                timeout >>= 1;
                         */
                                        if (send_renew(xid, server_addr, requested_ip) >= 0) {
                                                timeout >>= 1;
+//TODO: the timeout to receive an answer for our renew should not be selected
+//with "timeout = lease_seconds / 2; ...; timeout = timeout / 2": it is often huge.
+//Waiting e.g. 4*3600 seconds for a reply does not make sense
+//(if reply isn't coming, we keep an open socket for hours),
+//it should be something like 10 seconds.
+//Also, it's probably best to try sending renew in kernel mode a few (3-5) times
+//and fall back to raw mode if it does not work.
                                                continue;
                                        }
                                        /* else: error sending.
                                                continue;
                                        }
                                        /* else: error sending.
index ad0028bd04f6a399732732e5e1f7ab905bc3361c..fc2bb5416da73a60a3d2e2d2b1377e490054ea5a 100644 (file)
@@ -41,7 +41,7 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
                return;
 
        bb_error_msg(
                return;
 
        bb_error_msg(
-               //"op %x"
+               //" op %x"
                //" htype %x"
                " hlen %x"
                //" hops %x"
                //" htype %x"
                " hlen %x"
                //" hops %x"
@@ -52,7 +52,6 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
                " yiaddr %x"
                " siaddr %x"
                " giaddr %x"
                " yiaddr %x"
                " siaddr %x"
                " giaddr %x"
-               //" chaddr %s"
                //" sname %s"
                //" file %s"
                //" cookie %x"
                //" sname %s"
                //" file %s"
                //" cookie %x"
@@ -68,14 +67,13 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
                , packet->yiaddr
                , packet->siaddr_nip
                , packet->gateway_nip
                , packet->yiaddr
                , packet->siaddr_nip
                , packet->gateway_nip
-               //, packet->chaddr[16]
                //, packet->sname[64]
                //, packet->file[128]
                //, packet->cookie
                //, packet->options[]
        );
        *bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
                //, packet->sname[64]
                //, packet->file[128]
                //, packet->cookie
                //, packet->options[]
        );
        *bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0';
-       bb_error_msg("chaddr %s", buf);
+       bb_error_msg(" chaddr %s", buf);
 }
 #endif
 
 }
 #endif