[ previous ] [ next ] [ threads ]
 
 From:  Ilkka Tengvall <ilkka dot tengvall at iki dot fi>
 To:  Lee Sharp <leesharp at hal dash pc dot org>
 Cc:  m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] dhcpd root-path option? [PATCH]
 Date:  Fri, 17 Aug 2012 09:56:49 +0300
On Fri, Aug 17, 2012 at 4:31 AM, Lee Sharp <leesharp at hal dash pc dot org> wrote:
> On 08/16/2012 12:52 PM, Ilkka Tengvall wrote:
>>
>> It seems by a quick glance that this patch would do it. I did'n add
>> syntax check, the filename didn't seem to have it either.
>>
>> Please see attachment. Any chance for someone reviewing and committing
>> it? It's minor, and done against freebsd6 branch.
>
> Attachments are stripped from the list.  You will have to post it somewhere,
> or only include the body text.
>
>                         Lee

OK, I'll resend this now. I admit that I have not tested this at all,
and I am not monowall developer, just a happy user for years, so take
the patch with healthy suspicion. But with a small review and
corrections from a monowall developer it would be acceptable.

Patch is dumped here to avoid mail lines mangling:

http://itse.is-very-good.org/stuff/monowall-rootpath.patch

and here directly for easy reading:

Index: phpconf/config.xml
===================================================================
--- phpconf/config.xml	(revision 512)
+++ phpconf/config.xml	(working copy)
@@ -219,6 +219,7 @@
 			<staticmap>
 				<mac>xx:xx:xx:xx:xx:xx</mac>
 				<ipaddr>xxx.xxx.xxx.xxx</ipaddr>
+				<root-path></root-path>
 				<descr></descr>
 			</staticmap>
 			-->
Index: phpconf/inc/services.inc
===================================================================
--- phpconf/inc/services.inc	(revision 512)
+++ phpconf/inc/services.inc	(working copy)
@@ -412,6 +412,8 @@
 						$dhcpdconf .= "	next-server {$sm['next-server']};\n";
 					if ($sm['filename'])
 						$dhcpdconf .= "	filename \"{$sm['filename']}\";\n";
+					if ($sm['root-path'])
+						$dhcpdconf .= "	root-path \"{$sm['root-path']}\";\n";
 				
 					$dhcpdconf .= "}\n";
 					$i++;
Index: webgui/services_dhcp.php
===================================================================
--- webgui/services_dhcp.php	(revision 512)
+++ webgui/services_dhcp.php	(working copy)
@@ -60,6 +60,7 @@
 $pconfig['denyunknown'] = isset($config['dhcpd'][$if]['denyunknown']);
 $pconfig['nextserver'] = $config['dhcpd'][$if]['next-server'];
 $pconfig['filename'] = $config['dhcpd'][$if]['filename'];
+$pconfig['rootpath'] = $config['dhcpd'][$if]['root-path'];

 if (ipv6enabled()) {
 	$pconfig['v6range_from'] = $config['dhcpd'][$if]['v6range']['from'];
@@ -165,6 +166,7 @@
 		$config['dhcpd'][$if]['denyunknown'] = $_POST['denyunknown'] ? true : false;
 		$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
 		$config['dhcpd'][$if]['filename'] = $_POST['filename'];
+		$config['dhcpd'][$if]['root-path'] = $_POST['rootpath'];
 		if (ipv6enabled()) {		
 			$config['dhcpd'][$if]['v6range']['from'] = $_POST['v6range_from'];
 			$config['dhcpd'][$if]['v6range']['to'] = $_POST['v6range_to'];
@@ -222,6 +224,7 @@
 	document.iform.maxtime.disabled = endis;
 	document.iform.nextserver.disabled = endis;
 	document.iform.filename.disabled = endis;
+	document.iform.rootpath.disabled = endis;
 	
 	<?php if (ipv6enabled()): ?>
 	endis = !(document.iform.v6enable.checked || enable_over);
@@ -342,6 +345,14 @@
                           usually only needed with PXE booting and
some VoIP phones, and can usually
                           be left empty.</td>
                       </tr>
+                      <tr>
+                        <td width="22%" valign="top"
class="vncell">Root Path</td>
+                        <td width="78%" class="vtable">
+                          <input name="rootpath" type="text"
class="formfld" id="rootpath" size="20"
value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
+                          Specify the path to NFS root directory for
the client. This is
+                          only needed when using NFS root for DHCP
client, and can usually
+                          be left empty.</td>
+                      </tr>
  <?php if (ipv6enabled()) { ?>
 					
 					 <tr>
Index: webgui/services_dhcp_edit.php
===================================================================
--- webgui/services_dhcp_edit.php	(revision 512)
+++ webgui/services_dhcp_edit.php	(working copy)
@@ -58,6 +58,7 @@
 	$pconfig['descr'] = $a_maps[$id]['descr'];
 	$pconfig['nextserver'] = $a_maps[$id]['next-server'];
 	$pconfig['filename'] = $a_maps[$id]['filename'];
+	$pconfig['rootpath'] = $a_maps[$id]['root-path'];
 } else {
 	$pconfig['mac'] = $_GET['mac'];
 }
@@ -144,6 +145,7 @@
 		if (!is_ipaddr6($_POST['ipaddr'])){
 			$mapent['next-server'] = $_POST['nextserver'];
 			$mapent['filename'] = $_POST['filename'];
+			$mapent['root-path'] = $_POST['rootpath'];
 		}
 		if (isset($id) && $a_maps[$id])
 			$a_maps[$id] = $mapent;
@@ -213,6 +215,12 @@
 				    <input name="filename" type="text" class="formfld"
id="filename" size="20"
value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
 				    Specify the name of the boot file on the server above.</td>
 				</tr>
+				<tr>
+				  <td width="22%" valign="top" class="vncell">Root Path</td>
+  				  <td width="78%" class="vtable">
+				    <input name="rootpath" type="text" class="formfld"
id="rootpath" size="20"
value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
+				    Specify the path which clients should use for NFS root.</td>
+				</tr>
                 <tr>
                   <td width="22%" valign="top">&nbsp;</td>
                   <td width="78%">