From: Daniel Lenski Date: Fri, 15 May 2020 02:19:50 +0000 (-0700) Subject: Isn't this great? X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=37a42b4790ea10f7a72148fc2986c8d476f0c2d2;p=users%2Fdwmw2%2Fopenconnect.git Isn't this great? Signed-off-by: Daniel Lenski --- diff --git a/ppp.c b/ppp.c index 1844a856..7ee0e969 100644 --- a/ppp.c +++ b/ppp.c @@ -924,14 +924,12 @@ int ppp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable) /* If SSL_write() fails we are expected to try again. With exactly the same data, at exactly the same location. So we keep the packet we had before.... */ - if (vpninfo->current_ssl_pkt) { + if ((this = vpninfo->current_ssl_pkt)) { handle_outgoing: vpninfo->ssl_times.last_tx = time(NULL); unmonitor_write_fd(vpninfo, ssl); - ret = ssl_nonblock_write(vpninfo, - vpninfo->current_ssl_pkt->data - vpninfo->current_ssl_pkt->ppp.hlen, - vpninfo->current_ssl_pkt->len + vpninfo->current_ssl_pkt->ppp.hlen); + ret = ssl_nonblock_write(vpninfo, this->data - this->ppp.hlen, this->len + this->ppp.hlen); if (ret < 0) goto do_reconnect; else if (!ret) { @@ -952,17 +950,15 @@ int ppp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable) } } - if (ret != vpninfo->current_ssl_pkt->len + vpninfo->current_ssl_pkt->ppp.hlen) { + if (ret != this->len + this->ppp.hlen) { vpn_progress(vpninfo, PRG_ERR, _("SSL wrote too few bytes! Asked for %d, sent %d\n"), - vpninfo->current_ssl_pkt->len + vpninfo->current_ssl_pkt->ppp.hlen, ret); + this->len + this->ppp.hlen, ret); vpninfo->quit_reason = "Internal error"; return 1; } - if (1 /*vpninfo->current_ssl_pkt != &dpd_pkt*/) - free(vpninfo->current_ssl_pkt); - + free(this); vpninfo->current_ssl_pkt = NULL; }