|
@@ -61,6 +61,8 @@ class BaseKea implements KeaConfigInterface
|
|
|
],
|
|
|
];
|
|
|
|
|
|
+ private $client_classes = [];
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @param array $data
|
|
@@ -87,6 +89,7 @@ class BaseKea implements KeaConfigInterface
|
|
|
'control-socket' => $this->controlSocketConfig(),
|
|
|
'lease-database' => $this->leaseDatabaseConfig($data),
|
|
|
'hosts-database' => $this->leaseDatabaseConfig($data),
|
|
|
+ 'client-classes' => $this->client_classes,
|
|
|
'subnet4' => $this->subnet4,
|
|
|
'hooks-libraries' => $this->hooks_libraries,
|
|
|
'interfaces-config' => $this->getInterfacesConfig(),
|
|
@@ -110,9 +113,9 @@ class BaseKea implements KeaConfigInterface
|
|
|
|
|
|
$hostType = $subnet->getAllowedHostType();
|
|
|
$client_class = '';
|
|
|
- /* if ($hostType) {
|
|
|
+ if ($hostType != 'Cablemodem') {
|
|
|
$client_class = $hostType->getShortname();
|
|
|
- } */
|
|
|
+ }
|
|
|
if ($subnet->getStatus() != HostStatus::STATE_NONE && $subnet->getStatus() != '') {
|
|
|
if ($client_class != '') {
|
|
|
$client_class .= '-';
|
|
@@ -141,6 +144,9 @@ class BaseKea implements KeaConfigInterface
|
|
|
|
|
|
if ($client_class != '') {
|
|
|
$subnetConf['client-class'] = $client_class;
|
|
|
+ $this->client_classes [] = [
|
|
|
+ 'name' => $client_class,
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
$netgroup = $subnet->getNetGroup();
|
|
@@ -166,7 +172,7 @@ class BaseKea implements KeaConfigInterface
|
|
|
private function hooksLibrariesConfig($data)
|
|
|
{
|
|
|
$this->hooks_libraries = [
|
|
|
- /* [
|
|
|
+ [
|
|
|
'library' => '/opt/hooks/mysql/kea-hook-flowdat3-mysql.so',
|
|
|
'parameters' => [
|
|
|
"host" => $data['db']['host'],
|
|
@@ -174,7 +180,7 @@ class BaseKea implements KeaConfigInterface
|
|
|
"user" => $data['db']['user'],
|
|
|
"password" => $data['db']['password'],
|
|
|
]
|
|
|
- ], */
|
|
|
+ ],
|
|
|
[
|
|
|
"library" => "/opt/hooks/amqp/kea-hook-flowdat3.so",
|
|
|
"parameters" => [
|
|
@@ -185,48 +191,48 @@ class BaseKea implements KeaConfigInterface
|
|
|
],
|
|
|
];
|
|
|
|
|
|
- $dhcp = $data['dhcp'];
|
|
|
- $hosts = $data['hosts'];
|
|
|
-
|
|
|
- $hook = [
|
|
|
- 'library' => $data['library'],
|
|
|
- ];
|
|
|
-
|
|
|
- $dhcpModelParams = $dhcp && $dhcp->getDhcpModel() ? $dhcp->getDhcpModel()->getData('parameters') : null;
|
|
|
-
|
|
|
- $option122 = isset($dhcpModelParams['option122']) ? $dhcpModelParams['option122'] : null;
|
|
|
- $ip = isset($dhcpModelParams['ip']) ? $dhcpModelParams['ip'] : null;
|
|
|
- if ($option122 && $ip) {
|
|
|
- $macs = [];
|
|
|
- foreach ($hosts as $host) {
|
|
|
- if ($host->getMac()) {
|
|
|
- $macs[] = $host->getMac();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $hook['parameters']['option122'] = [
|
|
|
- $ip => $macs
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- $remote_id_map = isset($dhcpModelParams['remote-id-map']) ? $dhcpModelParams['remote-id-map'] : null;
|
|
|
- if ($remote_id_map) {
|
|
|
- $hostConfig = [];
|
|
|
- foreach ($hosts as $host) {
|
|
|
- if ($host->getMac()) {
|
|
|
- $mac = $host->getMac();
|
|
|
- $state = $host->getState();
|
|
|
- $shortname = $host->getHostType()->getShortname();
|
|
|
-
|
|
|
- $client_class = $state != HostStatus::STATE_NONE ? $state : $shortname;
|
|
|
-
|
|
|
- $hostConfig[$client_class][] = $mac;
|
|
|
- }
|
|
|
- }
|
|
|
- $hook['parameters']['remote-id-map'] = $hostConfig;
|
|
|
- }
|
|
|
-
|
|
|
- $this->hooks_libraries[] = $hook;
|
|
|
+ // $dhcp = $data['dhcp'];
|
|
|
+ // $hosts = $data['hosts'];
|
|
|
+ //
|
|
|
+ // $hook = [
|
|
|
+ // 'library' => $data['library'],
|
|
|
+ // ];
|
|
|
+ //
|
|
|
+ // $dhcpModelParams = $dhcp && $dhcp->getDhcpModel() ? $dhcp->getDhcpModel()->getData('parameters') : null;
|
|
|
+ //
|
|
|
+ // $option122 = isset($dhcpModelParams['option122']) ? $dhcpModelParams['option122'] : null;
|
|
|
+ // $ip = isset($dhcpModelParams['ip']) ? $dhcpModelParams['ip'] : null;
|
|
|
+ // if ($option122 && $ip) {
|
|
|
+ // $macs = [];
|
|
|
+ // foreach ($hosts as $host) {
|
|
|
+ // if ($host->getMac()) {
|
|
|
+ // $macs[] = $host->getMac();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // $hook['parameters']['option122'] = [
|
|
|
+ // $ip => $macs
|
|
|
+ // ];
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // $remote_id_map = isset($dhcpModelParams['remote-id-map']) ? $dhcpModelParams['remote-id-map'] : null;
|
|
|
+ // if ($remote_id_map) {
|
|
|
+ // $hostConfig = [];
|
|
|
+ // foreach ($hosts as $host) {
|
|
|
+ // if ($host->getMac()) {
|
|
|
+ // $mac = $host->getMac();
|
|
|
+ // $state = $host->getState();
|
|
|
+ // $shortname = $host->getHostType()->getShortname();
|
|
|
+ //
|
|
|
+ // $client_class = $state != HostStatus::STATE_NONE ? $state : $shortname;
|
|
|
+ //
|
|
|
+ // $hostConfig[$client_class][] = $mac;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // $hook['parameters']['remote-id-map'] = $hostConfig;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // $this->hooks_libraries[] = $hook;
|
|
|
}
|
|
|
|
|
|
/**
|