Lee Sharp
2012-08-17 11:46:03 UTC
OK. I am sending this to the dev list too. I don't know the dhcp
component too well, so I don't know if this will work. But it may. You
can test it with the hidden page, exec.php by uploading it to the ram
disk. Actually, anyone can now that you have posted it...
Lee
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.
http://itse.is-very-good.org/stuff/monowall-rootpath.patch
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"> </td>
<td width="78%">
---------------------------------------------------------------------
component too well, so I don't know if this will work. But it may. You
can test it with the hidden page, exec.php by uploading it to the ram
disk. Actually, anyone can now that you have posted it...
Lee
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,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.
or only include the body text.
Lee
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.
http://itse.is-very-good.org/stuff/monowall-rootpath.patch
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"> </td>
<td width="78%">
---------------------------------------------------------------------