mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-28 12:57:42 +00:00
[master] Added lease address to DHCPv4 message logs
Merges in rt2729.
This commit is contained in:
parent
abacf8ad0d
commit
35e8688957
6
RELNOTES
6
RELNOTES
@ -204,6 +204,12 @@ dhcp-users@lists.isc.org.
|
|||||||
even valid values to fail as invalid on some environments.
|
even valid values to fail as invalid on some environments.
|
||||||
[ISC-Bugs #46535]
|
[ISC-Bugs #46535]
|
||||||
|
|
||||||
|
- dhclient will now include the lease address when logging DHCPOFFERs,
|
||||||
|
DHCPREQUESTs, DHCPACKs, DHCPRELEASEs, and DHCPDECLINEs. Additionally,
|
||||||
|
DHCPOFFERs will be logged before their corresponding DHCPREQUESTs are
|
||||||
|
sent and logged.
|
||||||
|
[ISC-Bugs #2729]
|
||||||
|
|
||||||
Changes since 4.3.0 (bug fixes)
|
Changes since 4.3.0 (bug fixes)
|
||||||
|
|
||||||
- Tidy up several small tickets.
|
- Tidy up several small tickets.
|
||||||
|
@ -1355,7 +1355,9 @@ void dhcpack (packet)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
|
log_info ("DHCPACK of %s from %s",
|
||||||
|
inet_ntoa(packet->raw->yiaddr),
|
||||||
|
piaddr (packet->client_addr));
|
||||||
|
|
||||||
lease = packet_to_lease (packet, client);
|
lease = packet_to_lease (packet, client);
|
||||||
if (!lease) {
|
if (!lease) {
|
||||||
@ -2016,8 +2018,9 @@ void dhcpoffer (packet)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf (obuf, "%s from %s", name, piaddr (packet -> client_addr));
|
sprintf (obuf, "%s of %s from %s", name,
|
||||||
|
inet_ntoa(packet->raw->yiaddr),
|
||||||
|
piaddr(packet->client_addr));
|
||||||
|
|
||||||
/* If this lease doesn't supply the minimum required DHCPv4 parameters,
|
/* If this lease doesn't supply the minimum required DHCPv4 parameters,
|
||||||
* ignore it.
|
* ignore it.
|
||||||
@ -2065,6 +2068,9 @@ void dhcpoffer (packet)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* log it now, so it emits before the request goes out */
|
||||||
|
log_info("%s", obuf);
|
||||||
|
|
||||||
/* If this lease was acquired through a BOOTREPLY, record that
|
/* If this lease was acquired through a BOOTREPLY, record that
|
||||||
fact. */
|
fact. */
|
||||||
if (!packet -> options_valid || !packet -> packet_type)
|
if (!packet -> options_valid || !packet -> packet_type)
|
||||||
@ -2109,7 +2115,6 @@ void dhcpoffer (packet)
|
|||||||
add_timeout(&tv, state_selecting, client, 0, 0);
|
add_timeout(&tv, state_selecting, client, 0, 0);
|
||||||
cancel_timeout(send_discover, client);
|
cancel_timeout(send_discover, client);
|
||||||
}
|
}
|
||||||
log_info("%s", obuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a client_lease structure and initialize it from the parameters
|
/* Allocate a client_lease structure and initialize it from the parameters
|
||||||
@ -2574,6 +2579,8 @@ void send_request (cpp)
|
|||||||
struct sockaddr_in destination;
|
struct sockaddr_in destination;
|
||||||
struct in_addr from;
|
struct in_addr from;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
char rip_buf[128];
|
||||||
|
const char* rip_str = "";
|
||||||
|
|
||||||
/* Figure out how long it's been since we started transmitting. */
|
/* Figure out how long it's been since we started transmitting. */
|
||||||
interval = cur_time - client -> first_sending;
|
interval = cur_time - client -> first_sending;
|
||||||
@ -2700,7 +2707,16 @@ void send_request (cpp)
|
|||||||
log_info ("DHCPREQUEST");
|
log_info ("DHCPREQUEST");
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
log_info ("DHCPREQUEST on %s to %s port %d",
|
memset(rip_buf, 0x0, sizeof(rip_buf));
|
||||||
|
if (client->state == S_BOUND || client->state == S_RENEWING ||
|
||||||
|
client->state == S_REBINDING) {
|
||||||
|
rip_str = inet_ntoa(client->packet.ciaddr);
|
||||||
|
} else {
|
||||||
|
rip_str = piaddr(client->requested_address);
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(rip_buf, rip_str, sizeof(rip_buf)-1);
|
||||||
|
log_info ("DHCPREQUEST for %s on %s to %s port %d", rip_buf,
|
||||||
client->name ? client->name : client->interface->name,
|
client->name ? client->name : client->interface->name,
|
||||||
inet_ntoa(destination.sin_addr),
|
inet_ntoa(destination.sin_addr),
|
||||||
ntohs (destination.sin_port));
|
ntohs (destination.sin_port));
|
||||||
@ -2760,8 +2776,9 @@ void send_decline (cpp)
|
|||||||
log_info ("DHCPDECLINE");
|
log_info ("DHCPDECLINE");
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
log_info ("DHCPDECLINE on %s to %s port %d",
|
log_info ("DHCPDECLINE of %s on %s to %s port %d",
|
||||||
client->name ? client->name : client->interface->name,
|
piaddr(client->requested_address),
|
||||||
|
(client->name ? client->name : client->interface->name),
|
||||||
inet_ntoa(sockaddr_broadcast.sin_addr),
|
inet_ntoa(sockaddr_broadcast.sin_addr),
|
||||||
ntohs(sockaddr_broadcast.sin_port));
|
ntohs(sockaddr_broadcast.sin_port));
|
||||||
|
|
||||||
@ -2822,7 +2839,8 @@ void send_release (cpp)
|
|||||||
log_info ("DHCPRELEASE");
|
log_info ("DHCPRELEASE");
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
log_info ("DHCPRELEASE on %s to %s port %d",
|
log_info ("DHCPRELEASE of %s on %s to %s port %d",
|
||||||
|
piaddr(client->active->address),
|
||||||
client->name ? client->name : client->interface->name,
|
client->name ? client->name : client->interface->name,
|
||||||
inet_ntoa (destination.sin_addr),
|
inet_ntoa (destination.sin_addr),
|
||||||
ntohs (destination.sin_port));
|
ntohs (destination.sin_port));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user