From a72ceb031414bcc6f58addabe3516617fbab324d Mon Sep 17 00:00:00 2001 From: Christopher Huhn Date: Fri, 23 Nov 2018 17:05:32 +0100 Subject: [PATCH 1/2] Sort DHCP entries of each host by its option number --- build_isc_dhcp.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_isc_dhcp.inc.php b/build_isc_dhcp.inc.php index 8dea21a..026ff69 100644 --- a/build_isc_dhcp.inc.php +++ b/build_isc_dhcp.inc.php @@ -446,6 +446,7 @@ function build_hosts($server_id=0) { dns D, domains Z, interfaces I LEFT OUTER JOIN dhcp_option_entries B ON I.host_id = B.host_id + LEFT JOIN dhcp_options opts ON B.dhcp_option_id = opts.id WHERE I.mac_addr NOT like '' AND I.host_id = H.id AND D.domain_id = Z.id @@ -468,7 +469,7 @@ interfaces I LEFT OUTER JOIN dhcp_option_entries B ON I.host_id = B.host_id OR secondary_server_id = {$server_id})) ) ) - ORDER BY I.ip_addr"; + ORDER BY I.ip_addr, opts.number"; From 2ea1bf57dc9bd717445e2927bff4c31229da2073 Mon Sep 17 00:00:00 2001 From: Christopher Huhn Date: Mon, 26 Nov 2018 18:02:15 +0100 Subject: [PATCH 2/2] Also add nice sorting for subnet options --- build_isc_dhcp.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_isc_dhcp.inc.php b/build_isc_dhcp.inc.php index 026ff69..0b135c3 100644 --- a/build_isc_dhcp.inc.php +++ b/build_isc_dhcp.inc.php @@ -263,7 +263,10 @@ function subnet_conf ($subnet=array(), $indent=0) { // Loop through all of the dhcp entries and print them $i = 0; do { - list($status, $rows, $dhcp_entry) = ona_get_dhcp_option_entry_record(array('subnet_id' => $subnet['id'])); + list($status, $rows, $dhcp_entry) = ona_get_record( + array('e.subnet_id' => $subnet['id']), + 'dhcp_option_entries e LEFT JOIN dhcp_options o ON e.dhcp_option_id = o.id', + 'o.number'); printmsg("DEBUG => subnet_conf(): Processing option {$dhcp_entry['display_name']}", 3); if (!$rows) { break; } if ($status) { $exit++; break; }