220 if (dsmp->dsm_isv6)
221 dhcp_init_reboot_v6(dsmp);
222 else
223 dhcp_init_reboot_v4(dsmp);
224 }
225
226 /*
227 * stop_init_reboot(): decides when to stop retransmitting REQUESTs
228 *
229 * input: dhcp_smach_t *: the state machine sending the REQUESTs
230 * unsigned int: the number of REQUESTs sent so far
231 * output: boolean_t: B_TRUE if retransmissions should stop
232 */
233
234 static boolean_t
235 stop_init_reboot(dhcp_smach_t *dsmp, unsigned int n_requests)
236 {
237 if (dsmp->dsm_isv6) {
238 uint_t nowabs, maxabs;
239
240 nowabs = gethrtime() / (NANOSEC / MILLISEC);
241 maxabs = dsmp->dsm_neg_hrtime / (NANOSEC / MILLISEC) +
242 DHCPV6_CNF_MAX_RD;
243 if (nowabs < maxabs) {
244 /* Cap the timer based on the maximum */
245 if (nowabs + dsmp->dsm_send_timeout > maxabs)
246 dsmp->dsm_send_timeout = maxabs - nowabs;
247 return (B_FALSE);
248 }
249 } else {
250 if (n_requests < DHCP_MAX_REQUESTS)
251 return (B_FALSE);
252 }
253
254 if (df_get_bool(dsmp->dsm_name, dsmp->dsm_isv6,
255 DF_VERIFIED_LEASE_ONLY)) {
256 dhcpmsg(MSG_INFO,
257 "unable to verify existing lease on %s; restarting",
258 dsmp->dsm_name);
259 dhcp_selecting(dsmp);
260 return (B_TRUE);
261 }
262
|
220 if (dsmp->dsm_isv6)
221 dhcp_init_reboot_v6(dsmp);
222 else
223 dhcp_init_reboot_v4(dsmp);
224 }
225
226 /*
227 * stop_init_reboot(): decides when to stop retransmitting REQUESTs
228 *
229 * input: dhcp_smach_t *: the state machine sending the REQUESTs
230 * unsigned int: the number of REQUESTs sent so far
231 * output: boolean_t: B_TRUE if retransmissions should stop
232 */
233
234 static boolean_t
235 stop_init_reboot(dhcp_smach_t *dsmp, unsigned int n_requests)
236 {
237 if (dsmp->dsm_isv6) {
238 uint_t nowabs, maxabs;
239
240 nowabs = NSEC2MSEC(gethrtime());
241 maxabs = NSEC2MSEC(dsmp->dsm_neg_hrtime) + DHCPV6_CNF_MAX_RD;
242 if (nowabs < maxabs) {
243 /* Cap the timer based on the maximum */
244 if (nowabs + dsmp->dsm_send_timeout > maxabs)
245 dsmp->dsm_send_timeout = maxabs - nowabs;
246 return (B_FALSE);
247 }
248 } else {
249 if (n_requests < DHCP_MAX_REQUESTS)
250 return (B_FALSE);
251 }
252
253 if (df_get_bool(dsmp->dsm_name, dsmp->dsm_isv6,
254 DF_VERIFIED_LEASE_ONLY)) {
255 dhcpmsg(MSG_INFO,
256 "unable to verify existing lease on %s; restarting",
257 dsmp->dsm_name);
258 dhcp_selecting(dsmp);
259 return (B_TRUE);
260 }
261
|