|
|
| version 1.1, 2012/02/21 22:30:18 | version 1.1.1.1, 2012/10/09 09:06:55 |
|---|---|
| Line 3 | Line 3 |
| DHCP Protocol engine. */ | DHCP Protocol engine. */ |
| /* | /* |
| * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") | * Copyright (c) 2004-2012 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 408 void dhcprequest (packet, ms_nulltp, ip_lease) | Line 408 void dhcprequest (packet, ms_nulltp, ip_lease) |
| #if defined (FAILOVER_PROTOCOL) | #if defined (FAILOVER_PROTOCOL) |
| dhcp_failover_state_t *peer; | dhcp_failover_state_t *peer; |
| #endif | #endif |
| int have_server_identifier = 0; | |
| int have_requested_addr = 0; | int have_requested_addr = 0; |
| oc = lookup_option (&dhcp_universe, packet -> options, | oc = lookup_option (&dhcp_universe, packet -> options, |
| Line 462 void dhcprequest (packet, ms_nulltp, ip_lease) | Line 461 void dhcprequest (packet, ms_nulltp, ip_lease) |
| * safe. | * safe. |
| */ | */ |
| sprintf (smbuf, " (%s)", piaddr (sip)); | sprintf (smbuf, " (%s)", piaddr (sip)); |
| have_server_identifier = 1; | |
| } else | } else |
| smbuf [0] = 0; | smbuf [0] = 0; |
| Line 953 void dhcpinform (packet, ms_nulltp) | Line 951 void dhcpinform (packet, ms_nulltp) |
| struct sockaddr_in to; | struct sockaddr_in to; |
| struct in_addr from; | struct in_addr from; |
| isc_boolean_t zeroed_ciaddr; | isc_boolean_t zeroed_ciaddr; |
| struct interface_info *interface; | |
| int result; | |
| /* The client should set ciaddr to its IP address, but apparently | /* The client should set ciaddr to its IP address, but apparently |
| it's common for clients not to do this, so we'll use their IP | it's common for clients not to do this, so we'll use their IP |
| Line 1151 void dhcpinform (packet, ms_nulltp) | Line 1151 void dhcpinform (packet, ms_nulltp) |
| packet -> options, options, | packet -> options, options, |
| &global_scope, oc, MDL)) { | &global_scope, oc, MDL)) { |
| struct universe *u = (struct universe *)0; | struct universe *u = (struct universe *)0; |
| if (!universe_hash_lookup (&u, universe_hash, | if (!universe_hash_lookup (&u, universe_hash, |
| (const char *)d1.data, d1.len, | (const char *)d1.data, d1.len, |
| MDL)) { | MDL)) { |
| Line 1296 void dhcpinform (packet, ms_nulltp) | Line 1296 void dhcpinform (packet, ms_nulltp) |
| packet->interface->name); | packet->interface->name); |
| errno = 0; | errno = 0; |
| send_packet ((fallback_interface | interface = (fallback_interface ? fallback_interface |
| ? fallback_interface : packet -> interface), | : packet -> interface); |
| &outgoing, &raw, outgoing.packet_length, | result = send_packet(interface, &outgoing, &raw, |
| from, &to, (struct hardware *)0); | outgoing.packet_length, from, &to, NULL); |
| if (result < 0) { | |
| log_error ("%s:%d: Failed to send %d byte long packet over %s " | |
| "interface.", MDL, outgoing.packet_length, | |
| interface->name); | |
| } | |
| if (subnet) | if (subnet) |
| subnet_dereference (&subnet, MDL); | subnet_dereference (&subnet, MDL); |
| } | } |
| Line 1453 void nak_lease (packet, cip) | Line 1460 void nak_lease (packet, cip) |
| to.sin_port = remote_port; /* for testing. */ | to.sin_port = remote_port; /* for testing. */ |
| if (fallback_interface) { | if (fallback_interface) { |
| result = send_packet (fallback_interface, | result = send_packet(fallback_interface, packet, &raw, |
| packet, &raw, | outgoing.packet_length, from, &to, |
| outgoing.packet_length, | &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); | |
| } | |
| return; | return; |
| } | } |
| } else { | } else { |
| Line 1465 void nak_lease (packet, cip) | Line 1478 void nak_lease (packet, cip) |
| } | } |
| 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, NULL); |
| from, &to, (struct hardware *)0); | if (result < 0) { |
| log_error ("%s:%d: Failed to send %d byte long packet over %s " | |
| "interface.", MDL, outgoing.packet_length, | |
| packet->interface->name); | |
| } | |
| } | } |
| void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) | void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) |
| Line 3159 void dhcp_reply (lease) | Line 3176 void dhcp_reply (lease) |
| to.sin_port = remote_port; /* For debugging. */ | to.sin_port = remote_port; /* For debugging. */ |
| if (fallback_interface) { | if (fallback_interface) { |
| result = send_packet (fallback_interface, | result = send_packet(fallback_interface, NULL, &raw, |
| (struct packet *)0, | packet_length, raw.siaddr, &to, |
| &raw, packet_length, | NULL); |
| raw.siaddr, &to, | if (result < 0) { |
| (struct hardware *)0); | log_error ("%s:%d: Failed to send %d byte long " |
| "packet over %s interface.", MDL, | |
| packet_length, | |
| fallback_interface->name); | |
| } | |
| free_lease_state (state, MDL); | free_lease_state (state, MDL); |
| lease -> state = (struct lease_state *)0; | lease -> state = (struct lease_state *)0; |
| return; | return; |
| Line 3192 void dhcp_reply (lease) | Line 3214 void dhcp_reply (lease) |
| to.sin_port = remote_port; | to.sin_port = remote_port; |
| if (fallback_interface) { | if (fallback_interface) { |
| result = send_packet (fallback_interface, | result = send_packet(fallback_interface, NULL, &raw, |
| (struct packet *)0, | packet_length, raw.siaddr, &to, |
| &raw, packet_length, | NULL); |
| raw.siaddr, &to, | if (result < 0) { |
| (struct hardware *)0); | log_error("%s:%d: Failed to send %d byte long" |
| " packet over %s interface.", MDL, | |
| packet_length, | |
| fallback_interface->name); | |
| } | |
| free_lease_state (state, MDL); | free_lease_state (state, MDL); |
| lease -> state = (struct lease_state *)0; | lease -> state = (struct lease_state *)0; |
| return; | return; |
| Line 3221 void dhcp_reply (lease) | Line 3248 void dhcp_reply (lease) |
| memcpy (&from, state -> from.iabuf, sizeof from); | memcpy (&from, state -> from.iabuf, sizeof from); |
| result = send_packet (state -> ip, | result = send_packet(state->ip, NULL, &raw, packet_length, |
| (struct packet *)0, &raw, packet_length, | from, &to, unicastp ? &hto : NULL); |
| from, &to, | if (result < 0) { |
| unicastp ? &hto : (struct hardware *)0); | log_error ("%s:%d: Failed to send %d byte long " |
| "packet over %s interface.", MDL, | |
| packet_length, state->ip->name); | |
| } | |
| /* Free all of the entries in the option_state structure | /* Free all of the entries in the option_state structure |
| now that we're done with them. */ | now that we're done with them. */ |