From 30b71328b9fff83a65e67c6ed2a7ab4db0539662 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Sun, 20 Jan 2019 16:20:01 +0100 Subject: [PATCH] Turn ipv6 representation of ipv4 addresses to simple ips for incoming connections --- src/Connection/ConnectionServer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Connection/ConnectionServer.py b/src/Connection/ConnectionServer.py index a76c3824..a79af86d 100644 --- a/src/Connection/ConnectionServer.py +++ b/src/Connection/ConnectionServer.py @@ -131,7 +131,10 @@ class ConnectionServer(object): self.stream_server.stop() def handleIncomingConnection(self, sock, addr): - ip, port = addr + ip, port = addr[0:2] + ip = ip.lower() + if ip.startswith("::ffff:"): # IPv6 to IPv4 mapping + ip = ip.replace("::ffff:", "", 1) self.num_incoming += 1 # Connection flood protection