diff options
-rw-r--r-- | networking/udhcp/dhcpc.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 922c71ebd..f1f6720f3 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -729,7 +729,7 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested) | |||
729 | */ | 729 | */ |
730 | add_client_options(&packet); | 730 | add_client_options(&packet); |
731 | 731 | ||
732 | bb_info_msg("sending %s", "discover"); | 732 | bb_simple_info_msg("broadcasting discover"); |
733 | return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY); | 733 | return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY); |
734 | } | 734 | } |
735 | 735 | ||
@@ -742,6 +742,7 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste | |||
742 | { | 742 | { |
743 | struct dhcp_packet packet; | 743 | struct dhcp_packet packet; |
744 | struct in_addr temp_addr; | 744 | struct in_addr temp_addr; |
745 | char server_str[sizeof("255.255.255.255")]; | ||
745 | 746 | ||
746 | /* | 747 | /* |
747 | * RFC 2131 4.3.2 DHCPREQUEST message | 748 | * RFC 2131 4.3.2 DHCPREQUEST message |
@@ -772,8 +773,13 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste | |||
772 | */ | 773 | */ |
773 | add_client_options(&packet); | 774 | add_client_options(&packet); |
774 | 775 | ||
776 | temp_addr.s_addr = server; | ||
777 | strcpy(server_str, inet_ntoa(temp_addr)); | ||
775 | temp_addr.s_addr = requested; | 778 | temp_addr.s_addr = requested; |
776 | bb_info_msg("sending select for %s", inet_ntoa(temp_addr)); | 779 | bb_info_msg("broadcasting select for %s, server %s", |
780 | inet_ntoa(temp_addr), | ||
781 | server_str | ||
782 | ); | ||
777 | return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY); | 783 | return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY); |
778 | } | 784 | } |
779 | 785 | ||
@@ -782,7 +788,6 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste | |||
782 | static NOINLINE int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) | 788 | static NOINLINE int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) |
783 | { | 789 | { |
784 | struct dhcp_packet packet; | 790 | struct dhcp_packet packet; |
785 | struct in_addr temp_addr; | ||
786 | 791 | ||
787 | /* | 792 | /* |
788 | * RFC 2131 4.3.2 DHCPREQUEST message | 793 | * RFC 2131 4.3.2 DHCPREQUEST message |
@@ -813,8 +818,14 @@ static NOINLINE int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) | |||
813 | */ | 818 | */ |
814 | add_client_options(&packet); | 819 | add_client_options(&packet); |
815 | 820 | ||
816 | temp_addr.s_addr = server; | 821 | if (server) { |
817 | bb_info_msg("sending renew to %s", inet_ntoa(temp_addr)); | 822 | struct in_addr temp_addr; |
823 | temp_addr.s_addr = server; | ||
824 | bb_info_msg("sending renew to server %s", inet_ntoa(temp_addr)); | ||
825 | } else { | ||
826 | bb_simple_info_msg("broadcasting renew"); | ||
827 | } | ||
828 | |||
818 | return bcast_or_ucast(&packet, ciaddr, server); | 829 | return bcast_or_ucast(&packet, ciaddr, server); |
819 | } | 830 | } |
820 | 831 | ||
@@ -843,7 +854,7 @@ static NOINLINE int send_decline(/*uint32_t xid,*/ uint32_t server, uint32_t req | |||
843 | 854 | ||
844 | udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); | 855 | udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); |
845 | 856 | ||
846 | bb_info_msg("sending %s", "decline"); | 857 | bb_simple_info_msg("broadcasting decline"); |
847 | return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY); | 858 | return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY); |
848 | } | 859 | } |
849 | #endif | 860 | #endif |
@@ -1720,6 +1731,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
1720 | unsigned start; | 1731 | unsigned start; |
1721 | uint32_t lease_seconds; | 1732 | uint32_t lease_seconds; |
1722 | struct in_addr temp_addr; | 1733 | struct in_addr temp_addr; |
1734 | char server_str[sizeof("255.255.255.255")]; | ||
1723 | uint8_t *temp; | 1735 | uint8_t *temp; |
1724 | 1736 | ||
1725 | temp = udhcp_get_option32(&packet, DHCP_LEASE_TIME); | 1737 | temp = udhcp_get_option32(&packet, DHCP_LEASE_TIME); |
@@ -1775,9 +1787,11 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
1775 | } | 1787 | } |
1776 | #endif | 1788 | #endif |
1777 | /* enter bound state */ | 1789 | /* enter bound state */ |
1790 | temp_addr.s_addr = server_addr; | ||
1791 | strcpy(server_str, inet_ntoa(temp_addr)); | ||
1778 | temp_addr.s_addr = packet.yiaddr; | 1792 | temp_addr.s_addr = packet.yiaddr; |
1779 | bb_info_msg("lease of %s obtained, lease time %u", | 1793 | bb_info_msg("lease of %s obtained from %s, lease time %u", |
1780 | inet_ntoa(temp_addr), (unsigned)lease_seconds); | 1794 | inet_ntoa(temp_addr), server_str, (unsigned)lease_seconds); |
1781 | requested_ip = packet.yiaddr; | 1795 | requested_ip = packet.yiaddr; |
1782 | 1796 | ||
1783 | start = monotonic_sec(); | 1797 | start = monotonic_sec(); |