[NetworkManager-openconnect] Allow IP prefixes of 0 for routing rules



commit ca4187c54b4b86a5557ca9464ee6a694e86ab344
Author: Aaron Barany <aaron barany here com>
Date:   Wed Apr 14 16:23:48 2021 -0700

    Allow IP prefixes of 0 for routing rules
    
    A prefix of 0 is used for routing rules that accept all traffic. For
    example, a VPN may accept all traffic by default while excluding specific
    IPs. Previously, the "accept all traffic by default" rule was rejected as
    invalid due to having an IP prefix of 0.
    
    This also requires a similar fix in the main NetworkManager package to work
    properly. Versions of NetworkManager without the fix will silently reject
    the rule, yielding the same behavior as before this commit.
    
    https://gitlab.gnome.org/GNOME/NetworkManager-openconnect/-/issues/52
    
    https://gitlab.gnome.org/GNOME/NetworkManager-openconnect/-/merge_requests/21

 src/nm-openconnect-service-openconnect-helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nm-openconnect-service-openconnect-helper.c b/src/nm-openconnect-service-openconnect-helper.c
index 148b26e..88d1c5e 100644
--- a/src/nm-openconnect-service-openconnect-helper.c
+++ b/src/nm-openconnect-service-openconnect-helper.c
@@ -345,7 +345,7 @@ get_ip4_routes (void)
 
                        errno = 0;
                        tmp_prefix = strtol (tmp, NULL, 10);
-                       if (errno || tmp_prefix <= 0 || tmp_prefix > 32) {
+                       if (errno || tmp_prefix < 0 || tmp_prefix > 32) {
                                _LOGW ("Ignoring invalid static route prefix '%s'", tmp ? tmp : "NULL");
                                continue;
                        }
@@ -419,7 +419,7 @@ get_ip6_routes (void)
 
                        errno = 0;
                        tmp_prefix = strtol (tmp, NULL, 10);
-                       if (errno || tmp_prefix <= 0 || tmp_prefix > 128) {
+                       if (errno || tmp_prefix < 0 || tmp_prefix > 128) {
                                _LOGW ("Ignoring invalid static route prefix '%s'", tmp ? tmp : "NULL");
                                continue;
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]