function config_ntp_servers($ntpsrv) { $txt = ''; foreach (lk_addr_item('hostname', $ntpsrv) as $srv) { $txt .= ' list server ' . $srv . NL; } return $txt; }
function _fw_expand_macs($h) { $macs = array(); global $hosts; $nic = false; $hn = $h; if ($p = strrpos($h, '-')) { if ($p) { $nic = substr($h, $p + 1); $hn = substr($h, 0, $p); } } foreach (lk_addr_item('mac', $hn, $nic) as $mc) { $macs[] = ' option src_mac ' . $mc . NL; } if (!isset($hosts[$hn])) { $macs[] = ' option src_mac ' . $h . NL; return $macs; } if (count($macs) == 0) { trigger_error("{$h}: Has no MAC's defined", E_USER_WARNING); } return $macs; }
function res($type, $a = NULL, $b = NULL, $index = -1) { $res = lk_addr_item($type, $a, $b); if (count($res) == 0) { trigger_error("{$a} ({$type}) not found", E_USER_WARNING); return '#MISSING($a $type)'; } if ($index == -1) { return implode(',', $res); } //if ($index == MSYS_LOOKUP_FIRST) { //$v = array_values($res); //return $res[0]; //} return $res[$index]; }