title: How to set a range for DHCP IP address leasing in WiFi softAP()?
body: <p>I am trying to make a mesh network using ESP32 module. The WiFi.h softAPConfig() can be used to set the starting address for leasing, but it progress upwards without reusing the already leased addresses which are no more in use. So I want to limit the leasing range between two addresses. </p>
  
  <pre><code>I found this piece of code from dhcpserver.h 
  /*   Defined in esp_misc.h */
      typedef struct {
      bool enable;
      ip4_addr_t start_ip;
      ip4_addr_t end_ip;
  } dhcps_lease_t;
  </code></pre>
  
  <p>This is the code I compiled and uploaded into the ESP32 module </p>
  
  <pre><code>#include "WiFi.h"
  
  char *ssid = "AirMesh";
  IPAddress local_IP(192,168,1,0);
  IPAddress gateway(192,168,1,1);
  IPAddress subnet(255,255,255,0);
  
  void setup()
  {
    Serial.begin(9600);
    Serial.println();
  
    Serial.print("Setting soft-AP configuration ... ");
    Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");
  
    Serial.print("Setting soft-AP ... ");
    Serial.println(WiFi.softAP("ESPsoftAP_01") ? "Ready" : "Failed!");
  
    Serial.print("Soft-AP IP address = ");
    Serial.println(WiFi.softAPIP());
  
    WiFi.softAP(ssid);
  }
  
  void loop() {}
  </code></pre>
  
  <p>The first device when connected gives an IP 192.168.1.1, the second device an IP 192.168.1.2, when I disconnect the first device and reconnected it and it gives an IP 192.168.1.3 (every connection use different physical addresses)
  This progression keeps going</p>
  
  <p><strong>EDIT:</strong> 
  After digging it up, I think I found the code responsible for ranging IP leasing, but couldn't figure out what it means.</p>
  
  <pre><code>lease.start_ip.addr = static_cast&lt;uint32_t&gt;(local_ip) + (1 &lt;&lt; 24);
  lease.end_ip.addr = static_cast&lt;uint32_t&gt;(local_ip) + (11 &lt;&lt; 24);
  </code></pre>