Changeset 213
- Timestamp:
- May 10, 2009, 12:30:09 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config.sample.php
r212 r213 47 47 'Password' => '', 48 48 'InetInterface' => 'ether0', 49 'ConnectTimeout' => 5, 49 50 ), 50 51 ); -
trunk/system/generators/dhcp_routerboard.php
r208 r213 7 7 while($Subnet = $DbResult->fetch_assoc()) 8 8 { 9 //print_r($Subnet);9 echo($Subnet['DHCP']); 10 10 $I = explode('.', $Subnet['AddressRange']); 11 11 $I = $I[2]; … … 18 18 } 19 19 $Commands = implode(';', $Commands); 20 $Command = '/usr/bin/ssh - l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Subnet['DHCP'].' "'.$Commands.'"';20 $Command = '/usr/bin/ssh -o ConnectTimeout=5 -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Subnet['DHCP'].' "'.$Commands.'"'; 21 21 //echo($Command."\n"); 22 22 $Output = ''; -
trunk/system/generators/dns.php
r211 r213 34 34 "\t\t\tMX\t10 ".$MailServer.".".$BaseDomain.".\n"); 35 35 36 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = Networ dInterface.Device WHERE NetworkInterface.LocalIP <> ""');36 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.LocalIP <> ""'); 37 37 while($Interface = $DbResult->fetch_assoc()) 38 38 { … … 45 45 46 46 // External records in internal server 47 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = Networ dInterface.Device WHERE NetworkInterface.ExternalIP <> ""');47 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP <> ""'); 48 48 while($Interface = $DbResult->fetch_assoc()) 49 49 { … … 117 117 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 118 118 $Name = strtolower($Name.'-ext'); 119 $IP = explode('.',$Inter afce['ExternalIP']);120 fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name ])."-ext.".$BaseDomain.".\n");119 $IP = explode('.',$Interface['ExternalIP']); 120 fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name)."-ext.".$BaseDomain.".\n"); 121 121 } 122 122 fclose($File); … … 191 191 "\t\t\tNS\t".$NameServers[1].".".$BaseDomain.".\n"); 192 192 193 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = Networ dInterface.Device WHERE NetworkInterface.ExternalIP LIKE "'.$Network.'.%"');193 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP LIKE "'.$Network.'.%"'); 194 194 while($Interface = $DbResult->fetch_assoc()) 195 195 { … … 197 197 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 198 198 $Name = strtolower($Name); 199 if(strlen($Name) < 8) $Name .= "\t";199 //if(strlen($Name) < 8) $Name .= "\t"; 200 200 $IP = explode('.', $Interface['ExternalIP']); 201 fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($ Interface['Name']).".".$BaseDomain.".\n");201 fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name).".".$BaseDomain.".\n"); 202 202 } 203 203 … … 254 254 fputs($File, $Name."\tIN\tA\t".$Interface['CZFreeIP']."\n"); 255 255 fputs($File2, $Name."\tIN\tA\t".$Interface['LocalIP']."\n"); 256 $Name = $Interface['DeviceName']; 257 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 258 $Name = strtolower($Name); 256 259 $Name .= '-czfree'; 257 260 fputs($File2, $Name."\tIN\tA\t".$Interface['CZFreeIP']."\n"); 258 261 } 259 262 260 $DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias` JOIN `hosts` ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""'); 263 $DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`'); 264 // JOIN `hosts` ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""'); 261 265 while($Alias = $DbResult->fetch_assoc()) 262 266 { … … 303 307 fputs($File2, $Header); 304 308 305 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = Networ dInterface.Device WHERE NetworkInterface.CZFreeIP LIKE "'.$Network.'.%"');309 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.CZFreeIP LIKE "'.$Network.'.%"'); 306 310 while($Interface = $DbResult->fetch_assoc()) 307 311 { … … 309 313 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 310 314 $Name = strtolower($Name); 315 $Name2 = $Name; 311 316 if(strlen($Name) < 8) $Name .= "\t"; 312 317 $IP = explode('.', $Interface['CZFreeIP']); 313 fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($ Interface['Name']).".".$Domain.".\n");314 fputs($File2, $IP[3]."\tIN\tPTR\t".strtolower($ Interface['Name'].'-czfree').".".$Domain.".\n");318 fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name2).".".$Domain.".\n"); 319 fputs($File2, $IP[3]."\tIN\tPTR\t".strtolower($Name2.'-czfree').".".$Domain.".\n"); 315 320 } 316 321 -
trunk/system/generators/generate.php
r197 r213 18 18 if($Command != '') 19 19 { 20 //exec($Command, $Output);21 echo($Command."\n");22 sleep(5);20 exec($Command, $Output); 21 //echo($Command."\n"); 22 //sleep(5); 23 23 } 24 24 //echo("Done\n"); -
trunk/system/generators/nat_routerboard.php
r208 r213 17 17 while($Interface = $DbResult2->fetch_assoc()) 18 18 { 19 $Name = $Interface['DeviceName'].'-'.$Interface['Name']; 19 $Name = $Interface['DeviceName']; 20 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 20 21 $Name = RouterOSIdent($Name); 21 22 echo($Name.'('.$Interface['LocalIP'].'), '); … … 47 48 48 49 $Commands = addslashes(implode(';', $Commands)); 49 $Command = '/usr/bin/ssh - l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Config['MainRouter']['HostName'].' "'.$Commands.'"';50 $Command = '/usr/bin/ssh -o ConnectTimeout=5 -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Config['MainRouter']['HostName'].' "'.$Commands.'"'; 50 51 $Output = array(); 51 52 //echo($Command."\n"); -
trunk/system/generators/netwatch.php
r208 r213 7 7 while($Router = $DbResult3->fetch_assoc()) 8 8 { 9 echo($Router['DHCP']."\n"); 9 10 $Commands = array(); 10 11 $Commands[] = '/tool netwatch remove [find]'; … … 18 19 while($Interface = $DbResult2->fetch_assoc()) 19 20 { 20 $Commands[] = '/tool netwatch add host='.$Interface['LocalIP'].' interval=1m comment='.$Interface['DeviceName'].'-'.$Interface['Name']; 21 $Name = $Interface['DeviceName']; 22 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 23 $Commands[] = '/tool netwatch add host='.$Interface['LocalIP'].' interval=1m comment='.$Name; 21 24 } 22 25 } 23 26 $Commands = implode(';', $Commands); 24 $Command = '/usr/bin/ssh - l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Router['DHCP'].' "'.$Commands.'"';27 $Command = '/usr/bin/ssh -o ConnectTimeout='.$Config['MainRouter']['ConnectTimeout'].' -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Router['DHCP'].' "'.$Commands.'"'; 25 28 //echo($Command."\n"); 26 29 $Output = ''; -
trunk/system/generators/traffic_shaping_routerboard.php
r208 r213 75 75 $Commands[] = ' /queue tree add name='.$Member['Name'].'-in limit-at='.$SpeedOut.' max-limit='.$UserMaxSpeedOut.' parent=main-in queue=wireless-default'; 76 76 77 $DbResult2 = $Database->select(' hosts', 'COUNT(*)', '(block = 0) AND (MAC != "") AND (user='.$Member['Id'].')');78 $Row = $DbResult2->fetch_ array();77 $DbResult2 = $Database->select('NetworkDevice', 'COUNT(*)', 'Member='.$Member['Id']); 78 $Row = $DbResult2->fetch_row(); 79 79 $HostCount = $Row[0]; 80 80 if($HostCount > 0) … … 91 91 while($Device = $DbResult2->fetch_assoc()) 92 92 { 93 $DbResult3 = $Database->select('NetworkInterface', '*', 'Device = '.$Device['Id'] );93 $DbResult3 = $Database->select('NetworkInterface', '*', 'Device = '.$Device['Id'].' AND LocalIP != ""'); 94 94 while($Interface = $DbResult3->fetch_assoc()) 95 95 { 96 $Name = $Device['Name'].'-'.$Interface['Name']; 96 $Name = $Device['Name']; 97 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 97 98 $Name = RouterOSIdent($Name); 98 99 echo($Name.', '); … … 123 124 124 125 $DbResult2 = $Database->select('NetworkSubnet', '*', 'Member='.$Member['Id']); 125 while($Subnet = $DbResult2->fetch_a rray())126 while($Subnet = $DbResult2->fetch_assoc()) 126 127 { 127 128 $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']); … … 139 140 if($Index > 50) 140 141 { 142 //print_r($Commands); 141 143 $Commands = addslashes(implode(';', $Commands)); 142 144 $Command = '/usr/bin/ssh -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Config['MainRouter']['HostName'].' "'.$Commands.'"'; … … 150 152 $Index++; 151 153 } 152 153 154 echo("\n"); 154 155 } -
trunk/system/netwatch_import.php
r208 r213 8 8 while($Router = $DbResult3->fetch_assoc()) 9 9 { 10 echo($Router['DHCP']."\n"); 10 11 $Commands = array(); 11 12 $Commands[] = '/tool netwatch print terse'; 12 13 $Commands = implode(';', $Commands); 13 $Command = '/usr/bin/ssh - l '.$Config['MainRouter']['UserName'].' -i generators/id_dsa '.$Router['DHCP'].' "'.$Commands.'"';14 $Command = '/usr/bin/ssh -o ConnectTimeout=5 -l '.$Config['MainRouter']['UserName'].' -i generators/id_dsa '.$Router['DHCP'].' "'.$Commands.'"'; 14 15 //echo($Command."\n"); 15 16 $Output = '';
Note:
See TracChangeset
for help on using the changeset viewer.