From a2578c27479c1afad0dfbeb6dba484adcc10473a Mon Sep 17 00:00:00 2001 From: Anthony Wrather Date: Thu, 1 Dec 2011 17:33:27 +0000 Subject: [PATCH] Updated DHCP IPv4 and IPv6 to allow global and host based filename and root-path. --- etc/inc/services.inc | 27 ++++++++++++++++++-------- usr/local/www/services_dhcp.php | 4 ++-- usr/local/www/services_dhcp_edit.php | 19 +++++++++++++----- usr/local/www/services_dhcpv6.php | 4 ++-- usr/local/www/services_dhcpv6_edit.php | 17 ++++++++++++---- 5 files changed, 50 insertions(+), 21 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 2e4f00c462..c14066f8a9 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -516,8 +516,10 @@ EOD; // net boot information if(isset($dhcpifconf['netboot'])) { - if (($dhcpifconf['next-server'] <> "") && ($dhcpifconf['filename'] <> "")) { - $dhcpdconf .= " next-server {$dhcpifconf['next-server']};\n"; + if ($dhcpifconf['nextserver'] <> "") { + $dhcpdconf .= " next-server {$dhcpifconf['nextserver']};\n"; + } + if ($dhcpifconf['filename'] <> "") { $dhcpdconf .= " filename \"{$dhcpifconf['filename']}\";\n"; } if ($dhcpifconf['rootpath'] <> "") { @@ -548,8 +550,11 @@ EOD; $dhhostname = str_replace(".", "_", $dhhostname); $dhcpdconf .= " option host-name \"{$dhhostname}\";\n"; } - if ($sm['netbootfile']) - $dhcpdconf .= " filename \"{$sm['netbootfile']}\";\n"; + if ($sm['filename']) + $dhcpdconf .= " filename \"{$sm['filename']}\";\n"; + + if ($sm['rootpath']) + $dhcpdconf .= " option root-path \"{$sm['rootpath']}\";\n"; $dhcpdconf .= "}\n"; $i++; @@ -851,8 +856,10 @@ EOD; // net boot information if(isset($dhcpv6ifconf['netboot'])) { - if (($dhcpv6ifconf['next-server'] <> "") && ($dhcpv6ifconf['filename'] <> "")) { - $dhcpdv6conf .= " next-server {$dhcpv6ifconf['next-server']};\n"; + if ($dhcpv6ifconf['nextserver'] <> "") { + $dhcpdv6conf .= " next-server {$dhcpv6ifconf['nextserver']};\n"; + } + if ($dhcpv6ifconf['filename'] <> "") { $dhcpdv6conf .= " filename \"{$dhcpv6ifconf['filename']}\";\n"; } if ($dhcpv6ifconf['rootpath'] <> "") { @@ -862,6 +869,7 @@ EOD; $dhcpdv6conf .= << - Netboot filename + Netboot Filename - +
Name of the file that should be loaded when this host boots off of the network, overrides setting on main page. + + Root Path + + +
-, overrides setting on main page. + diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 267f0515a0..42c3255f41 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -113,7 +113,7 @@ if (is_array($config['dhcpdv6'][$if])){ $pconfig['tftp'] = $config['dhcpdv6'][$if]['tftp']; $pconfig['ldap'] = $config['dhcpdv6'][$if]['ldap']; $pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']); - $pconfig['nextserver'] = $config['dhcpdv6'][$if]['next-server']; + $pconfig['nextserver'] = $config['dhcpdv6'][$if]['nextserver']; $pconfig['filename'] = $config['dhcpdv6'][$if]['filename']; $pconfig['rootpath'] = $config['dhcpdv6'][$if]['rootpath']; $pconfig['failover_peerip'] = $config['dhcpdv6'][$if]['failover_peerip']; @@ -305,7 +305,7 @@ if ($_POST) { $config['dhcpdv6'][$if]['tftp'] = $_POST['tftp']; $config['dhcpdv6'][$if]['ldap'] = $_POST['ldap']; $config['dhcpdv6'][$if]['netboot'] = ($_POST['netboot']) ? true : false; - $config['dhcpdv6'][$if]['next-server'] = $_POST['nextserver']; + $config['dhcpdv6'][$if]['nextserver'] = $_POST['nextserver']; $config['dhcpdv6'][$if]['filename'] = $_POST['filename']; $config['dhcpdv6'][$if]['rootpath'] = $_POST['rootpath']; diff --git a/usr/local/www/services_dhcpv6_edit.php b/usr/local/www/services_dhcpv6_edit.php index 61f060ea2c..e219af835f 100644 --- a/usr/local/www/services_dhcpv6_edit.php +++ b/usr/local/www/services_dhcpv6_edit.php @@ -87,12 +87,14 @@ if (isset($id) && $a_maps[$id]) { $pconfig['duid'] = $a_maps[$id]['duid']; $pconfig['hostname'] = $a_maps[$id]['hostname']; $pconfig['ipaddrv6'] = $a_maps[$id]['ipaddrv6']; - $pconfig['netbootfile'] = $a_maps[$id]['netbootfile']; + $pconfig['filename'] = $a_maps[$id]['filename']; + $pconfig['rootpath'] = $a_maps[$id]['rootpath']; $pconfig['descr'] = $a_maps[$id]['descr']; } else { $pconfig['duid'] = $_GET['duid']; $pconfig['hostname'] = $_GET['hostname']; - $pconfig['netbootfile'] = $_GET['netbootfile']; + $pconfig['filename'] = $_GET['filename']; + $pconfig['rootpath'] = $a_maps[$id]['rootpath']; $pconfig['descr'] = $_GET['descr']; } @@ -148,7 +150,8 @@ if ($_POST) { $mapent['ipaddrv6'] = $_POST['ipaddrv6']; $mapent['hostname'] = $_POST['hostname']; $mapent['descr'] = $_POST['descr']; - $mapent['netbootfile'] = $_POST['netbootfile']; + $mapent['filename'] = $_POST['filename']; + $mapent['rootpath'] = $_POST['rootpath']; if (isset($id) && $a_maps[$id]) $a_maps[$id] = $mapent; @@ -211,9 +214,15 @@ include("head.inc"); Netboot filename - +
Name of the file that should be loaded when this host boots off of the network, overrides setting on main page. + + Root Path + + +
-, overrides setting on main page. +