X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_auth.c;h=ee73e6b5adf12b11cc154e0f4e7b329ad299ee9a;hp=af8efd148ab0823a78870a7cec28d8ef20d18e79;hb=c217d214f4f071c235bc7c463a1da6124e2570a6;hpb=78fc59e994c764d072bf0045177f690a378d1308 diff --git a/src/protocol_auth.c b/src/protocol_auth.c index af8efd14..ee73e6b5 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -16,8 +16,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ */ #include "system.h" @@ -130,8 +128,7 @@ bool send_metakey(connection_t *c) buffer = alloca(2 * len + 1); - if(!c->outkey) - c->outkey = xmalloc(len); + c->outkey = xrealloc(c->outkey, len); if(!c->outctx) c->outctx = xmalloc_and_zero(sizeof(*c->outctx)); @@ -227,8 +224,7 @@ bool metakey_h(connection_t *c) /* Allocate buffers for the meta key */ - if(!c->inkey) - c->inkey = xmalloc(len); + c->inkey = xrealloc(c->inkey, len); if(!c->inctx) c->inctx = xmalloc_and_zero(sizeof(*c->inctx)); @@ -317,8 +313,7 @@ bool send_challenge(connection_t *c) buffer = alloca(2 * len + 1); - if(!c->hischallenge) - c->hischallenge = xmalloc(len); + c->hischallenge = xrealloc(c->hischallenge, len); /* Copy random data to the buffer */ @@ -359,8 +354,7 @@ bool challenge_h(connection_t *c) /* Allocate buffers for the challenge */ - if(!c->mychallenge) - c->mychallenge = xmalloc(len); + c->mychallenge = xrealloc(c->mychallenge, len); /* Convert the challenge from hexadecimal back to binary */ @@ -483,7 +477,7 @@ bool send_ack(connection_t *c) if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY) c->options |= OPTION_TCPONLY | OPTION_INDIRECT; - if((!get_config_bool(lookup_config(c->config_tree, "PMTUDiscovery"), &choice) || choice) && (myself->options & OPTION_PMTU_DISCOVERY)) + if(myself->options & OPTION_PMTU_DISCOVERY) c->options |= OPTION_PMTU_DISCOVERY; get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight); @@ -561,6 +555,10 @@ bool ack_h(connection_t *c) n->connection = c; c->node = n; + if(!(c->options & options & OPTION_PMTU_DISCOVERY)) { + c->options &= ~OPTION_PMTU_DISCOVERY; + options &= ~OPTION_PMTU_DISCOVERY; + } c->options |= options; if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)