Commit 3d4ca69a authored by Ondřej Surý's avatar Ondřej Surý

Merge branch 'require-ffi' into 'master'

Remove the code that allowed FFI to be optional

See merge request !143
parents 6c95f1f4 50279ffa
-- LuaJIT ffi bindings for libkres, a DNS resolver library.
-- @note Since it's statically compiled, it expects to find the symbols in the C namespace.
local ffi_ok
ffi_ok, ffi = pcall(require, 'ffi')
if not ffi_ok then
local M = { error = 'FFI not available, resolver bindings disabled.' }
setmetatable(M, {__index = function(t,k,v) error(rawget(M, 'error')) end })
return M
ffi = require('ffi')
local bit = require('bit')
local bor = bit.bor
local band =
......@@ -39,30 +39,8 @@ local function bootstrap(url, ca)
return rr
-- Load the module (check for FFI)
local ffi_ok, ffi = pcall(require, 'ffi')
if not ffi_ok then
-- Simplified TA management, no RFC5011 automatics
return {
-- Reuse Lua/C global function
add = trustanchor,
-- Simplified trust anchor management
config = function (path)
if not path then return end
if not, 'r') then
local rr, err = bootstrap()
if not rr then print(err) return false end
local keyfile = assert(, 'w'))
for line in io.lines(path) do
-- Disabled
set_insecure = function () error('[ ta ] FFI not available, this function is disabled') end,
-- Load the module
local ffi = require 'ffi'
local kres = require('kres')
local C = ffi.C
local kres = require('kres')
local bit = require('bit')
local ffi = require('ffi')
-- Counter of unique rules
local nextid = 0
......@@ -30,10 +31,6 @@ if has_socket then
return s
local has_ffi, ffi = pcall(require, 'ffi')
if not has_ffi then
socket_client = function () return error("missing ffi library, required for this policy") end
local function parse_target(target)
local addr, port = target:match '([^@]*)@?(.*)'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment