]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/view: fixed direct access to addr family
authorMarek Vavrusa <marek@vavrusa.com>
Mon, 11 Jan 2016 04:29:51 +0000 (20:29 -0800)
committerMarek Vavrusa <marek@vavrusa.com>
Mon, 11 Jan 2016 04:29:51 +0000 (20:29 -0800)
modules/view/view.lua

index 1efd5fbcd0569e39208c8c6c447c1b2f34f4fda9..2550112d0db77f0df5018fe15622450afc9f7879 100644 (file)
@@ -2,11 +2,6 @@ local kres = require('kres')
 local policy = require('policy')
 local ffi = require('ffi')
 local C = ffi.C
-ffi.cdef[[
-int kr_straddr_family(const char *addr);
-int kr_straddr_subnet(void *dst, const char *addr);
-int kr_bitcmp(const char *a, const char *b, int bits);
-]]
 
 -- Module declaration
 local view = {
@@ -29,7 +24,7 @@ end
 
 -- @function Match IP against given subnet
 local function match_subnet(family, subnet, bitlen, addr)
-       return (family == addr.sa_family) and (C.kr_bitcmp(subnet, addr:ip(), bitlen) == 0)
+       return (family == addr:family()) and (C.kr_bitcmp(subnet, addr:ip(), bitlen) == 0)
 end
 
 -- @function Find view for given request
@@ -64,4 +59,4 @@ view.layer = {
        end
 }
 
-return view
\ No newline at end of file
+return view