int maxfd = (sigfd.rd > gstate.listensock)? sigfd.rd : gstate.listensock;
dbg("select waiting ....\n");
+ if (tv.tv_sec < 0) {
+ dbg("timestmp: %u waited: %u tv_sec: %u, reset tv_sec to default value\n", timestmp, waited, tv.tv_sec);
+ waited = 0;
+ tv.tv_sec = gconfig.auto_time - waited;
+ tv.tv_usec = 0;
+ }
+
retval = select(maxfd + 1, &rfds, NULL, NULL, (gconfig.auto_time?&tv:NULL));
if (retval < 0) {
if (errno == EINTR) {
msgtype = DHCPNAK;
optptr = set_optval(optptr, DHCP_OPT_MESSAGE_TYPE, &msgtype, 1);
send_packet(1);
+ dbg("Send Message Type : DHCPNAK\n");
break;
}
get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options,
optptr = set_optval(optptr, DHCP_OPT_LEASE_TIME, &reqested_lease, 4);
optptr = set_reqparam(optptr, gstate.rqopt);
send_packet(1);
+ dbg("Send Message Type : DHCPOFFER\n");
break;
case DHCPREQUEST:
msgtype = DHCPACK;
msgtype = DHCPNAK;
optptr = set_optval(optptr, DHCP_OPT_MESSAGE_TYPE, &msgtype, 1);
send_packet(1);
+ dbg("Send Message Type : DHCPNAK\n");
break;
}
get_reqparam(&gstate.rqopt);
optptr = set_optval(optptr, DHCP_OPT_LEASE_TIME, &reqested_lease, 4);
optptr = set_reqparam(optptr, gstate.rqopt);
send_packet(1);
+ dbg("Send Message Type : DHCPACK\n");
write_leasefile();
break;
case DHCPDECLINE:// FALL THROUGH