Ticket #13: 0001-Fixed-client-hang-when-server-don-t-PUSH-aka-the-NO_.patch

File 0001-Fixed-client-hang-when-server-don-t-PUSH-aka-the-NO_.patch, 2.1 KB (added by David Sommerseth, 14 years ago)

Patch fixing this issue

  • push.c

    From 6ba2a2f400bb48d5cc092f711d35bab9a28b10f3 Mon Sep 17 00:00:00 2001
    From: David Sommerseth <dazo@users.sourceforge.net>
    Date: Sun, 13 Jun 2010 00:35:55 +0200
    Subject: [PATCH] Fixed client hang when server don't PUSH (aka the NO_SOUP_FOR_YOU patch)
    
    Solves bug ticket 13
    <https://community.openvpn.net/openvpn/ticket/13>
    
    When the client sends PUSH_REQUESTS, it waits until the server sends PUSH_REPLY.
    If the server do not have anything to push to the client nothing happens.  The
    client will then regularly send new PUSH_REQUESTS until it gets an answer, which
    results in not completing the connection negotiation.
    
    This patch makes the server send an empty PUSH_REPLY when it has nothing to more
    to push to the client.
    
    Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
    Acked-by: James Yonan <james@openvpn.net>
    
    ---
     push.c |   17 +++++++++++++++++
     1 files changed, 17 insertions(+), 0 deletions(-)
    
    diff --git a/push.c b/push.c
    index 9ddc900..1320bec 100644
    a b send_push_reply (struct context *c) 
    177177  static char cmd[] = "PUSH_REPLY";
    178178  const int extra = 64; /* extra space for possible trailing ifconfig and push-continuation */
    179179  const int safe_cap = BCAP (&buf) - extra;
     180  bool push_sent = false;
    180181
    181182  buf_printf (&buf, cmd);
    182183
    send_push_reply (struct context *c) 
    192193                const bool status = send_control_channel_string (c, BSTR (&buf), D_PUSH);
    193194                if (!status)
    194195                  goto fail;
     196                push_sent = true;
    195197                multi_push = true;
    196198                buf_reset_len (&buf);
    197199                buf_printf (&buf, cmd);
    send_push_reply (struct context *c) 
    218220    {
    219221      const bool status = send_control_channel_string (c, BSTR (&buf), D_PUSH);
    220222      if (!status)
     223        goto fail;
     224      push_sent = true;
     225    }
     226
     227  /* If nothing have been pushed, send an empty push,
     228   * as the client is expecting a response
     229   */
     230  if (!push_sent)
     231    {
     232      bool status = false;
     233
     234      buf_reset_len (&buf);
     235      buf_printf (&buf, cmd);
     236      status = send_control_channel_string (c, BSTR(&buf), D_PUSH);
     237      if (!status)
    221238        goto fail;
    222239    }
    223240