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. 35a21a254d2d45488eea77eb6a6e947f38c4e388
Date: Mon, 09 Nov 2015 18:38:02 +0100	[thread overview]
Message-ID: <20151109173802.B33A321445@argus.ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 8395 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  35a21a254d2d45488eea77eb6a6e947f38c4e388 (commit)
       via  a9efe3bd68f83c2281ba934a872ff0100fa9b863 (commit)
       via  f770b72899bcd7977a83e0237c9840804f6a46ca (commit)
      from  f7d4c48ded189f935d0eb0c836caca35873e554f (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 35a21a254d2d45488eea77eb6a6e947f38c4e388
Author: Alexander Marx <alexander.marx(a)ipfire.org>
Date:   Fri Jul 24 10:36:12 2015 +0200

    BUG10902: Add statusfile line when editing an ovpn n2n connection
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit a9efe3bd68f83c2281ba934a872ff0100fa9b863
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon Nov 9 17:33:50 2015 +0000

    core95: Add changed network-functions.pl to updater
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit f770b72899bcd7977a83e0237c9840804f6a46ca
Author: Alexander Marx <alexander.marx(a)ipfire.org>
Date:   Mon Nov 9 12:42:47 2015 +0100

    BUG10940: remove leading zeros in ip address
    
    in firewallgroups (hosts) an error was created when using ip adresses
    like 192.168.000.008. Now all leading zeros are deleted in
    firewallgroups and in the firewall itself when using single ip addresses
    as source or target.
    
    Signed-off-by: Alexander Marx <alexander.marx(a)ipfire.org>
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

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

Summary of changes:
 config/cfgroot/network-functions.pl      | 13 +++++++++++++
 config/rootfiles/core/95/filelists/files |  1 +
 html/cgi-bin/firewall.cgi                |  8 ++++++++
 html/cgi-bin/fwhosts.cgi                 | 13 +++++++------
 html/cgi-bin/ovpnmain.cgi                |  6 ++++++
 5 files changed, 35 insertions(+), 6 deletions(-)

Difference in files:
diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl
index cb4ca3d..70fa5ed 100644
--- a/config/cfgroot/network-functions.pl
+++ b/config/cfgroot/network-functions.pl
@@ -122,6 +122,19 @@ sub network2bin($) {
 	return ($network_start, $netmask_bin);
 }
 
+# Deletes leading zeros in ip address
+sub ip_remove_zero{
+	my $address = shift;
+	my @ip = split (/\./, $address);
+
+	foreach my $octet (@ip) {
+		$octet = int($octet);
+	}
+
+	$address = join (".", @ip);
+
+	return $address;
+}
 # Returns True for all valid IP addresses
 sub check_ip_address($) {
 	my $address = shift;
diff --git a/config/rootfiles/core/95/filelists/files b/config/rootfiles/core/95/filelists/files
index 4fb0117..28c9e8e 100644
--- a/config/rootfiles/core/95/filelists/files
+++ b/config/rootfiles/core/95/filelists/files
@@ -23,3 +23,4 @@ usr/local/bin/settime
 usr/local/bin/timecheck
 var/ipfire/backup/exclude
 var/ipfire/langs
+var/ipfire/network-functions.pl
diff --git a/html/cgi-bin/firewall.cgi b/html/cgi-bin/firewall.cgi
index 682c285..8007182 100644
--- a/html/cgi-bin/firewall.cgi
+++ b/html/cgi-bin/firewall.cgi
@@ -31,6 +31,7 @@ no warnings 'uninitialized';
 #use CGI::Carp 'fatalsToBrowser';
 
 require '/var/ipfire/general-functions.pl';
+require '/var/ipfire/network-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 require "${General::swroot}/geoip-functions.pl";
@@ -465,6 +466,9 @@ sub checksource
 			}
 		}
 		if ($fwdfwsettings{'isip'} eq 'on'){
+			#remove leading zero
+			$ip = &Network::ip_remove_zero($ip);
+
 			##check if ip is valid
 			if (! &General::validip($ip)){
 				$errormessage.=$Lang::tr{'fwdfw err src_addr'}."<br>";
@@ -569,11 +573,15 @@ sub checktarget
 			($ip,$subnet)=split (/\//,$fwdfwsettings{'tgt_addr'});
 			$subnet = &General::iporsubtocidr($subnet);
 		}
+
 		#check if only ip
 		if($fwdfwsettings{'tgt_addr'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
 			$ip=$fwdfwsettings{'tgt_addr'};
 			$subnet='32';
 		}
+		#remove leading zero
+		$ip = &Network::ip_remove_zero($ip);
+
 		#check if ip is valid
 		if (! &General::validip($ip)){
 			$errormessage.=$Lang::tr{'fwdfw err tgt_addr'}."<br>";
diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index 994a50a..35afad3 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -27,6 +27,7 @@ use Sort::Naturally;
 use CGI::Carp 'fatalsToBrowser';
 no warnings 'uninitialized';
 require '/var/ipfire/general-functions.pl';
+require '/var/ipfire/network-functions.pl';
 require "/var/ipfire/geoip-functions.pl";
 require "/usr/lib/firewall/firewall-lib.pl";
 require "${General::swroot}/lang.pl";
@@ -277,6 +278,9 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
 		&addnet;
 		&viewtablenet;
 	}else{
+		#convert ip if leading '0' exists
+		$fwhostsettings{'IP'} = &Network::ip_remove_zero($fwhostsettings{'IP'});
+
 		#check valid ip 
 		if (!&General::validipandmask($fwhostsettings{'IP'}."/".$fwhostsettings{'SUBNET'}))
 		{
@@ -372,9 +376,6 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
 			foreach my $i (0 .. 3) { $customnetwork{$key}[$i] = "";}
 			$fwhostsettings{'SUBNET'}	= &General::iporsubtocidr($fwhostsettings{'SUBNET'});
 			$customnetwork{$key}[0] 	= $fwhostsettings{'HOSTNAME'};
-			#convert ip when leading '0' in byte
-			$fwhostsettings{'IP'}		=&General::ip2dec($fwhostsettings{'IP'});
-			$fwhostsettings{'IP'}		=&General::dec2ip($fwhostsettings{'IP'});
 			$customnetwork{$key}[1] 	= &General::getnetworkip($fwhostsettings{'IP'},$fwhostsettings{'SUBNET'}) ;
 			$customnetwork{$key}[2] 	= &General::iporsubtodec($fwhostsettings{'SUBNET'}) ;
 			$customnetwork{$key}[3] 	= $fwhostsettings{'NETREMARK'};
@@ -423,6 +424,9 @@ if ($fwhostsettings{'ACTION'} eq 'savehost')
 		}
 		#CHECK IP-PART
 		if ($fwhostsettings{'type'} eq 'ip'){
+			#convert ip if leading '0' exists
+			$fwhostsettings{'IP'} = &Network::ip_remove_zero($fwhostsettings{'IP'});
+
 			#check for subnet
 			if (rindex($fwhostsettings{'IP'},'/') eq '-1' ){
 				if($fwhostsettings{'type'} eq 'ip' && !&General::validipandmask($fwhostsettings{'IP'}."/32"))
@@ -503,9 +507,6 @@ if ($fwhostsettings{'ACTION'} eq 'savehost')
 			$customhost{$key}[0] = $fwhostsettings{'HOSTNAME'} ;
 			$customhost{$key}[1] = $fwhostsettings{'type'} ;
 			if ($fwhostsettings{'type'} eq 'ip'){
-				#convert ip when leading '0' in byte
-				$fwhostsettings{'IP'}=&General::ip2dec($fwhostsettings{'IP'});
-				$fwhostsettings{'IP'}=&General::dec2ip($fwhostsettings{'IP'});
 				$customhost{$key}[2] = $fwhostsettings{'IP'}."/".&General::iporsubtodec($fwhostsettings{'SUBNET'});
 			}else{
 				$customhost{$key}[2] = $fwhostsettings{'IP'};
diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi
index 7b75952..62af54e 100644
--- a/html/cgi-bin/ovpnmain.cgi
+++ b/html/cgi-bin/ovpnmain.cgi
@@ -1029,6 +1029,9 @@ unless(-d "${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}"){mkdir "${General
   print CLIENTCONF "up \"/etc/init.d/static-routes start\"\n";
   print CLIENTCONF "# tun Device\n"; 
   print CLIENTCONF "dev tun\n"; 
+  print CLIENTCONF "#Logfile for statistics\n";
+  print CLIENTCONF "status-version 1\n";
+  print CLIENTCONF "status /var/run/openvpn/$cgiparams{'NAME'}-n2n 10\n";
   print CLIENTCONF "# Port and Protokol\n"; 
   print CLIENTCONF "port $cgiparams{'DEST_PORT'}\n"; 
 
@@ -2140,6 +2143,9 @@ if ($confighash{$cgiparams{'KEY'}}[3] eq 'net'){
    print CLIENTCONF "route $remsubnet[0] $remsubnet[1]\n";
    print CLIENTCONF "# tun Device\n"; 
    print CLIENTCONF "dev tun\n"; 
+   print CLIENTCONF "#Logfile for statistics\n";
+   print CLIENTCONF "status-version 1\n";
+   print CLIENTCONF "status /var/run/openvpn/$cgiparams{'NAME'}-n2n 10\n";
    print CLIENTCONF "# Port and Protokoll\n"; 
    print CLIENTCONF "port $confighash{$cgiparams{'KEY'}}[29]\n"; 
    


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

                 reply	other threads:[~2015-11-09 17:38 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=20151109173802.B33A321445@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