diff -ur image/etc/inc/interfaces.inc image.new/etc/inc/interfaces.inc
--- image/etc/inc/interfaces.inc Sat Dec 13 15:36:58 2003
+++ image.new/etc/inc/interfaces.inc Sun Dec 21 22:50:38 2003
@@ -248,6 +248,10 @@
/* wait for processes to die */
sleep(2);
+ /* remove dhclient.conf, if it exists */
+ if (file_exists("{$g['varetc_path']}/dhclient.conf")) {
+ unlink("{$g['varetc_path']}/dhclient.conf");
+ }
/* remove mpd.conf, if it exists */
if (file_exists("{$g['varetc_path']}/mpd.conf")) {
unlink("{$g['varetc_path']}/mpd.conf");
@@ -273,8 +277,7 @@
switch ($wancfg['ipaddr']) {
case 'dhcp':
- /* fire up dhclient - don't wait for the lease (-nw) */
- mwexec("/sbin/dhclient -nw " . escapeshellarg($wancfg['if']));
+ interfaces_wan_dhcp_configure();
break;
case 'pppoe':
@@ -326,6 +329,46 @@
echo "done\n";
return 0;
+}
+
+function interfaces_wan_dhcp_configure() {
+ global $config, $g;
+
+ /* determine the hostname */
+ $syscfg = $config['system'];
+ $hostname = $syscfg['hostname'];
+
+ /* determine the wan interface */
+ $wancfg = $config['interfaces']['wan'];
+ $intf = $wancfg['if'];
+
+ /* generate dhclient.conf */
+ $fd = fopen("{$g['varetc_path']}/dhclient.conf", "w");
+ if (!$fd) {
+ printf("Error: cannot open dhclient.conf in interfaces_wan_dhcp_configure().\n");
+ return 1;
+ }
+
+ $dhclientconf = <<<EOD
+# $FreeBSD: src/etc/dhclient.conf,v 1.2.2.1 2001/12/14 11:44:31 rwatson Exp $
+#
+# This file is required by the ISC DHCP client.
+# See ``man 5 dhclient.conf'' for details.
+#
+# In most cases an empty file is sufficient for most people as the
+# defaults are usually fine.
+#
+send dhcp-client-identifier "$hostname";
+interface "$intf" {
+ send host-name "$hostname";
+}
+EOD;
+
+ fwrite($fd, $dhclientconf);
+ fclose($fd);
+
+ /* fire up dhclient - don't wait for the lease (-nw) */
+ mwexec("/sbin/dhclient -nw " . escapeshellarg($wancfg['if']));
}
function interfaces_wan_pppoe_configure() { |