]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
Remove the code that allowed FFI to be optional
authorOndřej Surý <ondrej@sury.org>
Mon, 16 Jan 2017 14:37:39 +0000 (15:37 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 16 Jan 2017 15:03:04 +0000 (16:03 +0100)
daemon/lua/kres.lua
daemon/lua/trust_anchors.lua
modules/policy/policy.lua

index 75f2332d4908db7ac2ae89f7a91e3ea2c373bf70..a24a73a4662c0356ea4607bc1782d3c9e9db26e4 100644 (file)
@@ -1,13 +1,7 @@
 -- 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
-end
+ffi = require('ffi')
 local bit = require('bit')
 local bor = bit.bor
 local band = bit.band
index 7416e9597b927bbcd2670efad4bdf1b55e7e829e..9f1df3fb94d3fbb0d999f3bfdbe3d341f39ce394 100644 (file)
@@ -39,30 +39,8 @@ local function bootstrap(url, ca)
        return rr
 end
 
--- 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 io.open(path, 'r') then
-                               local rr, err = bootstrap()
-                               if not rr then print(err) return false end
-                               local keyfile = assert(io.open(path, 'w'))
-                               keyfile:write(rr..'\n')
-                       end
-                       for line in io.lines(path) do
-                               trustanchor(line)
-                       end
-               end,
-               -- Disabled
-               set_insecure = function () error('[ ta ] FFI not available, this function is disabled') end,
-       }
-end
+-- Load the module
+local ffi = require 'ffi'
 local kres = require('kres')
 local C = ffi.C
 
index 5e1bc45bd0c4ec924e3239186b2b8f3f2f268732..7e3ec0d440d503bbe3871725bd4f457c60a2a0be 100644 (file)
@@ -1,5 +1,6 @@
 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
        end
 end
-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
-end
 
 local function parse_target(target)
        local addr, port = target:match '([^@]*)@?(.*)'