diff --git a/settings.php b/settings.php index 5ef58899..e96d1302 100644 --- a/settings.php +++ b/settings.php @@ -353,64 +353,116 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp", } ?>
-
- -
-
-
-

DHCP Settings

+
+ +
+
+
+

DHCP Settings

+
+
+
+
+
+
+ +
+
+

hidden>Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!

+
+
+
+
+ +
+
+
+
+
From
+ disabled> +
+
+
+
+
+
+
To
+ disabled> +
+
+
+
+
+
+ +
+
+
Router
+ disabled> +
+
+
+
+
-
-
-
-
-
-
-

hidden>Make sure your - router's DHCP - server is disabled when using the Pi-hole DHCP server!

-
+
+ +
+
+
+

Advanced DHCP settings

-
-
- -
-
-
-
-
From
- disabled> +
+
+
+ +
+
+
Domain
+ disabled> +
-
-
-
-
To
- disabled> +
+
+ +
+
+
Lease time in hours
+ disabled> +
+

Hint: 0 = infinite, 24 = one day, 168 = one week, 744 = one month, 8760 = one year

-
-
-
- -
-
-
Router
- disabled> +
+
+
+
+ +
@@ -418,220 +470,164 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
- -
-
-
-

Advanced DHCP settings

-
-
-
-
- -
-
-
Domain
- disabled> -
-
-
-
-
-
- -
-
-
Lease time in hours
- disabled> -
-
-

Hint: 0 = infinite, 24 = one day, 168 = one week, 744 = one month, - 8760 = - one year

-
-
-
-
-
-
-
-
-
-
-
-
-
- -
- +
+ unknown"; + while (!feof($dhcpleases) && $leasesfile) { + $line = explode(" ", trim(fgets($dhcpleases))); + if (count($line) == 5) { + $counter = intval($line[0]); + if ($counter == 0) { + $time = "Infinite"; + } elseif ($counter <= 315360000) // 10 years in seconds + { + $time = convertseconds($counter); + } else // Assume time stamp + { + $time = convertseconds($counter - time()); + } + + if (strpos($line[2], ':') !== false) { + // IPv6 address + $type = 6; + } else { + // IPv4 lease + $type = 4; + } + + $host = $line[3]; + if ($host == "*") { + $host = "unknown"; + } + + $clid = $line[4]; + if ($clid == "*") { + $clid = "unknown"; + } + + array_push($dhcp_leases, ["TIME" => $time, "hwaddr" => strtoupper($line[1]), "IP" => $line[2], "host" => $host, "clid" => $clid, "type" => $type]); } - - $clid = $line[4]; - if ($clid == "*") { - $clid = "unknown"; - } - - array_push($dhcp_leases, ["TIME" => $time, "hwaddr" => strtoupper($line[1]), "IP" => $line[2], "host" => $host, "clid" => $clid, "type" => $type]); } } - } - readStaticLeasesFile(); - ?> -
-
-
-

DHCP leases

-
-
-
-
- - - - - - - - - - - - -
Remaining lease time:
DHCP UID: "> - - - - - -
MAC addressIP addressHostname
- -
-
-
-
- - - - - - - - - - - - + readStaticLeasesFile(); + ?> +
+
+
+

DHCP leases

+
+
+
+
+ +
MAC addressIP addressHostname
+ + + + + + + + + + +
Remaining lease time:
DHCP UID: "> + + + + + + + +
MAC addressIP addressHostname
+ +
+
+
+
+ + + - - - - - - - - - - - - - -
0) { ?> -
- -
-

Specifying the MAC address is mandatory and only one entry per MAC - address is allowed. If the IP address is omitted and a host name is - given, the IP address will still be generated dynamically and the - specified host name will be used. If the host name is omitted, only - a - static lease will be added.

+ MAC address + IP address + Hostname + + + + + + + + + + 0) { ?> + + + + + + + + + + + + + + + + + +

Specifying the MAC address is mandatory and only one entry per MAC + address is allowed. If the IP address is omitted and a host name is + given, the IP address will still be generated dynamically and the + specified host name will be used. If the host name is omitted, only + a static lease will be added.

+
+ + +
- - - -
-
- +
in active">