public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
From: git@ipfire.org
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. e11f536252fe1f4317c47c121f5026b9a458a311
Date: Sun, 12 Jan 2014 15:41:39 +0100	[thread overview]
Message-ID: <20140112144140.244B920ACD@argus.ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 3968 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  e11f536252fe1f4317c47c121f5026b9a458a311 (commit)
       via  e1a51ebb851be156104d3971b85f2572fc7eeb73 (commit)
      from  b8e2d10888412cbe37b0614e88fc739732305c79 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e11f536252fe1f4317c47c121f5026b9a458a311
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sun Jan 12 15:40:50 2014 +0100

    OpenVPN: Fix daemon stuck in WAIT state.
    
    When the client is in the WAIT state, it is usally connected
    to the server.

commit e1a51ebb851be156104d3971b85f2572fc7eeb73
Author: Stefan Schantl <stefan.schantl(a)ipfire.org>
Date:   Sun Jan 12 15:34:27 2014 +0100

    openvpnctrl: Pass external IP address to N2N daemons.
    
    Fixes #10313.

-----------------------------------------------------------------------

Summary of changes:
 html/cgi-bin/index.cgi       |  2 +-
 html/cgi-bin/ovpnmain.cgi    |  2 +-
 src/misc-progs/openvpnctrl.c | 33 ++++++++++++++++++++++++++++++++-
 3 files changed, 34 insertions(+), 3 deletions(-)

Difference in files:
diff --git a/html/cgi-bin/index.cgi b/html/cgi-bin/index.cgi
index b3a2629..d6115bd 100644
--- a/html/cgi-bin/index.cgi
+++ b/html/cgi-bin/index.cgi
@@ -404,7 +404,7 @@ END
 
 				my $display;
 				my $display_colour = $Header::colourred;
-				if ( $tustate[1] eq 'CONNECTED') {
+				if (($tustate[1] eq 'CONNECTED') || ($tustate[1] eq 'WAIT')) {
 					$display_colour = $Header::colourgreen;
 					$display = $Lang::tr{'capsopen'};
 				} else {
diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi
index 75b6c75..b075cc5 100644
--- a/html/cgi-bin/ovpnmain.cgi
+++ b/html/cgi-bin/ovpnmain.cgi
@@ -4941,7 +4941,7 @@ END
 #EXITING       -- A graceful exit is in progress.
 ####
 
-		if ( $tustate[1] eq 'CONNECTED') {
+		if (($tustate[1] eq 'CONNECTED') || ($tustate[1] eq 'WAIT')) {
 			$col1="bgcolor='${Header::colourgreen}'";
 			$active = "<b><font color='#FFFFFF'>$Lang::tr{'capsopen'}</font></b>";
 		}else {
diff --git a/src/misc-progs/openvpnctrl.c b/src/misc-progs/openvpnctrl.c
index 2af5372..272db0f 100644
--- a/src/misc-progs/openvpnctrl.c
+++ b/src/misc-progs/openvpnctrl.c
@@ -168,6 +168,29 @@ int readPidFile(const char *pidfile) {
 	return pid;
 }
 
+int readExternalAddress(char* address) {
+	FILE *fp = fopen("/var/ipfire/red/local-ipaddress", "r");
+	if (!fp)
+		goto ERROR;
+
+	int r = fscanf(fp, "%s", address);
+	fclose(fp);
+
+	if (r < 0)
+		goto ERROR;
+
+	/* In case the read IP address is not valid, we empty
+	 * the content of address and return non-zero. */
+	if (!VALID_IP(address))
+		goto ERROR;
+
+	return 0;
+
+ERROR:
+	address = NULL;
+	return 1;
+}
+
 void ovpnInit(void) {
 	// Read OpenVPN configuration
 	kv = initkeyvalues();
@@ -482,10 +505,18 @@ int startNet2Net(char *name) {
 	// Make sure all firewall rules are up to date.
 	setFirewallRules();
 
+	// Get the external IP address.
+	char address[STRING_SIZE] = "";
+	int r = readExternalAddress(address);
+	if (r) {
+		fprintf(stderr, "Could not read the external address\n");
+		exit(1);
+	}
+
 	char command[STRING_SIZE];
 	snprintf(command, STRING_SIZE-1, "/sbin/modprobe tun");
 	executeCommand(command);
-	snprintf(command, STRING_SIZE-1, "/usr/sbin/openvpn --config %s", configfile);
+	snprintf(command, STRING_SIZE-1, "/usr/sbin/openvpn --local %s --config %s", address, configfile);
 	executeCommand(command);
 
 	return 0;


hooks/post-receive
--
IPFire 2.x development tree

                 reply	other threads:[~2014-01-12 14:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140112144140.244B920ACD@argus.ipfire.org \
    --to=git@ipfire.org \
    --cc=ipfire-scm@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox