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) |
177 | 177 | static char cmd[] = "PUSH_REPLY"; |
178 | 178 | const int extra = 64; /* extra space for possible trailing ifconfig and push-continuation */ |
179 | 179 | const int safe_cap = BCAP (&buf) - extra; |
| 180 | bool push_sent = false; |
180 | 181 | |
181 | 182 | buf_printf (&buf, cmd); |
182 | 183 | |
… |
… |
send_push_reply (struct context *c) |
192 | 193 | const bool status = send_control_channel_string (c, BSTR (&buf), D_PUSH); |
193 | 194 | if (!status) |
194 | 195 | goto fail; |
| 196 | push_sent = true; |
195 | 197 | multi_push = true; |
196 | 198 | buf_reset_len (&buf); |
197 | 199 | buf_printf (&buf, cmd); |
… |
… |
send_push_reply (struct context *c) |
218 | 220 | { |
219 | 221 | const bool status = send_control_channel_string (c, BSTR (&buf), D_PUSH); |
220 | 222 | 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) |
221 | 238 | goto fail; |
222 | 239 | } |
223 | 240 | |