diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-08-20 21:13:01 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-08-20 21:13:01 -0400 |
commit | 518030b3ac5091fcd1899a97d8c10081287d1477 (patch) | |
tree | ec5a03cd4f91761ee5d8b34d86294e1f87fbf35d /etc | |
parent | 9c3472730640a793fc77b7730f70d30c5a652eea (diff) | |
download | pfsense-518030b3ac5091fcd1899a97d8c10081287d1477.zip pfsense-518030b3ac5091fcd1899a97d8c10081287d1477.tar.gz |
Add rowhelper field which allows defining custom dhcp option numbers. Sponsored-by: BSD Perimeter Commercial Support
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/services.inc | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 4310283..ddd6552 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -94,13 +94,23 @@ function services_dhcpd_configure() { return 1; } - + $optcounter = 0; + $custoptions = ""; + foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { + if($dhcpifconf['numberoptions']['item']) { + foreach($dhcpifconf['numberoptions']['item'] as $item) { + $custoptions .= " option custom-opt-$optcounter code {$item['number']} = text;\n"; + $optcounter++; + } + } + } $dhcpdconf = <<<EOD option domain-name "{$syscfg['domain']}"; option ldap-server code 95 = text; option domain-search-list code 119 = text; +{$custoptions} default-lease-time 7200; max-lease-time 86400; log-facility local7; @@ -256,25 +266,43 @@ $dnscfg EOD; - if ($dhcpifconf['defaultleasetime']) + // default-lease-time + if ($dhcpifconf['defaultleasetime']) $dhcpdconf .= " default-lease-time {$dhcpifconf['defaultleasetime']};\n"; + + // max-lease-time if ($dhcpifconf['maxleasetime']) $dhcpdconf .= " max-lease-time {$dhcpifconf['maxleasetime']};\n"; + // netbios-name* if (is_array($dhcpifconf['winsserver']) && $dhcpifconf['winsserver'][0]) { $dhcpdconf .= " option netbios-name-servers " . join(",", $dhcpifconf['winsserver']) . ";\n"; $dhcpdconf .= " option netbios-node-type 8;\n"; } + // ntp-servers if (is_array($dhcpifconf['ntpserver']) && $dhcpifconf['ntpserver'][0]) $dhcpdconf .= " option ntp-servers " . join(",", $dhcpifconf['ntpserver']) . ";\n"; + // tftp-server-name if ($dhcpifconf['tftp'] <> "") $dhcpdconf .= " option tftp-server-name \"{$dhcpifconf['tftp']}\";\n"; - if ($dhcpifconf['ldap'] <> "") + // Handle option, number rowhelper values + $optcounter = 0; + $dhcpdconf .= "\n"; + if($dhcpifconf['numberoptions']['item']) { + foreach($dhcpifconf['numberoptions']['item'] as $item) { + $dhcpdconf .= " option custom-opt-$optcounter \"{$item['value']}\";\n"; + $optcounter++; + } + } + + // ldap-server + if ($dhcpifconf['ldap'] <> "") $dhcpdconf .= " option ldap-server \"{$dhcpifconf['ldap']}\";\n"; + // net boot information if(isset($dhcpifconf['netboot'])) { if (($dhcpifconf['next-server'] <> "") && ($dhcpifconf['filename'] <> "")) { $dhcpdconf .= " next-server {$dhcpifconf['next-server']};\n"; @@ -282,7 +310,7 @@ EOD; } if ($dhcpifconf['rootpath'] <> "") { $dhcpdconf .= " option root-path \"{$dhcpifconf['rootpath']}\";\n"; - } + } } $dhcpdconf .= <<<EOD |