]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Return -EPERM when server changes IP address, not -EINVAL
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 10 May 2019 11:06:19 +0000 (12:06 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 10 May 2019 11:06:19 +0000 (12:06 +0100)
This will be treated as an auth failure, and the ssl_reconnect() function
will give up instead of continuing to retry.

Fixes: #38
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
cstp.c

diff --git a/cstp.c b/cstp.c
index df64ae1ac0df8165a33ce2c536c84057e3559abc..f59facc67ba9284d4572c2c668fb330d4ff00947 100644 (file)
--- a/cstp.c
+++ b/cstp.c
@@ -604,7 +604,8 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
                        vpn_progress(vpninfo, PRG_ERR,
                                     _("Reconnect gave different Legacy IP address (%s != %s)\n"),
                                     vpninfo->ip_info.addr, old_addr);
-                       return -EINVAL;
+                       /* EPERM means that the retry loop will abort and won't keep trying. */
+                       return -EPERM;
                }
        }
        if (old_netmask) {
@@ -612,7 +613,7 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
                        vpn_progress(vpninfo, PRG_ERR,
                                     _("Reconnect gave different Legacy IP netmask (%s != %s)\n"),
                                     vpninfo->ip_info.netmask, old_netmask);
-                       return -EINVAL;
+                       return -EPERM;
                }
        }
        if (old_addr6) {
@@ -620,7 +621,7 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
                        vpn_progress(vpninfo, PRG_ERR,
                                     _("Reconnect gave different IPv6 address (%s != %s)\n"),
                                     vpninfo->ip_info.addr6, old_addr6);
-                       return -EINVAL;
+                       return -EPERM;
                }
        }
        if (old_netmask6) {
@@ -628,7 +629,7 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
                        vpn_progress(vpninfo, PRG_ERR,
                                     _("Reconnect gave different IPv6 netmask (%s != %s)\n"),
                                     vpninfo->ip_info.netmask6, old_netmask6);
-                       return -EINVAL;
+                       return -EPERM;
                }
        }