]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
PPP: Replace no_terminate_on_pause flag with terminate_on_pause flag
authorDaniel Lenski <dlenski@gmail.com>
Thu, 17 Jun 2021 20:14:32 +0000 (13:14 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 17 Jun 2021 20:14:32 +0000 (13:14 -0700)
We know of two real-world PPP-based VPNs that require us *not* to TERMINATE
at the PPP layer if we will want to subsequently resume a connection.  We
don't know of any real-world PPP-based VPNs that *do* want us to TERMINATE
at the PPP layer in this case; in fact, any server that *requires* this
would be unable to resume inadvertently dropped connections.

Replace the no_terminate_on_pause flag with a terminate_on_pause flag, in
order to reduce boilerplate and use the more plausible behavior as the
default.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
ppp.c
ppp.h

diff --git a/ppp.c b/ppp.c
index 05e88a281c40193d8f0364e85d905b12eabff804..3e61b742c3bf30c2f7fe697d8209271235bf75fe 100644 (file)
--- a/ppp.c
+++ b/ppp.c
@@ -261,24 +261,17 @@ int ppp_reset(struct openconnect_info *vpninfo)
 
        switch (ppp->encap) {
        case PPP_ENCAP_F5:
-               /* XX: F5 server cancels our IP address allocation if we PPP-terminate */
-               ppp->no_terminate_on_pause = 1;
                ppp->encap_len = 4;
                break;
 
        case PPP_ENCAP_FORTINET:
                /* XX: Fortinet server rejects asyncmap and header compression. Don't blame me. */
-               ppp->no_terminate_on_pause = 1;
                ppp->out_lcp_opts &= ~(BIT_PFCOMP | BIT_ACCOMP);
                ppp->encap_len = 6;
                ppp->check_http_response = 1;
                break;
 
        case PPP_ENCAP_F5_HDLC:
-               /* XX: F5 server cancels our IP address allocation if we PPP-terminate */
-               ppp->no_terminate_on_pause = 1;
-               /* fall through */
-
        case PPP_ENCAP_RFC1662_HDLC:
                ppp->encap_len = 0;
                ppp->hdlc = 1;
@@ -974,11 +967,11 @@ static int handle_state_transition(struct openconnect_info *vpninfo, int dtls,
                /* XX: When we pause and reconnect, we expect the auth cookie/session (external to the
                 * PPP layer) to remain valid, and to negotiate the same IP addresses on reconnection.
                 *
-                * However, some servers cancel our session or cancel our IP address allocation if we
+                * However, most servers cancel our session or cancel our IP address allocation if we
                 * TERMINATE at the PPP layer, so we shouldn't do it when pausing.
                 */
                if (vpninfo->got_cancel_cmd ||
-                   (vpninfo->got_pause_cmd && !ppp->no_terminate_on_pause))
+                   (vpninfo->got_pause_cmd && ppp->terminate_on_pause))
                        ppp->ppp_state = PPPS_TERMINATE;
                else
                        break;
diff --git a/ppp.h b/ppp.h
index e9176ab1a996b23f6ead7069d92e3d862ff83c2a..2210c1a29862ed76b900bfaa92b6dd1596072e69 100644 (file)
--- a/ppp.h
+++ b/ppp.h
@@ -106,7 +106,7 @@ struct oc_ppp {
        int want_ipv4;
        int want_ipv6;
        int check_http_response;
-       int no_terminate_on_pause;
+       int terminate_on_pause;
 
        int ppp_state;
        struct oc_ncp lcp;