dhcp/dhcp-4.1.0-inherit-leases.patch
David Cantrell 4bf24c8243 - Upgraded to ISC dhcp-4.1.0
- Had to rename the -T option to -timeout as ISC is now using -T
- Allow package rebuilders to easily enable DHCPv6 support with: rpmbuild
    --with DHCPv6 dhcp.spec Note that Fedora is still using the 'dhcpv6'
    package, but some users may want to experiment with the ISC DHCPv6
    implementation locally.
2009-01-06 23:50:29 +00:00

35 lines
1.2 KiB
Diff

diff -up dhcp-4.1.0/client/dhclient.c.inherit dhcp-4.1.0/client/dhclient.c
--- dhcp-4.1.0/client/dhclient.c.inherit 2009-01-06 12:08:56.000000000 -1000
+++ dhcp-4.1.0/client/dhclient.c 2009-01-06 12:08:57.000000000 -1000
@@ -2299,6 +2299,7 @@ void send_request (cpp)
{
struct client_state *client = cpp;
+ int i;
int result;
int interval;
struct sockaddr_in destination;
@@ -2358,6 +2359,22 @@ void send_request (cpp)
/* Now do a preinit on the interface so that we can
discover a new address. */
script_init (client, "PREINIT", (struct string_list *)0);
+
+ /* Has an active lease */
+ if (client -> interface -> addresses != NULL) {
+ for (i = 0; i < client -> interface -> address_count; i++) {
+ if (client -> active &&
+ client -> active -> is_bootp &&
+ client -> active -> expiry > cur_time &&
+ client -> interface -> addresses[i].s_addr != 0 &&
+ client -> active -> address.len == 4 &&
+ memcpy (client -> active -> address.iabuf, &(client -> interface -> addresses[i]), 4) == 0) {
+ client_envadd (client, "", "keep_old_ip", "%s", "yes");
+ break;
+ }
+ }
+ }
+
if (client -> alias)
script_write_params (client, "alias_",
client -> alias);