فهرست منبع

add support gateway subnets to perl backend

Roman Dmitriev 2 سال پیش
والد
کامیت
75224c2288
2فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 1 1
      html/inc/common.php
  2. 8 0
      scripts/sync_mikrotik.pl

+ 1 - 1
html/inc/common.php

@@ -485,7 +485,7 @@ function get_subnet_description($db,$subnet_id)
 if (empty($subnet_id)) { return '';}
 $subnet = get_record_sql($db,'SELECT * FROM subnets WHERE id='.$subnet_id);
 if (empty($subnet)) { return ''; }
-$result = $subnet['subnet'].'('.['description'].')';
+$result = $subnet['subnet'].'&nbsp('.$subnet['comment'].')';
 return $result;
 }
 

+ 8 - 0
scripts/sync_mikrotik.pl

@@ -95,6 +95,14 @@ if ($l3->{'interface_type'} eq '0') { push(@lan_int,$l3->{'name'}); }
 if ($l3->{'interface_type'} eq '1') { push(@wan_int,$l3->{'name'}); }
 }
 
+my @gw_subnets = get_records_sql($dbh,"SELECT gateway_subnets.*,subnets.subnet FROM gateway_subnets LEFT JOIN subnets ON gateway_subnets.subnet_id = subnets.id WHERE gateway_subnets.device_id=".$gate->{'id'});
+
+if (@gw_subnets and scalar @gw_subnets) {
+    foreach my $gw_subnet (@gw_subnets) {
+        if ($gw_subnet) { $connected_users->add_string($gw_subnet); }
+    }
+}
+
 my @cmd_list=();
 
 $gate = netdev_set_auth($gate);