diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-08-12 21:42:02 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-08-12 21:42:02 +0000 |
commit | 8c3e8725c163657625ba90fefc6ec13490ead13c (patch) | |
tree | d1350e1b2cafa0abfd5cfe4dd403196eb053b3fe /etc/inc/interfaces.inc | |
parent | 76b3f381b3b97ae1fc75a0bacee70b548273f53b (diff) | |
download | pfsense-8c3e8725c163657625ba90fefc6ec13490ead13c.zip pfsense-8c3e8725c163657625ba90fefc6ec13490ead13c.tar.gz |
Fixup Renew/Release
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index da1f4f0..bde5689 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -646,6 +646,49 @@ EOD; return 0; } +function interfaces_dhcp_configure($interface) { + global $config, $g; + + $optcfg = $config['interfaces'][$interface]; + + /* generate dhclient_$interface.conf */ + $fd = fopen("{$g['varetc_path']}/dhclient_{$interface}.conf", "w"); + if (!$fd) { + printf("Error: cannot open dhclient_{$interface}.conf in interfaces_dhcp_configure({$$interface}) for writing.\n"); + return 1; + } + + $dhclientconf = ""; + + if ($optcfg['dhcphostname']) { + $dhclientconf .= <<<EOD +interface "{$optcfg['if']}" { + send dhcp-client-identifier "{$optcfg['dhcphostname']}"; + send host-name "{$optcfg['dhcphostname']}"; + script "/sbin/dhclient-script"; +} + +EOD; + } + + fwrite($fd, $dhclientconf); + fclose($fd); + + $optif = $optcfg['if']; + + /* bring wan interface up before starting dhclient */ + mwexec("/sbin/ifconfig {$optif} up"); + + /* fire up dhclient */ + mwexec("/sbin/dhclient -b -c {$g['varetc_path']}/dhclient_{$optif}.conf {$optif} >/tmp/{$optif}_output >/tmp/{$optif}_error_output"); + + $fout = fopen("/tmp/ifconfig_{$optif}","w"); + fwrite($fout, "/sbin/dhclient -b -c {$g['varetc_path']}/dhclient_{$optif}.conf {$optif}"); + fclose($fout); + + return 0; +} + function interfaces_wan_dhcp_configure() { global $config, $g; @@ -708,6 +751,11 @@ function interfaces_dhcp_down($interface) { sleep(1); } +function interfaces_dhcp_up($interface) { + interfaces_dhcp_configure($interface); + sleep(1); +} + function interfaces_wan_dhcp_up() { interfaces_wan_dhcp_configure(); sleep(1); |