From 9e48b8ab65ad046dbddf513bce8ec9c34f74b2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 19 Oct 2018 14:12:53 +0200 Subject: [PATCH] make sure to strip comments from address --- src/octoprint/util/net.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/octoprint/util/net.py b/src/octoprint/util/net.py index 05106ac74..494102887 100644 --- a/src/octoprint/util/net.py +++ b/src/octoprint/util/net.py @@ -45,7 +45,12 @@ def is_lan_address(address, additional_private=None): if "/" in prefix: # v6 notation in netifaces output, e.g. "ffff:ffff:ffff:ffff::/64" _, prefix = prefix.split("/") - return netaddr.IPNetwork("{}/{}".format(address["addr"], prefix)) + + addr = address["addr"] + if "%" in addr: + # interface comment in netifaces output, e.g. "fe80::457f:bbee:d579:1063%wlan0" + addr = addr[:addr.find("%")] + return netaddr.IPNetwork("{}/{}".format(addr, prefix)) except: pass