Changeset 892 for trunk


Ignore:
Timestamp:
Dec 31, 2020, 11:47:45 AM (4 years ago)
Author:
chronos
Message:
  • Added: Limit direct input/output internet traffic to gateway to cover also VPN connections traffic.
Location:
trunk/Modules/NetworkConfigRouterOS/Generators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/Common.php

    r874 r892  
    11<?php
    22
    3 function GetMarkByComment($Comment)
     3function GetMarkByComment(string $Comment): int
    44{
    55  global $Database;
     
    1717}
    1818
    19 function GetSubgroupByRange($AddressRange)
     19function GetSubgroupByRange(string $AddressRange): int
    2020{
    2121  global $Database;
     
    3333}
    3434
    35 function InsertToAddressTreeIPv4(&$Tree, $Address, $Name, $InterSubnets = false, $ForceMark = false)
     35function InsertToAddressTreeIPv4(array &$Tree, NetworkAddressIPv4 $Address, string $Name, bool $InterSubnets = false, bool $ForceMark = false)
    3636{
    3737  global $Config;
     
    7878}
    7979
    80 function InsertToAddressTreeIPv6(&$Tree, $Address, $Name, $InterSubnets = false, $ForceMark = false)
     80function InsertToAddressTreeIPv6(array &$Tree, NetworkAddressIPv6 $Address, string $Name, bool $InterSubnets = false, bool $ForceMark = false)
    8181{
    8282  global $Config;
     
    123123}
    124124
    125 function ShowSubnetNode($Node, $Indent = 0)
     125function ShowSubnetNode(array $Node, int $Indent = 0): void
    126126{
    127127  echo(str_repeat('  ', $Indent).$Node['Address']->AddressToString().'/'.$Node['Address']->Prefix.' '.$Node['Name']."\n");
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallMangle.php

    r887 r892  
    8282    // Process users
    8383    $DbResult = $this->System->Database->query('SELECT `Member`.*, `Subject`.`Name` FROM `Member` '.
    84         'LEFT JOIN `Subject` ON `Subject`.`Id` = `Member`.`Subject` '.
    85         'WHERE `Member`.`Blocked` = 0');
     84      'LEFT JOIN `Subject` ON `Subject`.`Id` = `Member`.`Subject` '.
     85      'WHERE `Member`.`Blocked` = 0');
    8686    while ($Member = $DbResult->fetch_assoc())
    8787    {
     
    133133    $this->ProcessNode($AddressTree);
    134134
     135    // Limit direct input/output traffic to gateway
     136    $PacketMark = GetMarkByComment('rt-gateway-3-out');
     137    $ItemsFirewall[] = array('chain' => 'output', 'out-interface' => $InetInterface, 'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'local-out',);
     138    $PacketMark = GetMarkByComment('rt-gateway-3-in');
     139    $ItemsFirewall[] = array('chain' => 'input', 'in-interface' => $InetInterface, 'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'local-in',);
     140
    135141    // Limited free internet
    136142    $PacketMark = GetMarkByComment('free-out');
Note: See TracChangeset for help on using the changeset viewer.