Skip to content

Commit 16bfe19

Browse files
committed
Handle situation when netmask cannot be scraped from ifconfig
1 parent 00e7601 commit 16bfe19

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/parse_ifconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ def __init__(self, name, debug=False):
182182
def get_netmask_bits(self):
183183
# Convert a dotted netmask string to a bitcount int
184184
# e.g. from "255.255.252.0" to 22:
185+
if not self.netmask:
186+
return 0
185187
packed = parse_ip4addr(self.netmask)
186188
# count bits in "packed":
187189
result = 0

0 commit comments

Comments
 (0)