Ticket #408: bug-408-remove-assert.patch

File bug-408-remove-assert.patch, 1.3 KB (added by JoshC, 7 years ago)
  • src/openvpn/helper.c

    From 7c596dc93a6f1807d98131f735bfec266428526b Mon Sep 17 00:00:00 2001
    From: Josh Cepek <josh.cepek@usa.net>
    Date: Mon, 26 May 2014 14:13:35 -0500
    Subject: [PATCH] Remove an ASSERT that hides incorrect usage of --tcp-nodelay
    
    The options mutation occurs before verification, which causes an
    ASSERT(0) to be reached before the more useful error text.
    
    This change allows the mutation code to silently ignore usage in
    non-server mode and handle any warning or errors later during
    verification.
    ---
     src/openvpn/helper.c | 14 ++++----------
     1 file changed, 4 insertions(+), 10 deletions(-)
    
    diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
    index d9eef03..35957b3 100644
    a b void 
    521521helper_tcp_nodelay (struct options *o)
    522522{
    523523#if P2MP_SERVER
    524   if (o->server_flags & SF_TCP_NODELAY_HELPER)
     524  if (o->server_flags & SF_TCP_NODELAY_HELPER
     525      && o->mode == MODE_SERVER)
    525526    {
    526       if (o->mode == MODE_SERVER)
    527         {
    528           o->sockflags |= SF_TCP_NODELAY;         
    529           push_option (o, print_str ("socket-flags TCP_NODELAY", &o->gc), M_USAGE);
    530         }
    531       else
    532         {
    533           ASSERT (0);
    534         }
     527      o->sockflags |= SF_TCP_NODELAY;     
     528      push_option (o, print_str ("socket-flags TCP_NODELAY", &o->gc), M_USAGE);
    535529    }
    536530#endif
    537531}