[ previous ] [ next ] [ threads ]
 
 From:  Matt C <wago at phlinux dot com>
 To:  m0n0wall at lists dot m0n0 dot ch
 Subject:  [PATCH] m0n0-1.1: add PXE support to DHCP server
 Date:  Wed, 29 Sep 2004 23:22:41 -0700 (PDT)
Hi All-

I just finished testing a simple patch I built to add PXE server support 
to the DHCP server on m0n0wall-1.1. This trivial patch adds next-server 
and filename params to the DHCP zones in dhcpd.conf.

I'd love to see it (in some form) in future versions if possible. It's 
useful to me to support diskless linux hosts here at home.

The file is attached. Let me know if you have any problem viewing it, and 
I can try inlining it instead.

Thanks!

-matt
diff -ur monowall-root/conf.default/config.xml monowall-root-pxe/conf.default/config.xml
--- monowall-root/conf.default/config.xml	2004-08-22 02:41:15.000000000 -0700
+++ monowall-root-pxe/conf.default/config.xml	2004-09-26 22:21:25.000000000 -0700
@@ -132,6 +132,8 @@
 			<winsserver>xxx.xxx.xxx.xxx</winsserver>
 			<defaultleasetime></defaultleasetime>
 			<maxleasetime></maxleasetime>
+			<nextserver></nextserver>
+			<filename></filename>
 			-->
 		</lan>
 		<!--
diff -ur monowall-root/etc/inc/services.inc monowall-root-pxe/etc/inc/services.inc
--- monowall-root/etc/inc/services.inc	2004-08-22 02:41:15.000000000 -0700
+++ monowall-root-pxe/etc/inc/services.inc	2004-09-26 22:28:12.000000000 -0700
@@ -117,7 +117,13 @@
 			$dhcpdconf .= "	option netbios-name-servers " . join(",", $dhcpifconf['winsserver']) . ";\n";
 			$dhcpdconf .= "	option netbios-node-type 8;\n";
 		}
-			
+
+		if ($dhcpifconf['nextserver'])
+			$dhcpdconf .= "	next-server {$dhcpifconf['nextserver']};\n";
+
+		if ($dhcpifconf['filename'])
+			$dhcpdconf .= "	filename \"{$dhcpifconf['filename']}\";\n";
+		
 		$dhcpdconf .= <<<EOD
 }
 
diff -ur monowall-root/usr/local/www/services_dhcp.php
monowall-root-pxe/usr/local/www/services_dhcp.php
--- monowall-root/usr/local/www/services_dhcp.php	2004-08-22 02:41:15.000000000 -0700
+++ monowall-root-pxe/usr/local/www/services_dhcp.php	2004-09-26 22:32:31.000000000 -0700
@@ -55,6 +55,8 @@
 list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpd'][$if]['winsserver'];
 $pconfig['enable'] = isset($config['dhcpd'][$if]['enable']);
 $pconfig['denyunknown'] = isset($config['dhcpd'][$if]['denyunknown']);
+$pconfig['nextserver'] = $config['dhcpd'][$if]['nextserver'];
+$pconfig['filename'] = $config['dhcpd'][$if]['filename'];
 
 $ifcfg = $config['interfaces'][$if];
 
@@ -121,6 +123,9 @@
 		if ($_POST['wins2'])
 			$config['dhcpd'][$if]['winsserver'][] = $_POST['wins2'];
 			
+		$config['dhcpd'][$if]['nextserver'] = $_POST['nextserver'];
+		$config['dhcpd'][$if]['filename'] = $_POST['filename'];
+
 		write_config();
 		
 		$retval = 0;
@@ -164,6 +169,8 @@
 		document.iform.wins2.disabled = 0;
 		document.iform.deftime.disabled = 0;
 		document.iform.maxtime.disabled = 0;
+		document.iform.nextserver.disabled = 0;
+		document.iform.filename.disabled = 0;
 	} else {
 		document.iform.range_from.disabled = 1;
 		document.iform.range_to.disabled = 1;
@@ -171,6 +178,8 @@
 		document.iform.wins2.disabled = 1;
 		document.iform.deftime.disabled = 1;
 		document.iform.maxtime.disabled = 1;
+		document.iform.nextserver.disabled = 1;
+		document.iform.filename.disabled = 1;
 	}
 }
 //-->
@@ -272,6 +281,28 @@
                           The default is 86400 seconds.</td>
                       </tr>
                       <tr> 
+                        <td width="22%" valign="top" class="vncell">PXE: Next-Server 
+                          </td>
+                        <td width="78%" class="vtable"> 
+                          <input name="nextserver" type="text" class="formfld" id="nextserver"
size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>">
+                          <br>
+			  This is the IP address or hostname of the TFTP
+                          server. 
+                          </td>
+                      </tr>
+                      <tr> 
+                        <td width="22%" valign="top" class="vncell">PXE: Filename 
+                          </td>
+                        <td width="78%" class="vtable"> 
+                          <input name="filename" type="text" class="formfld" id="filename"
size="10" value="<?=htmlspecialchars($pconfig['filename']);?>">
+                          <br>
+                          This is the path to the PXE boot image file, which
+			  must be on the TFTP server in order to support
+                          PXE booting.<br>
+                          See <a href="http://syslinux.zytor.com/pxe.php">
+			  The PXELinux Homepage</a> for more information.</td>
+                      </tr>
+                      <tr> 
                         <td width="22%" valign="top">&nbsp;</td>
                         <td width="78%"> 
                           <input name="if" type="hidden" value="<?=$if;?>">