version 1.1, 2012/02/21 22:30:18
|
version 1.1.1.1, 2012/10/09 09:06:54
|
Line 3
|
Line 3
|
BOOTP Protocol support. */ |
BOOTP Protocol support. */ |
|
|
/* |
/* |
* Copyright (c) 2004,2005,2007,2009 by Internet Systems Consortium, Inc. ("ISC") | * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") |
| * Copyright (c) 2004,2005,2007 by Internet Systems Consortium, Inc. ("ISC") |
* Copyright (c) 1995-2003 by Internet Software Consortium |
* Copyright (c) 1995-2003 by Internet Software Consortium |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 176 void bootp (packet)
|
Line 177 void bootp (packet)
|
} |
} |
|
|
/* Execute the host statements. */ |
/* Execute the host statements. */ |
execute_statements_in_scope ((struct binding_value **)0, | if (hp != NULL) { |
packet, lease, (struct client_state *)0, | execute_statements_in_scope (NULL, packet, lease, NULL, |
packet -> options, options, | packet->options, options, |
&lease -> scope, | &lease->scope, |
hp -> group, lease -> subnet -> group); | hp->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 ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) && |
if ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) && |
Line 361 void bootp (packet)
|
Line 363 void bootp (packet)
|
} |
} |
|
|
/* Report what we're doing... */ |
/* Report what we're doing... */ |
log_info ("%s", msgbuf); | log_info("%s", msgbuf); |
log_info ("BOOTREPLY for %s to %s (%s) via %s", | log_info("BOOTREPLY for %s to %s (%s) via %s", |
piaddr (lease->ip_addr), hp -> name, | piaddr(lease->ip_addr), |
print_hw_addr (packet -> raw -> htype, | ((hp != NULL) && (hp->name != NULL)) ? hp -> name : "unknown", |
packet -> raw -> hlen, | print_hw_addr (packet->raw->htype, |
packet -> raw -> chaddr), | packet->raw->hlen, |
packet -> raw -> giaddr.s_addr | packet->raw->chaddr), |
? inet_ntoa (packet -> raw -> giaddr) | packet->raw->giaddr.s_addr |
: packet -> interface -> name); | ? inet_ntoa (packet->raw->giaddr) |
| : packet->interface->name); |
|
|
/* Set up the parts of the address that are in common. */ |
/* Set up the parts of the address that are in common. */ |
to.sin_family = AF_INET; |
to.sin_family = AF_INET; |
Line 384 void bootp (packet)
|
Line 387 void bootp (packet)
|
to.sin_port = local_port; |
to.sin_port = local_port; |
|
|
if (fallback_interface) { |
if (fallback_interface) { |
result = send_packet (fallback_interface, | result = send_packet (fallback_interface, NULL, &raw, |
(struct packet *)0, | outgoing.packet_length, from, |
&raw, outgoing.packet_length, | &to, &hto); |
from, &to, &hto); | if (result < 0) { |
| log_error ("%s:%d: Failed to send %d byte long " |
| "packet over %s interface.", MDL, |
| outgoing.packet_length, |
| fallback_interface->name); |
| } |
| |
goto out; |
goto out; |
} |
} |
|
|
Line 407 void bootp (packet)
|
Line 416 void bootp (packet)
|
} |
} |
|
|
errno = 0; |
errno = 0; |
result = send_packet (packet -> interface, | result = send_packet(packet->interface, packet, &raw, |
packet, &raw, outgoing.packet_length, | outgoing.packet_length, from, &to, &hto); |
from, &to, &hto); | if (result < 0) { |
| log_error ("%s:%d: Failed to send %d byte long packet over %s" |
| " interface.", MDL, outgoing.packet_length, |
| packet->interface->name); |
| } |
| |
out: |
out: |
|
|
if (options) |
if (options) |
option_state_dereference (&options, MDL); |
option_state_dereference (&options, MDL); |
if (lease) |
if (lease) |