android: Properly handle dotted-quad notation of IPv6 addresses
authorTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 13:38:47 +0000 (15:38 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 16:49:30 +0000 (18:49 +0200)
For nestat output like ::ffff:127.0.0.1:9876 we shall not treat 127 as
port but 9876 instead.

src/frontends/android/src/org/strongswan/android/logic/imc/collectors/PortFilterCollector.java

index b6e740c..ed86686 100644 (file)
@@ -30,7 +30,7 @@ public class PortFilterCollector implements Collector
 {
        private static Pattern LISTEN = Pattern.compile("\\bLISTEN\\b");
        private static Pattern PROTOCOL = Pattern.compile("\\b(tcp|udp)6?\\b");
-       private static Pattern PORT = Pattern.compile("[:]{1,3}(\\d{1,5})\\b");
+       private static Pattern PORT = Pattern.compile("[:]{1,3}(\\d{1,5})\\b(?!\\.)");
 
        @Override
        public Attribute getMeasurement()