Changeset 923
- Timestamp:
- 06/18/19 18:15:33 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r920 r923 1622 1622 ##fixme: IP pools across VRFs, need to use the IP ID instead of the CIDR 1623 1623 # ... or the VRF itself? 1624 if ($args{cidr}) { # IP specified 1625 my ($isavail) = $dbh->selectrow_array( 1626 "SELECT available FROM poolips WHERE ip=?".($args{vrf} ? " AND vrf=?" : ''), 1627 undef, ($args{vrf} ? ($args{cidr},$args{vrf}) : $args{cidr}) ); 1624 if ($args{cidr}) { 1625 # IP specified 1626 my $availsql = "SELECT available FROM poolips WHERE "; 1627 my @availargs; 1628 if ($args{cidr} =~ /^\d+$/) { 1629 # IP passed as ID 1630 $availsql .= "id = ?"; 1631 push @availargs, $args{cidr}; 1632 } else { 1633 # IP passed as IP address 1634 $availsql .= "ip = ?"; 1635 push @availargs, $args{cidr}; 1636 } 1637 if ($args{parent}) { 1638 # Limit by parent ID 1639 $availsql .= " AND parent_id = ?"; 1640 push @availargs, $args{parent}; 1641 } elsif ($args{vfr}) { 1642 # Limit by VRF, but only if the parent ID isn't available 1643 $availsql .= " AND vrf = ?"; 1644 push @availargs, $args{vrf}; 1645 } else { 1646 # Fail if we don't have a handle for the pool 1647 die "Missing parent ID or VRF.\n"; 1648 } 1649 my ($isavail) = $dbh->selectrow_array($availsql, undef, @availargs); 1628 1650 die "IP is not in an IP pool.\n" 1629 1651 if !$isavail;
Note:
See TracChangeset
for help on using the changeset viewer.