Changeset 350
- Timestamp:
- Sep 13, 2018, 5:49:24 PM (6 years ago)
- Location:
- trunk/ddt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ddt/ddt
r348 r350 4 4 # License GNU GPL version 2 or later and Perl equivalent 5 5 # 6 # apt-get install perl-base perl-modules libyaml-syck-perl libnet-netmask-perl libreadonly-perl libfile-touch-perl libtext-table-perl 6 # apt-get install perl-base perl-modules libyaml-syck-perl libnet-netmask-perl libreadonly-perl libfile-touch-perl libtext-table-perl libnetaddr-ip-perl 7 7 8 8 package DDT::RE; … … 21 21 use strict; 22 22 #use warnings; 23 use version; our $VERSION = version->declare('0.11. 3');23 use version; our $VERSION = version->declare('0.11.4'); 24 24 25 25 use Getopt::Long qw(GetOptions); … … 31 31 use Socket; 32 32 use Text::Table; 33 use NetAddr::IP; 33 34 34 35 my $command = shift @ARGV || 'help'; … … 261 262 } 262 263 264 #------------------------------------------------------------------------------- 265 266 sub control_ip_in_range { 267 my ($computer_db, $sector, $ip) = @_; 268 269 return 1 if not exists $computer_db->{'dset'}{$sector}{'ip'}; # No IP range defined for this sector 270 271 my $ip_addr = NetAddr::IP->new($ip); 272 273 LOOP_ON_IP_RANGE: 274 for my $ip_range_current (@{$computer_db->{'dset'}{$sector}{'ip'}}) { 275 my $range = NetAddr::IP->new($ip_range_current); 276 return 1 if $range->contains($ip_addr); 277 } 278 279 return 0; 280 } 281 263 282 #------------------------------------------------------------------------------------- 264 283 #Nom: control_syntaxe_mac … … 487 506 control_syntax_ip($ip) or exit; 488 507 control_exist_ip($computer_db, $ip) or die "Error: IP address already exist in sector $sector: $ip.\n"; 508 control_ip_in_range($computer_db, $sector, $ip) or die "Error: IP $ip is not in sector $sector IP range.\n"; 489 509 control_syntax_comment($comment) or exit; 490 510 -
trunk/ddt/make-package-debian
r335 r350 43 43 Tag: implemented-in::perl, interface::commandline, role::program 44 44 Priority: optional 45 Depends: perl, perl-base, perl-modules, libyaml-syck-perl, libnet-netmask-perl, libreadonly-perl, libfile-touch-perl, libtext-table-perl 45 Depends: perl, perl-base, perl-modules, libyaml-syck-perl, libnet-netmask-perl, libreadonly-perl, libfile-touch-perl, libtext-table-perl, libnetaddr-ip-perl 46 46 Suggests: libyaml-shell-perl | yamllint, perl-doc, isc-dhcp-server, bind9 47 47 Architecture: all
Note: See TracChangeset
for help on using the changeset viewer.