mirror of
https://github.com/thatmattlove/hyperglass.git
synced 2026-01-17 00:38:06 +00:00
fix ip validation rule when querying an IPv6 target
This commit is contained in:
parent
a8476f2ea9
commit
5d39ff054f
1 changed files with 5 additions and 1 deletions
|
|
@ -91,7 +91,7 @@ class Rule(HyperglassModel):
|
|||
class RuleWithIP(Rule):
|
||||
"""Base IP-based rule."""
|
||||
|
||||
condition: IPvAnyNetwork
|
||||
condition: t.Union[IPv4Network, IPv6Network]
|
||||
allow_reserved: bool = False
|
||||
allow_unspecified: bool = False
|
||||
allow_loopback: bool = False
|
||||
|
|
@ -140,6 +140,10 @@ class RuleWithIP(Rule):
|
|||
except ValueError as err:
|
||||
raise InputValidationError(error=str(err), target=target) from err
|
||||
|
||||
if valid_target.version != self.condition.version:
|
||||
log.debug("{!s} is not the same IP version as {!s}", target, self.condition)
|
||||
return False
|
||||
|
||||
is_member = self.membership(valid_target, self.condition)
|
||||
in_range = self.in_range(valid_target)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue