summaryrefslogtreecommitdiff
path: root/src/helpers/strip-private.py
diff options
context:
space:
mode:
authorerkin <e.altunbas@vyos.io>2021-03-22 13:59:25 +0300
committererkin <e.altunbas@vyos.io>2021-03-22 13:59:25 +0300
commit5d0a54ec53c18289f50ccb9cd69e0df62c63a2dc (patch)
treecadf8927cda7fdfd84b3841b704ecc41741a5ab0 /src/helpers/strip-private.py
parent661597538e0ec140914470522e5b10444d19e12d (diff)
downloadvyos-1x-5d0a54ec53c18289f50ccb9cd69e0df62c63a2dc.tar.gz
vyos-1x-5d0a54ec53c18289f50ccb9cd69e0df62c63a2dc.zip
util: T3419: Handle IP addresses with netmasks and subnet prefixes in strip-private
Diffstat (limited to 'src/helpers/strip-private.py')
-rwxr-xr-xsrc/helpers/strip-private.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/helpers/strip-private.py b/src/helpers/strip-private.py
index 23761e578..023298eec 100755
--- a/src/helpers/strip-private.py
+++ b/src/helpers/strip-private.py
@@ -19,7 +19,7 @@ import argparse
import re
import sys
-from netaddr import IPAddress, AddrFormatError
+from netaddr import IPNetwork, AddrFormatError
parser = argparse.ArgumentParser(description='strip off private information from VyOS config')
@@ -58,7 +58,7 @@ def ip_match(match: re.Match, subst: str) -> str:
result = match.group(0)
# Is this a valid IP address?
try:
- addr = IPAddress(result)
+ addr = IPNetwork(result).ip
# No? Then we've got nothing to do with it.
except AddrFormatError:
return result