mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-03 15:56:00 +00:00
change prototypes to functions called by timeouts; initialize bootp_handler to do_packet(); lose relay() function call (not needed now that we have bootp_handler hook.
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: dhclient.c,v 1.30 1997/03/05 08:38:02 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: dhclient.c,v 1.31 1997/03/06 06:48:09 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -205,8 +205,12 @@ int main (argc, argv, envp)
|
|||||||
state_reboot (ip);
|
state_reboot (ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set up the bootp packet handler... */
|
||||||
|
bootp_packet_handler = do_packet;
|
||||||
|
|
||||||
/* Start dispatching packets and timeouts... */
|
/* Start dispatching packets and timeouts... */
|
||||||
dispatch (1);
|
dispatch ();
|
||||||
|
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -220,13 +224,6 @@ void cleanup ()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void relay (ip, packet, length)
|
|
||||||
struct interface_info *ip;
|
|
||||||
struct dhcp_packet *packet;
|
|
||||||
int length;
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Individual States:
|
/* Individual States:
|
||||||
*
|
*
|
||||||
* Each routine is called from the dhclient_state_machine() in one of
|
* Each routine is called from the dhclient_state_machine() in one of
|
||||||
@@ -256,9 +253,11 @@ void relay (ip, packet, length)
|
|||||||
* can no longer legitimately use the lease.
|
* can no longer legitimately use the lease.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void state_reboot (ip)
|
void state_reboot (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
/* If we don't remember an active lease, go straight to INIT. */
|
/* If we don't remember an active lease, go straight to INIT. */
|
||||||
if (!ip -> client -> active ||
|
if (!ip -> client -> active ||
|
||||||
ip -> client -> active -> rebind < cur_time) {
|
ip -> client -> active -> rebind < cur_time) {
|
||||||
@@ -285,9 +284,11 @@ void state_reboot (ip)
|
|||||||
/* Called when a lease has completely expired and we've been unable to
|
/* Called when a lease has completely expired and we've been unable to
|
||||||
renew it. */
|
renew it. */
|
||||||
|
|
||||||
void state_init (ip)
|
void state_init (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
ASSERT_STATE(state, S_INIT);
|
ASSERT_STATE(state, S_INIT);
|
||||||
|
|
||||||
/* Make a DHCPDISCOVER packet, and set appropriate per-interface
|
/* Make a DHCPDISCOVER packet, and set appropriate per-interface
|
||||||
@@ -307,9 +308,11 @@ void state_init (ip)
|
|||||||
/* state_selecting is called when one or more DHCPOFFER packets have been
|
/* state_selecting is called when one or more DHCPOFFER packets have been
|
||||||
received and a configurable period of time has passed. */
|
received and a configurable period of time has passed. */
|
||||||
|
|
||||||
void state_selecting (ip)
|
void state_selecting (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
struct client_lease *lp, *next, *picked;
|
struct client_lease *lp, *next, *picked;
|
||||||
|
|
||||||
ASSERT_STATE(state, S_SELECTING);
|
ASSERT_STATE(state, S_SELECTING);
|
||||||
@@ -488,9 +491,11 @@ void dhcpack (packet)
|
|||||||
expected to unicast a DHCPREQUEST to the server that gave us our
|
expected to unicast a DHCPREQUEST to the server that gave us our
|
||||||
original lease. */
|
original lease. */
|
||||||
|
|
||||||
void state_bound (ip)
|
void state_bound (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
ASSERT_STATE(state, S_BOUND);
|
ASSERT_STATE(state, S_BOUND);
|
||||||
|
|
||||||
/* T1 has expired. */
|
/* T1 has expired. */
|
||||||
@@ -669,8 +674,10 @@ void dhcpoffer (packet)
|
|||||||
state_selecting at the select interval. */
|
state_selecting at the select interval. */
|
||||||
if (stop_selecting <= 0)
|
if (stop_selecting <= 0)
|
||||||
state_selecting (ip);
|
state_selecting (ip);
|
||||||
else
|
else {
|
||||||
add_timeout (stop_selecting, state_selecting, ip);
|
add_timeout (stop_selecting, state_selecting, ip);
|
||||||
|
cancel_timeout (send_discover, ip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a client_lease structure and initialize it from the parameters
|
/* Allocate a client_lease structure and initialize it from the parameters
|
||||||
@@ -806,9 +813,11 @@ void dhcpnak (packet)
|
|||||||
the message; otherwise broadcast it. If the lease expires, go back to
|
the message; otherwise broadcast it. If the lease expires, go back to
|
||||||
the INIT state. */
|
the INIT state. */
|
||||||
|
|
||||||
void send_discover (ip)
|
void send_discover (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
int interval;
|
int interval;
|
||||||
int increase = 1;
|
int increase = 1;
|
||||||
@@ -902,9 +911,11 @@ void send_discover (ip)
|
|||||||
haven't yet expired, and failing that, we call the client script and
|
haven't yet expired, and failing that, we call the client script and
|
||||||
hope it can do something. */
|
hope it can do something. */
|
||||||
|
|
||||||
void state_panic (ip)
|
void state_panic (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
struct client_lease *loop = ip -> client -> active;
|
struct client_lease *loop = ip -> client -> active;
|
||||||
struct client_lease *lp;
|
struct client_lease *lp;
|
||||||
|
|
||||||
@@ -993,9 +1004,11 @@ void state_panic (ip)
|
|||||||
state_init, ip);
|
state_init, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_request (ip)
|
void send_request (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
int interval;
|
int interval;
|
||||||
struct sockaddr_in destination;
|
struct sockaddr_in destination;
|
||||||
@@ -1106,9 +1119,11 @@ void send_request (ip)
|
|||||||
send_request, ip);
|
send_request, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_decline (ip)
|
void send_decline (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
note ("DHCPDECLINE on %s to %s port %d", ip -> name,
|
note ("DHCPDECLINE on %s to %s port %d", ip -> name,
|
||||||
@@ -1125,9 +1140,11 @@ void send_decline (ip)
|
|||||||
warn ("send_packet: %m");
|
warn ("send_packet: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_release (ip)
|
void send_release (ipp)
|
||||||
struct interface_info *ip;
|
void *ipp;
|
||||||
{
|
{
|
||||||
|
struct interface_info *ip = ipp;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
note ("DHCPRELEASE on %s to %s port %d", ip -> name,
|
note ("DHCPRELEASE on %s to %s port %d", ip -> name,
|
||||||
|
Reference in New Issue
Block a user