Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Daniel Kahn Gillmor
Knot DNS Resolver
Commits
beda0ca1
Commit
beda0ca1
authored
Jan 10, 2016
by
Marek Vavrusa
Browse files
modules/view: fixed direct access to addr family
parent
2629d35f
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/view/view.lua
View file @
beda0ca1
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment