init_reboot.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* INIT_REBOOT state of the DHCP client state machine.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#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"
static stop_func_t stop_init_reboot;
/*
* dhcp_init_reboot(): attempts to reuse a cached configuration on an interface
*
* input: struct ifslist *: the interface to reuse the configuration on
* output: void
*/
void
{
const char *reqhost;
if (register_acknak(ifsp) == 0) {
return;
}
/*
* assemble DHCPREQUEST message. The max dhcp message size
* option is set to the interface max, minus the size of the udp and
* ip headers.
*/
sizeof (struct udpiphdr)));
/*
* Set CD_HOSTNAME option if REQUEST_HOSTNAME is set and a hostname
*/
else
" allocate memory for host name option");
}
}
}
/*
* stop_init_reboot(): decides when to stop retransmitting REQUESTs
*
* input: struct ifslist *: the interface REQUESTs are being sent on
* unsigned int: the number of REQUESTs sent so far
* output: boolean_t: B_TRUE if retransmissions should stop
*/
static boolean_t
{
if (n_requests >= DHCP_MAX_REQUESTS) {
(void) unregister_acknak(ifsp);
/*
* we already stuck our old ack in ifsp->if_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.
*/
return (B_TRUE);
}
return (B_FALSE);
}