mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 22:05:23 +00:00
Update message printing. Adjust scoped execution calls.
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: bootp.c,v 1.34 1998/11/09 02:45:59 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: bootp.c,v 1.35 1998/11/11 07:57:21 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"
|
||||||
@@ -65,22 +65,25 @@ void bootp (packet)
|
|||||||
int i;
|
int i;
|
||||||
struct data_string d1;
|
struct data_string d1;
|
||||||
struct option_cache *oc;
|
struct option_cache *oc;
|
||||||
|
char msgbuf [1024];
|
||||||
|
|
||||||
if (packet -> raw -> op != BOOTREQUEST)
|
if (packet -> raw -> op != BOOTREQUEST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
note ("BOOTREQUEST from %s via %s",
|
sprintf (msgbuf, "BOOTREQUEST from %s via %s",
|
||||||
print_hw_addr (packet -> raw -> htype,
|
print_hw_addr (packet -> raw -> htype,
|
||||||
packet -> raw -> hlen,
|
packet -> raw -> hlen,
|
||||||
packet -> raw -> chaddr),
|
packet -> raw -> chaddr),
|
||||||
packet -> raw -> giaddr.s_addr
|
packet -> raw -> giaddr.s_addr
|
||||||
? inet_ntoa (packet -> raw -> giaddr)
|
? inet_ntoa (packet -> raw -> giaddr)
|
||||||
: packet -> interface -> name);
|
: packet -> interface -> name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!locate_network (packet))
|
if (!locate_network (packet)) {
|
||||||
|
note ("%s: network unknown", msgbuf);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hp = find_hosts_by_haddr (packet -> raw -> htype,
|
hp = find_hosts_by_haddr (packet -> raw -> htype,
|
||||||
packet -> raw -> chaddr,
|
packet -> raw -> chaddr,
|
||||||
@@ -113,7 +116,7 @@ void bootp (packet)
|
|||||||
/* If a lease has already been assigned to this client,
|
/* If a lease has already been assigned to this client,
|
||||||
use it. */
|
use it. */
|
||||||
if (lease) {
|
if (lease) {
|
||||||
ack_lease (packet, lease, 0, 0);
|
ack_lease (packet, lease, 0, 0, msgbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,13 +125,10 @@ void bootp (packet)
|
|||||||
packet -> shared_network -> pools, 0);
|
packet -> shared_network -> pools, 0);
|
||||||
if (lease) {
|
if (lease) {
|
||||||
lease -> host = host;
|
lease -> host = host;
|
||||||
ack_lease (packet, lease, 0, 0);
|
ack_lease (packet, lease, 0, 0, msgbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
note ("No available leases for BOOTP client %s",
|
note ("%s: no available leases", msgbuf);
|
||||||
print_hw_addr (packet -> raw -> htype,
|
|
||||||
packet -> raw -> hlen,
|
|
||||||
packet -> raw -> chaddr));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,34 +138,26 @@ void bootp (packet)
|
|||||||
memset (&options, 0, sizeof options);
|
memset (&options, 0, sizeof options);
|
||||||
|
|
||||||
/* Execute the subnet statements. */
|
/* Execute the subnet statements. */
|
||||||
execute_statements_in_scope (packet, &options,
|
execute_statements_in_scope (packet, &options, &options,
|
||||||
lease -> subnet -> group,
|
lease -> subnet -> group,
|
||||||
(struct group *)0);
|
(struct group *)0);
|
||||||
|
|
||||||
/* Execute the host statements. */
|
/* Execute the host statements. */
|
||||||
execute_statements_in_scope (packet, &options, hp -> group,
|
execute_statements_in_scope (packet, &options, &options, hp -> group,
|
||||||
lease -> subnet -> group);
|
lease -> subnet -> group);
|
||||||
|
|
||||||
/* Drop the request if it's not allowed for this client. */
|
/* Drop the request if it's not allowed for this client. */
|
||||||
if (evaluate_boolean_option_cache (packet, &options,
|
if (evaluate_boolean_option_cache (packet, &options,
|
||||||
lookup_option (options.dhcp_hash,
|
lookup_option (options.dhcp_hash,
|
||||||
SV_ALLOW_BOOTP))) {
|
SV_ALLOW_BOOTP))) {
|
||||||
note ("Ignoring BOOTP client %s",
|
note ("%s: bootp disallowed", msgbuf);
|
||||||
print_hw_addr (packet -> raw -> htype,
|
|
||||||
packet -> raw -> hlen,
|
|
||||||
packet -> raw -> chaddr));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evaluate_boolean_option_cache (packet, &options,
|
if (evaluate_boolean_option_cache (packet, &options,
|
||||||
lookup_option (options.dhcp_hash,
|
lookup_option (options.dhcp_hash,
|
||||||
SV_ALLOW_BOOTP))) {
|
SV_ALLOW_BOOTP))) {
|
||||||
note ("Declining to boot client %s",
|
note ("%s: booting disallowed", msgbuf);
|
||||||
lease -> host -> name
|
|
||||||
? lease -> host -> name
|
|
||||||
: print_hw_addr (packet -> raw -> htype,
|
|
||||||
packet -> raw -> hlen,
|
|
||||||
packet -> raw -> chaddr));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,6 +242,7 @@ void bootp (packet)
|
|||||||
from = packet -> interface -> primary_address;
|
from = packet -> interface -> primary_address;
|
||||||
|
|
||||||
/* Report what we're doing... */
|
/* Report what we're doing... */
|
||||||
|
note ("%s", msgbuf);
|
||||||
note ("BOOTREPLY for %s to %s (%s) via %s",
|
note ("BOOTREPLY for %s to %s (%s) via %s",
|
||||||
piaddr (ip_address), hp -> name,
|
piaddr (ip_address), hp -> name,
|
||||||
print_hw_addr (packet -> raw -> htype,
|
print_hw_addr (packet -> raw -> htype,
|
||||||
|
Reference in New Issue
Block a user