Changeset 249 for trunk/system


Ignore:
Timestamp:
Sep 28, 2009, 1:35:25 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Podpora CIDR pro generování statických položek DHCP serverů. Označení serverů je nyní ve tvaru dhcp a číslo id podsítě z databáze.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/dhcp_routerboard.php

    r248 r249  
    1616  echo($Subnet['DHCP']);
    1717  $Routerboard->HostName = $Subnet['DHCP'];
    18   $I = explode('.', $Subnet['AddressRange']);
    19   $I = $I[2];
    2018  $Items = array();
    21   $DbResult2 = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM `NetworkInterface` LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE (`LocalIP` LIKE "192.168.'.$I.'.%") AND (`MAC` != "00:00:00:00:00:00") ORDER BY `LocalIP`');
     19  $Server = 'dhcp'.$Subnet['Id'];
     20  $DbResult2 = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM `NetworkInterface` LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE '.
     21  ' CompareNetworkPrefix(INET_ATON(LocalIP), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].') AND (`MAC` != "00:00:00:00:00:00") ORDER BY `LocalIP`');
     22  echo($Database->error);
    2223  while($Interface = $DbResult2->fetch_assoc())
    2324  {
    2425    $Name = $Interface['DeviceName'];
    2526    if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    26     $Items[] = array('mac-address' => $Interface['MAC'], 'address' => $Interface['LocalIP'], 'server' => 'dhcp'.$I, 'comment' => $Name);
     27    $Items[] = array('mac-address' => $Interface['MAC'], 'address' => $Interface['LocalIP'], 'server' => $Server, 'comment' => $Name);
    2728  }
    2829 
    29   print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment'), $Items, array('server' => 'dhcp'.$I)));   
     30  print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment'), $Items, array('server' => $Server)));   
    3031  echo("\n");
    3132}
Note: See TracChangeset for help on using the changeset viewer.