aboutsummaryrefslogtreecommitdiff
path: root/network/aiccu/08_setup_script.patch
blob: 26010f8097b6f23f3f42ea7ac397636c70d3bfcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Author: Norman Rasmussen <norman@rasmussen.co.za>

    Make setupscript work and add teardownscript setting.

--- aiccu.orig/common/aiccu.c
+++ aiccu/common/aiccu.c
@@ -212,9 +212,6 @@
 	fprintf(f, "# Try to automatically login and setup the tunnel?\n");
 	fprintf(f, "automatic %s\n", g_aiccu->automatic ? "true" : "false");
 	fprintf(f, "\n");
-	fprintf(f, "# Script to run after setting up the interfaces (default: none)\n");
-	fprintf(f, "%ssetupscript %s\n", g_aiccu->setupscript ? "" : "#", g_aiccu->setupscript ? g_aiccu->setupscript : "<path>");
-	fprintf(f, "\n");
 	fprintf(f, "# TLS Required?\n");
 	fprintf(f, "requiretls %s\n", g_aiccu->requiretls ? "true" : "false");
 	fprintf(f, "\n");
@@ -231,6 +228,9 @@
 	fprintf(f, "# PID File\n");
 	fprintf(f, "pidfile %s\n", g_aiccu->pidfile);
 	fprintf(f, "\n");
+	fprintf(f, "# Script to run after setting up the interfaces (default: none)\n");
+	fprintf(f, "%ssetupscript %s\n", g_aiccu->setupscript ? "" : "#", g_aiccu->setupscript ? g_aiccu->setupscript : "<path>");
+	fprintf(f, "\n");
 	fprintf(f, "# Make heartbeats (default true)\n");
 	fprintf(f, "# In general you don't want to turn this off\n");
 	fprintf(f, "# Of course only applies to AYIYA and heartbeat tunnels not to static ones\n");
--- aiccu.orig/unix-console/main.c
+++ aiccu/unix-console/main.c
@@ -471,6 +471,11 @@
 	 */
 	if (aiccu_setup(hTunnel, true))
 	{
+		if (g_aiccu->setupscript)
+		{
+			aiccu_exec("%s", g_aiccu->setupscript);
+		}
+
 		/* We need to stay running when doing Heartbeat or AYIYA */
 		if (	strcasecmp(hTunnel->sType, "6in4-heartbeat") == 0 ||
 			strcasecmp(hTunnel->sType, "ayiya") == 0)