Hi Martin,

On 08/08/2014 10:08 AM, Martin Willi wrote:
> Hi Thomas,
> 
>> Which reminds me of this tiny patch I have in stash. It would
>> certainly be helpful if the starter did not watch charon
>> with gdb attached.
> 
> Thanks for the patch. After pushing that to master, I've noticed that
> this change has an unwanted side effect: starter does not wait for
> charon startup, but just goes on. This implies that it tries to load
> ipsec.conf through the stroke interface, which is not available. On my
> system, this breaks configuration loading.
Ouch, you're right. That's pretty stupid, how could I not see this?

> 
> Should we instead just wait indefinitely before returning here?
Yes of course, looks like the only sensible way to me. Fixed version
of the patch is attached.

Thanks, Thomas
>From 39f3fb782653514ae74fb9ea198f50f7a25e085f Mon Sep 17 00:00:00 2001
From: Thomas Egerer <[email protected]>
Date: Fri, 8 Aug 2014 11:16:03 +0200
Subject: [PATCH] starter: With attached gdb indefinitely for pidfile to
 appear
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.11.rc2.5.g68f532f"

This is a multi-part message in MIME format.
--------------1.7.11.rc2.5.g68f532f
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


The previously implemented mechanism broke configuration loading by
returning from starter_start_charon immediately. This way starter could
not connect to the stroke plugin's socket since it was not available
yet. It is better to wait indefinitely for charon pidfile to appear if
the debugger is attached to it.

Signed-off-by: Thomas Egerer <[email protected]>
---
 src/starter/invokecharon.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)


--------------1.7.11.rc2.5.g68f532f
Content-Type: text/x-patch; name="0001-starter-With-attached-gdb-indefinitely-for-pidfile-t.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-starter-With-attached-gdb-indefinitely-for-pidfile-t.patch"

diff --git a/src/starter/invokecharon.c b/src/starter/invokecharon.c
index d40ab8c..f025171 100644
--- a/src/starter/invokecharon.c
+++ b/src/starter/invokecharon.c
@@ -201,12 +201,7 @@ int starter_start_charon (starter_config_t *cfg, bool no_fork, bool attach_gdb)
 		default:
 			/* father */
 			_charon_pid = pid;
-			if (attach_gdb)
-			{
-				/* don't monitor pid file if gdb is attached */
-				return 0;
-			}
-			for (i = 0; i < 500 && _charon_pid; i++)
+			for (i = 0; (i < 500 && _charon_pid) || attach_gdb; i++)
 			{
 				/* wait for charon for a maximum of 500 x 20 ms = 10 s */
 				usleep(20000);

--------------1.7.11.rc2.5.g68f532f--


_______________________________________________
Dev mailing list
[email protected]
https://lists.strongswan.org/mailman/listinfo/dev

Reply via email to