dhcp-4.2.0-inherit-leases.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. diff -up dhcp-4.2.0/client/dhclient.c.inherit dhcp-4.2.0/client/dhclient.c
  2. --- dhcp-4.2.0/client/dhclient.c.inherit 2010-07-21 14:33:44.000000000 +0200
  3. +++ dhcp-4.2.0/client/dhclient.c 2010-07-21 14:40:05.000000000 +0200
  4. @@ -2322,6 +2322,7 @@ void send_request (cpp)
  5. {
  6. struct client_state *client = cpp;
  7. + int i;
  8. int result;
  9. int interval;
  10. struct sockaddr_in destination;
  11. @@ -2381,6 +2382,22 @@ void send_request (cpp)
  12. /* Now do a preinit on the interface so that we can
  13. discover a new address. */
  14. script_init (client, "PREINIT", (struct string_list *)0);
  15. +
  16. + /* Has an active lease */
  17. + if (client -> interface -> addresses != NULL) {
  18. + for (i = 0; i < client -> interface -> address_count; i++) {
  19. + if (client -> active &&
  20. + client -> active -> is_bootp &&
  21. + client -> active -> expiry > cur_time &&
  22. + client -> interface -> addresses[i].s_addr != 0 &&
  23. + client -> active -> address.len == 4 &&
  24. + memcpy (client -> active -> address.iabuf, &(client -> interface -> addresses[i]), 4) == 0) {
  25. + client_envadd (client, "", "keep_old_ip", "%s", "yes");
  26. + break;
  27. + }
  28. + }
  29. + }
  30. +
  31. if (client -> alias)
  32. script_write_params (client, "alias_",
  33. client -> alias);