mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Generate correct isInNetEx calls. See #67.
This commit is contained in:
parent
8dcad1697e
commit
d489e2eeaf
@ -520,13 +520,15 @@ module.exports = exports =
|
|||||||
new U2.AST_String value: cache.mask
|
new U2.AST_String value: cache.mask
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if cache.addr.v6
|
if not cache.addr.v4
|
||||||
|
# Example: isInNetEx(host,"fefe:13::abc/33")
|
||||||
|
# For documentation on the isInNetEx function, see:
|
||||||
|
# https://msdn.microsoft.com/en-us/library/windows/desktop/gg308479(v=vs.85).aspx
|
||||||
hostIsInNetEx = new U2.AST_Call(
|
hostIsInNetEx = new U2.AST_Call(
|
||||||
expression: new U2.AST_SymbolRef name: 'isInNetEx'
|
expression: new U2.AST_SymbolRef name: 'isInNetEx'
|
||||||
args: [
|
args: [
|
||||||
new U2.AST_SymbolRef name: 'host'
|
new U2.AST_SymbolRef name: 'host'
|
||||||
new U2.AST_String value: cache.normalized
|
new U2.AST_String value: cache.normalized + cache.addr.subnet
|
||||||
new U2.AST_String value: cache.mask
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
# Use isInNetEx if possible.
|
# Use isInNetEx if possible.
|
||||||
|
@ -268,8 +268,8 @@ describe 'Conditions', ->
|
|||||||
Conditions.match(cond, request).should.be.true
|
Conditions.match(cond, request).should.be.true
|
||||||
|
|
||||||
compiled = Conditions.compile(cond).print_to_string()
|
compiled = Conditions.compile(cond).print_to_string()
|
||||||
compiled_args = compiled.substr(compiled.lastIndexOf('('))
|
compiled.should.contain('isInNet(host,"fefe:13::abc","ffff:ffff:8000::")')
|
||||||
compiled_args.should.eql('(host,"fefe:13::abc","ffff:ffff:8000::")')
|
compiled.should.contain('isInNetEx(host,"fefe:13::abc/33")')
|
||||||
it 'should support IPv6 subnet with zero prefixLength', ->
|
it 'should support IPv6 subnet with zero prefixLength', ->
|
||||||
cond =
|
cond =
|
||||||
conditionType: "IpCondition"
|
conditionType: "IpCondition"
|
||||||
|
Loading…
Reference in New Issue
Block a user