- if (opt & OPT_a) {
- if (!arpping(packet.yiaddr,
- (uint32_t) 0,
- client_config.arp,
- client_config.interface)
- ) {
- bb_info_msg("offered address is in use "
- "(got ARP reply), declining");
- send_decline(xid, server_addr, packet.yiaddr);
-
- if (state != REQUESTING)
- udhcp_run_script(NULL, "deconfig");
- change_listen_mode(LISTEN_RAW);
- state = INIT_SELECTING;
- requested_ip = 0;
- timeout = tryagain_timeout;
- packet_num = 0;
- continue; /* back to main loop */
- }
+ if (opt & OPT_a) {
+/* RFC 2131 3.1 paragraph 5:
+ * "The client receives the DHCPACK message with configuration
+ * parameters. The client SHOULD perform a final check on the
+ * parameters (e.g., ARP for allocated network address), and notes
+ * the duration of the lease specified in the DHCPACK message. At this
+ * point, the client is configured. If the client detects that the
+ * address is already in use (e.g., through the use of ARP),
+ * the client MUST send a DHCPDECLINE message to the server and restarts
+ * the configuration process..." */
+ if (!arpping(packet.yiaddr,
+ NULL,
+ (uint32_t) 0,
+ client_config.client_mac,
+ client_config.interface)
+ ) {
+ bb_info_msg("Offered address is in use "
+ "(got ARP reply), declining");
+ send_decline(xid, server_addr, packet.yiaddr);
+
+ if (state != REQUESTING)
+ udhcp_run_script(NULL, "deconfig");
+ change_listen_mode(LISTEN_RAW);
+ state = INIT_SELECTING;
+ requested_ip = 0;
+ timeout = tryagain_timeout;
+ packet_num = 0;
+ already_waited_sec = 0;
+ continue; /* back to main loop */