]> git.basschouten.com Git - openhab-addons.git/commitdiff
[TR064] Fix pattern excluding some valid ip-addresses (#13894)
authorlsiepel <leosiepel@gmail.com>
Sat, 10 Dec 2022 07:48:33 +0000 (08:48 +0100)
committerGitHub <noreply@github.com>
Sat, 10 Dec 2022 07:48:33 +0000 (08:48 +0100)
* Improve logging and adjusted timeout
* Fix wanBlockIPs regex

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
bundles/org.openhab.binding.tr064/src/main/java/org/openhab/binding/tr064/internal/soap/SOAPValueConverter.java
bundles/org.openhab.binding.tr064/src/main/resources/channels.xml

index f9ff295ea92be09839bfdc094044cb7287381f30..143d4742686c9975282a76f825614990b5e00366 100644 (file)
@@ -226,13 +226,15 @@ public class SOAPValueConverter {
     @SuppressWarnings("unused")
     private State processTamListURL(State state, Tr064ChannelConfig channelConfig) throws PostProcessingException {
         try {
-            ContentResponse response = httpClient.newRequest(state.toString()).timeout(1000, TimeUnit.MILLISECONDS)
+            ContentResponse response = httpClient.newRequest(state.toString()).timeout(1500, TimeUnit.MILLISECONDS)
                     .send();
             String responseContent = response.getContentAsString();
             int messageCount = responseContent.split("<New>1</New>").length - 1;
 
             return new DecimalType(messageCount);
-        } catch (InterruptedException | TimeoutException | ExecutionException e) {
+        } catch (TimeoutException e) {
+            throw new PostProcessingException("Failed to get TAM list due to time out from URL " + state.toString(), e);
+        } catch (InterruptedException | ExecutionException e) {
             throw new PostProcessingException("Failed to get TAM list from URL " + state.toString(), e);
         }
     }
index 489391c7543d6b2ca8842de6002bdddf239374c1..80e310c4096cf7e73cec7e6018037a329232254c 100644 (file)
@@ -65,7 +65,7 @@
                        serviceId="urn:X_AVM-DE_HostFilter-com:serviceId:X_AVM-DE_HostFilter1"/>
                <getAction name="GetWANAccessByIP" argument="NewDisallow">
                        <parameter name="NewIPv4Address" thingParameter="wanBlockIPs"
-                               pattern="([1-9]\d{0,2}\.){3}[1-9]\d{0,2}(\s*#.*)*"/>
+                               pattern="^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$"/>
                </getAction>
                <setAction name="DisallowWANAccessByIP" argument="NewDisallow">
                        <parameter name="NewIPv4Address" thingParameter="wanBlockIPs"/>