1 |
diff -Nur e-smith-proxy-5.4.0/root/etc/e-smith/templates/etc/squid/squid.conf/20ACL10localhost e-smith-proxy-5.4.0-cidr/root/etc/e-smith/templates/etc/squid/squid.conf/20ACL10localhost |
2 |
--- e-smith-proxy-5.4.0/root/etc/e-smith/templates/etc/squid/squid.conf/20ACL10localhost 2005-07-19 01:06:32.000000000 +0200 |
3 |
+++ e-smith-proxy-5.4.0-cidr/root/etc/e-smith/templates/etc/squid/squid.conf/20ACL10localhost 2013-02-18 22:36:12.513504277 +0100 |
4 |
@@ -1,9 +1,21 @@ |
5 |
{ |
6 |
use esmith::NetworksDB; |
7 |
+ use Net::IPv4Addr; |
8 |
|
9 |
my $ndb = esmith::NetworksDB->open_ro(); |
10 |
|
11 |
- $localAccess = $ndb->local_access_spec(); |
12 |
+ my $localAccess = ''; |
13 |
+ foreach ($ndb->local_access_spec()){ |
14 |
+ # If there's a / in the network string |
15 |
+ # then convert to CIDR notation |
16 |
+ if (m!/!) { |
17 |
+ my ($ip,$bits) = Net::IPv4Addr::ipv4_parse($_); |
18 |
+ $localAccess .= "$ip/$bits "; |
19 |
+ } |
20 |
+ else { |
21 |
+ $localAccess .= "$_ "; |
22 |
+ } |
23 |
+ } |
24 |
|
25 |
$OUT .= "acl localsrc src $localAccess\n"; |
26 |
$OUT .= "acl localdst dst $localAccess"; |