--- embedaddon/dhcp/server/bootp.c 2012/02/21 22:30:18 1.1 +++ embedaddon/dhcp/server/bootp.c 2012/10/09 09:06:54 1.1.1.1 @@ -3,7 +3,8 @@ 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 * * Permission to use, copy, modify, and distribute this software for any @@ -176,11 +177,12 @@ void bootp (packet) } /* Execute the host statements. */ - execute_statements_in_scope ((struct binding_value **)0, - packet, lease, (struct client_state *)0, - packet -> options, options, - &lease -> scope, - hp -> group, lease -> subnet -> group); + if (hp != NULL) { + execute_statements_in_scope (NULL, packet, lease, NULL, + packet->options, options, + &lease->scope, + hp->group, lease->subnet->group); + } /* Drop the request if it's not allowed for this client. */ if ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) && @@ -361,15 +363,16 @@ void bootp (packet) } /* Report what we're doing... */ - log_info ("%s", msgbuf); - log_info ("BOOTREPLY for %s to %s (%s) via %s", - piaddr (lease->ip_addr), hp -> name, - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); + log_info("%s", msgbuf); + log_info("BOOTREPLY for %s to %s (%s) via %s", + piaddr(lease->ip_addr), + ((hp != NULL) && (hp->name != NULL)) ? hp -> name : "unknown", + print_hw_addr (packet->raw->htype, + packet->raw->hlen, + packet->raw->chaddr), + packet->raw->giaddr.s_addr + ? inet_ntoa (packet->raw->giaddr) + : packet->interface->name); /* Set up the parts of the address that are in common. */ to.sin_family = AF_INET; @@ -384,10 +387,16 @@ void bootp (packet) to.sin_port = local_port; if (fallback_interface) { - result = send_packet (fallback_interface, - (struct packet *)0, - &raw, outgoing.packet_length, - from, &to, &hto); + result = send_packet (fallback_interface, NULL, &raw, + outgoing.packet_length, 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; } @@ -407,10 +416,16 @@ void bootp (packet) } errno = 0; - result = send_packet (packet -> interface, - packet, &raw, outgoing.packet_length, - from, &to, &hto); + result = send_packet(packet->interface, packet, &raw, + outgoing.packet_length, 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: + if (options) option_state_dereference (&options, MDL); if (lease)