public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
* [git.ipfire.org] IPFire 2.x development tree branch, next, updated. a57cfc41ad99bfb4ac9ff69a1a4b965fa9a9580d
@ 2014-06-19 10:13 git
  0 siblings, 0 replies; only message in thread
From: git @ 2014-06-19 10:13 UTC (permalink / raw)
  To: ipfire-scm

[-- Attachment #1: Type: text/plain, Size: 3737 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  a57cfc41ad99bfb4ac9ff69a1a4b965fa9a9580d (commit)
       via  1be398ae381d4d0cdbd50272bff4434121d36f65 (commit)
       via  ab92dc0c84cc6c11f90e753439567d80bac23e2b (commit)
      from  2f9e90ee1cfc7d535f69be244227b27a9260ee1d (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 a57cfc41ad99bfb4ac9ff69a1a4b965fa9a9580d
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Jun 19 12:13:41 2014 +0200

    core80: Add general-functions.pl to updater.

commit 1be398ae381d4d0cdbd50272bff4434121d36f65
Author: Alexander Marx <alexander.marx(a)ipfire.org>
Date:   Thu May 8 14:31:31 2014 +0200

    General-functions.pl: rewrite getnetworkip without inet_aton

commit ab92dc0c84cc6c11f90e753439567d80bac23e2b
Author: Alexander Marx <alexander.marx(a)ipfire.org>
Date:   Thu May 8 14:08:04 2014 +0200

    General-functions.pl: rewrite IpInSubnet replace inet_ntoa

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

Summary of changes:
 config/cfgroot/general-functions.pl      | 27 ++++++++++++++++++---------
 config/rootfiles/core/80/filelists/files |  1 +
 2 files changed, 19 insertions(+), 9 deletions(-)

Difference in files:
diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index 271dc41..6fabf1c 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -413,9 +413,9 @@ sub getnetworkip
 	#Gets:  IP, CIDR    (10.10.10.0-255, 24)
 	#Gives:  10.10.10.0
 	my ($ccdip,$ccdsubnet) = @_;
-	my $ip_address_binary = inet_aton( $ccdip );
-	my $netmask_binary    = ~pack("N", (2**(32-$ccdsubnet))-1);
-	my $network_address    = inet_ntoa( $ip_address_binary & $netmask_binary );
+	my $ip_address_binary = &Socket::inet_pton( AF_INET,$ccdip );
+	my $netmask_binary = &Socket::inet_pton(AF_INET,&iporsubtodec($ccdsubnet));
+	my $network_address    = &Socket::inet_ntop( AF_INET,$ip_address_binary & $netmask_binary );
 	return $network_address;
 }
 
@@ -760,12 +760,21 @@ sub validportrange # used to check a port range
 # Return: TRUE/FALSE
 sub IpInSubnet
 {
-    my $ip = unpack('N', &Socket::inet_aton(shift));
-    my $start = unpack('N', &Socket::inet_aton(shift));
-    my $mask  = unpack('N', &Socket::inet_aton(shift));
-       $start &= $mask;  # base of subnet...
-    my $end   = $start + ~$mask;
-    return (($ip >= $start) && ($ip <= $end));
+	my $addr = shift;
+	my $network = shift;
+	my $netmask = shift;
+
+	my $addr_num = &Socket::inet_pton(AF_INET,$addr);
+	my $network_num = &Socket::inet_pton(AF_INET,$network);
+	my $netmask_num = &Socket::inet_pton(AF_INET,$netmask);
+
+	# Find start address
+	my $network_start = $network_num & $netmask_num;
+
+	# Find end address
+	my $network_end = $network_start ^ ~$netmask_num;
+
+	return (($addr_num ge $network_start) && ($addr_num le $network_end));
 }
 
 #
diff --git a/config/rootfiles/core/80/filelists/files b/config/rootfiles/core/80/filelists/files
index 82e4376..57448d7 100644
--- a/config/rootfiles/core/80/filelists/files
+++ b/config/rootfiles/core/80/filelists/files
@@ -1,3 +1,4 @@
 etc/system-release
 etc/issue
 usr/local/bin/setddns.pl
+var/ipfire/general-functions.pl


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-19 10:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19 10:13 [git.ipfire.org] IPFire 2.x development tree branch, next, updated. a57cfc41ad99bfb4ac9ff69a1a4b965fa9a9580d git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox