Project

General

Profile

« Previous | Next » 

Revision 678dfd0f

Added by Erik Fonnesbeck almost 15 years ago

Add a setting for the data type of values used with DHCP option numbers and input validation for each type. Fixes #962

View differences:

etc/inc/services.inc
120 120
	foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) {	
121 121
		if(is_array($dhcpifconf['numberoptions']) && is_array($dhcpifconf['numberoptions']['item'])) {
122 122
			foreach($dhcpifconf['numberoptions']['item'] as $itemidx => $item) {
123
				$custoptions .= "option custom-{$dhcpif}-{$itemidx} code {$item['number']} = text;\n";
123
				if(!empty($item['type']))
124
					$itemtype = $item['type'];
125
				else
126
					$itemtype = "text";
127
				$custoptions .= "option custom-{$dhcpif}-{$itemidx} code {$item['number']} = {$itemtype};\n";
124 128
			}
125 129
		}
126 130
	}
......
314 318
		$dhcpdconf .= "\n";
315 319
		if($dhcpifconf['numberoptions']['item']) {
316 320
			foreach($dhcpifconf['numberoptions']['item'] as $itemidx => $item) {
317
				$dhcpdconf .= "	option custom-{$dhcpif}-{$itemidx} \"{$item['value']}\";\n";
321
				if(empty($item['type']) || $item['type'] == "text")
322
					$dhcpdconf .= "	option custom-{$dhcpif}-{$itemidx} \"{$item['value']}\";\n";
323
				else
324
					$dhcpdconf .= "	option custom-{$dhcpif}-{$itemidx} {$item['value']};\n";
318 325
			}
319 326
		}
320 327

  

Also available in: Unified diff