This patch will allow you to set a per-host network boot filename in
DHCP when you're using static mapping.  The text input will only be
shown if the "Enable network booting" check box has been checked in the
main DHCP settings menu.

Jonathan
diff -urb orig/etc/inc/services.inc new/etc/inc/services.inc
--- orig/etc/inc/services.inc	2010-07-12 13:13:21.668373561 +0300
+++ new/etc/inc/services.inc	2010-07-12 13:25:12.450445328 +0300
@@ -338,6 +338,8 @@
 					$dhhostname = str_replace(".", "_", $dhhostname);
 					$dhcpdconf .= "	option host-name {$dhhostname};\n";
 				}
+				if ($sm['netbootfile'])
+					$dhcpdconf .= "	filename \"{$sm['netbootfile']}\";\n";
 
 				$dhcpdconf .= "}\n";
 				$i++;
diff -urb orig/usr/local/www/services_dhcp_edit.php new/usr/local/www/services_dhcp_edit.php
--- orig/usr/local/www/services_dhcp_edit.php	2010-07-12 12:42:52.596975827 +0300
+++ new/usr/local/www/services_dhcp_edit.php	2010-07-12 12:56:37.172811936 +0300
@@ -73,7 +73,7 @@
 }
 
 $static_map_enabled=isset($config['dhcpd'][$if]['staticarp']);
-
+$netboot_enabled=isset($config['dhcpd'][$if]['netboot']);
 $a_maps = &$config['dhcpd'][$if]['staticmap'];
 $ifcfgip = get_interface_ip($if);
 $ifcfgsn = get_interface_subnet($if);
@@ -87,10 +87,12 @@
         $pconfig['mac'] = $a_maps[$id]['mac'];
 		$pconfig['hostname'] = $a_maps[$id]['hostname'];
         $pconfig['ipaddr'] = $a_maps[$id]['ipaddr'];
+	$pconfig['netbootfile'] = $a_maps[$id]['netbootfile'];
         $pconfig['descr'] = $a_maps[$id]['descr'];
 } else {
         $pconfig['mac'] = $_GET['mac'];
 		$pconfig['hostname'] = $_GET['hostname'];
+	$pconfig['netbootfile'] = $_GET['netbootfile'];
         $pconfig['descr'] = $_GET['descr'];
 }
 
@@ -156,6 +158,7 @@
 		$mapent['ipaddr'] = $_POST['ipaddr'];
 		$mapent['hostname'] = $_POST['hostname'];
 		$mapent['descr'] = $_POST['descr'];
+		$mapent['netbootfile'] = $_POST['netbootfile'];
 
 		if (isset($id) && $a_maps[$id])
 			$a_maps[$id] = $mapent;
@@ -219,6 +222,14 @@
                     <input name="hostname" type="text" class="formfld unknown" id="hostname" size="20" value="<?=htmlspecialchars($pconfig['hostname']);?>">
                     <br> <span class="vexpl">Name of the host, without domain part.</span></td>
                 </tr>				
+                <?php if($netboot_enabled) { ?>
+		<tr>
+		  <td width="22%" valign="top" class="vncell">Netboot filename</td>
+		  <td width="78%" class="vtable">
+		    <input name="netbootfile" type="text" class="formfld unknown" id="netbootfile" size="20" value="<?=htmlspecialchars($pconfig['netbootfile']);?>">
+		    <br> <span class="vexpl">Name of the file that should be loaded when this host boots off of the network, overrides setting on main page.</span></td>
+		</tr>
+		<?php } ?>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">Description</td>
                   <td width="78%" class="vtable"> 
Only in orig/usr/local/www: services_dhcp.php

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to