Revision 5c5a7bc8
Added by Viktor Gurov over 3 years ago
src/etc/inc/services.inc | ||
---|---|---|
592 | 592 |
if (is_array($dhcpifconf['staticmap'])) { |
593 | 593 |
$i = 0; |
594 | 594 |
foreach ($dhcpifconf['staticmap'] as $sm) { |
595 |
$idx = 0; |
|
596 |
$httpclient = false; |
|
595 | 597 |
if (is_array($sm['numberoptions']) && is_array($sm['numberoptions']['item'])) { |
596 | 598 |
foreach ($sm['numberoptions']['item'] as $itemidx => $item) { |
597 | 599 |
if (!empty($item['type'])) { |
... | ... | |
601 | 603 |
} |
602 | 604 |
$custoptions .= "option custom-s_{$dhcpif}_{$i}-{$itemidx} code {$item['number']} = {$itemtype};\n"; |
603 | 605 |
} |
606 |
if (($item['type'] == "text") && |
|
607 |
($item['number'] == 60) && |
|
608 |
(base64_decode($item['value']) == "HTTPClient")) { |
|
609 |
$httpclient = true; |
|
610 |
} |
|
611 |
$idx++; |
|
612 |
} |
|
613 |
if (!empty($sm['uefihttpboot']) && !$httpclient) { |
|
614 |
$custoptions .= "option custom-s_{$dhcpif}_{$i}-{$idx} code 60 = text;\n"; |
|
604 | 615 |
} |
605 | 616 |
$i++; |
606 | 617 |
} |
... | ... | |
1352 | 1363 |
|
1353 | 1364 |
// Handle option, number rowhelper values |
1354 | 1365 |
$dhcpdconf .= "\n"; |
1366 |
$idx = 0; |
|
1367 |
$httpclient = false; |
|
1355 | 1368 |
if (isset($sm['numberoptions']['item']) && is_array($sm['numberoptions']['item'])) { |
1356 | 1369 |
foreach ($sm['numberoptions']['item'] as $itemidx => $item) { |
1357 | 1370 |
$item_value = base64_decode($item['value']); |
... | ... | |
1361 | 1374 |
$dhcpdconf .= " option custom-s_{$dhcpif}_{$i}-{$itemidx} {$item_value};\n"; |
1362 | 1375 |
} |
1363 | 1376 |
} |
1377 |
if (($item['type'] == "text") && |
|
1378 |
($item['number'] == 60) && |
|
1379 |
(base64_decode($item['value']) == "HTTPClient")) { |
|
1380 |
$httpclient = true; |
|
1381 |
} |
|
1382 |
$idx++; |
|
1383 |
} |
|
1384 |
if (!empty($poolconf['uefihttpboot']) && !$httpclient) { |
|
1385 |
$dhcpdconf .= " option custom-s_{$dhcpif}_{$i}-{$idx} \"HTTPClient\";\n"; |
|
1364 | 1386 |
} |
1365 | 1387 |
|
1366 | 1388 |
// ldap-server |
... | ... | |
1378 | 1400 |
if (!empty($sm['filename'])) { |
1379 | 1401 |
$filename = $sm['filename']; |
1380 | 1402 |
} |
1403 |
if (!empty($sm['uefihttpboot'])) { |
|
1404 |
$pxe_files[] = array('HTTPClient', $sm['uefihttpboot']); |
|
1405 |
} |
|
1381 | 1406 |
if (!empty($sm['filename32'])) { |
1382 | 1407 |
$pxe_files[] = array('00:06', $sm['filename32']); |
1383 | 1408 |
} |
... | ... | |
1395 | 1420 |
$pxeif = false; |
1396 | 1421 |
if (is_array($pxe_files) && !empty($pxe_files)) { |
1397 | 1422 |
foreach ($pxe_files as $pxe) { |
1423 |
if ($pxe[0] == 'HTTPClient') { |
|
1424 |
$expr = "substring (option vendor-class-identifier, 0, 10) = \"HTTPClient\" {\n"; |
|
1425 |
} else { |
|
1426 |
$expr = "option arch = {$pxe[0]} {\n"; |
|
1427 |
} |
|
1398 | 1428 |
if (!$pxeif) { |
1399 |
$dhcpdconf .= " if option arch = {$pxe[0]} {\n";
|
|
1429 |
$dhcpdconf .= " if " . $expr;
|
|
1400 | 1430 |
$pxeif = true; |
1401 | 1431 |
} else { |
1402 |
$dhcpdconf .= " else if option arch = {$pxe[0]} {\n";
|
|
1432 |
$dhcpdconf .= " else if " . $expr;
|
|
1403 | 1433 |
} |
1404 | 1434 |
$dhcpdconf .= " filename \"{$pxe[1]}\";\n"; |
1405 | 1435 |
$dhcpdconf .= " }"; |
Also available in: Unified diff
DHCPD HTTPClient option for static mappings. Fixes #12896