aboutsummaryrefslogtreecommitdiffstats
path: root/filter_plugins/ipv4.py
diff options
context:
space:
mode:
Diffstat (limited to 'filter_plugins/ipv4.py')
-rw-r--r--filter_plugins/ipv4.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/filter_plugins/ipv4.py b/filter_plugins/ipv4.py
index 1c42e82..0bf8c67 100644
--- a/filter_plugins/ipv4.py
+++ b/filter_plugins/ipv4.py
@@ -19,9 +19,9 @@ def ipv4_network(cidr):
def ipv4_nth(cidr, n):
- """Return the nth host address in a network. '10.0.20.0/24' | ipv4_nth(101) -> '10.0.20.101'"""
- network = ipv4_network(cidr)
- return _int_to_ip(_ip_to_int(network) + int(n))
+ """Return the nth host address relative to the given IP. '192.168.2.0/16' | ipv4_nth(101) -> '192.168.2.101'"""
+ ip, _ = cidr.split("/")
+ return _int_to_ip(_ip_to_int(ip) + int(n))
def ipv4_nth_cidr(cidr, n):