mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
Fix wrong logging for CIDR ranges in match_host
This commit is contained in:
parent
d679859d7d
commit
761d3ef500
@ -1055,18 +1055,16 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
# HACK: support CIDR hosts in the hosts portion
|
# HACK: support CIDR hosts in the hosts portion
|
||||||
try:
|
try:
|
||||||
header, cidrtarget = glob.split('@', 1)
|
header, cidrtarget = glob.split('@', 1)
|
||||||
log.debug('(%s) Processing CIDRs for %s (full host: %s)', self.name,
|
|
||||||
cidrtarget, glob)
|
|
||||||
# Try to parse the host portion as a CIDR range
|
# Try to parse the host portion as a CIDR range
|
||||||
network = ipaddress.ip_network(cidrtarget)
|
network = ipaddress.ip_network(cidrtarget)
|
||||||
|
|
||||||
log.debug('(%s) Found CIDR for %s, replacing target host with IP %s', self.name,
|
|
||||||
realhost, target)
|
|
||||||
real_ip = self.users[target].ip
|
real_ip = self.users[target].ip
|
||||||
if ipaddress.ip_address(real_ip) in network:
|
if ipaddress.ip_address(real_ip) in network:
|
||||||
# If the CIDR matches, hack around the host matcher by pretending that
|
# If the CIDR matches, hack around the host matcher by pretending that
|
||||||
# the lookup target was the IP and not the CIDR range!
|
# the lookup target was the IP and not the CIDR range!
|
||||||
glob = '@'.join((header, real_ip))
|
glob = '@'.join((header, real_ip))
|
||||||
|
log.debug('(%s) Found matching CIDR %s for %s, replacing target host with IP %s', self.name,
|
||||||
|
cidrtarget, target, real_ip)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user