/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* INIT_REBOOT state of the DHCP client state machine.
*/
#include <stdio.h>
#include <limits.h>
#include <dhcpmsg.h>
#include <string.h>
#include "agent.h"
#include "packet.h"
#include "states.h"
#include "util.h"
#include "interface.h"
#include "defaults.h"
/*
* dhcp_init_reboot_v4(): attempts to reuse a cached configuration for a state
* machine.
*
* input: dhcp_smach_t *: the state machine to examine for reuse
* output: void
*/
static void
{
const char *reqhost;
/*
* assemble DHCPREQUEST message. The max dhcp message size
* option is set to the interface max, minus the size of the udp and
* ip headers.
*/
if (class_id_len != 0)
/*
* Set CD_HOSTNAME option if REQUEST_HOSTNAME is set and a hostname
*/
else
" allocate memory for host name option");
} else {
"dhcp_selecting: no hostname for %s",
}
}
}
/*
* dhcp_init_reboot_v6(): attempts to reuse a cached configuration for a state
* machine. Create a Confirm message and multicast it
* out.
*
* input: dhcp_smach_t *: the state machine to examine for reuse
* output: void
*/
static void
{
char *obase;
/*
* Assemble a Confirm message based on the current ack.
*/
/*
* Loop over and copy IA_NAs and IAADDRs we have in our last ack. This
* is what we'll be requesting.
*/
/*
* Copy in IA_NA option from the ack. Note that we use zero
* for all timers in accordance with RFC 3315. (It would make
* some sense to say what we think the current timers are as
* a hint to the server, but the RFC doesn't agree.)
*/
if (olen < sizeof (dhcpv6_ia_na_t))
continue;
goto failure;
/*
* Now loop over the IAADDR suboptions and add those.
*/
olen -= sizeof (dhcpv6_ia_na_t);
if (solen < sizeof (dhcpv6_iaaddr_t))
continue;
d6ia.d6ia_preflife = 0;
d6ia.d6ia_vallife = 0;
goto failure;
}
}
/* Add required Option Request option */
return;
if (!set_start_timer(dsmp))
}
/*
* dhcp_init_reboot(): attempts to reuse a cached configuration for a state
* machine.
*
* input: dhcp_smach_t *: the state machine to examine for reuse
* output: void
*/
void
{
return;
}
else
}
/*
* stop_init_reboot(): decides when to stop retransmitting REQUESTs
*
* input: dhcp_smach_t *: the state machine sending the REQUESTs
* unsigned int: the number of REQUESTs sent so far
* output: boolean_t: B_TRUE if retransmissions should stop
*/
static boolean_t
{
/* Cap the timer based on the maximum */
return (B_FALSE);
}
} else {
if (n_requests < DHCP_MAX_REQUESTS)
return (B_FALSE);
}
"unable to verify existing lease on %s; restarting",
return (B_TRUE);
}
} else {
}
/*
* We already stuck our old ack in dsmp->dsm_ack and relativized the
* packet times, so we can just pretend that the server sent it to us
* and move to bound. If that fails, fall back to selecting.
*/
goto failure;
}
} else {
}
return (B_TRUE);
}