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. a57cfc41ad99bfb4ac9ff69a1a4b965fa9a9580d
Date: Thu, 19 Jun 2014 12:13:56 +0200	[thread overview]
Message-ID: <20140619101356.8F1F9211AE@argus.ipfire.org> (raw)

[-- 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

                 reply	other threads:[~2014-06-19 10:13 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=20140619101356.8F1F9211AE@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