Explorar el Código

added: support dhcp-group (for dhcp option set as mikrotik) to dnsmasq

root hace 1 año
padre
commit
44b0e21bcd
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      scripts/print-dnsmasq.pl

+ 5 - 1
scripts/print-dnsmasq.pl

@@ -67,7 +67,7 @@ print "dhcp-option=net:net-$subnet_name,option:router,$dhcp_conf{$subnet_name}->
 }
 
 #get userid list
-my $sSQL="SELECT id,ip,ip_int,mac,comments,dns_name FROM User_auth where dhcp=1 and deleted=0 and ou_id !=".$default_user_ou_id." and ou_id !=".$default_hotspot_ou_id." ORDER by ip_int";
+my $sSQL="SELECT id,ip,ip_int,mac,comments,dns_name,dhcp_option_set,dhcp_acl FROM User_auth where dhcp=1 and deleted=0 and ou_id !=".$default_user_ou_id." and ou_id !=".$default_hotspot_ou_id." ORDER by ip_int";
 my @users = get_records_sql($dbh,$sSQL);
 foreach my $row (@users) {
 next if (!$row);
@@ -78,6 +78,10 @@ if (exists $static_hole{$row->{ip}}) { $static_hole{$row->{ip}}{skip}=1; }
 print '#Comment:'.$row->{comments}."\n" if ($row->{comments});
 print '#DNS:'.$row->{dns_name}."\n" if ($row->{dns_name});
 print 'dhcp-host='.$row->{mac}.', '.$row->{ip}."\n";
+if ($row->{dhcp_option_set}) {
+    print '#DHCP group:'.$row->{dhcp_option_set}."\n";
+    print 'dhcp-host=set:'.$row->{dhcp_option_set}.','.$row->{ip}."\n";
+    }
 }
 
 foreach my $ip (keys %static_hole) {