Commit beda0ca1 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

modules/view: fixed direct access to addr family

parent 2629d35f
......@@ -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
......
Supports Markdown
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