Пример #1
0
 function handleClientInform(dhcpServer $server, dhcpStorage $storage, dhcpPacket $packet, dhcpPacket $response)
 {
     $attributes = $storage->getAttributesForClient($packet->getMACAddress());
     $response->setData('op', dhcpPacket::int2hex(2));
     $response->setData('xid', $packet->getData('xid'));
     $response->setData('chaddr', $packet->getData('chaddr'));
     $response->setData('message_type', 'ack');
     $response->setData('subnet_mask', $attributes['subnet_mask']);
     $response->setData('router', $attributes['router']);
     $response->setData('server_id', array(10, 2, 3, 5));
     $response->setData('dns_server', $attributes['dns_server']);
     return true;
 }
Пример #2
0
 function handleClientInform(dhcpServer $server, dhcpStorage $storage, dhcpPacket $packet, dhcpPacket $response)
 {
     $macAddress = substr($packet->getData('chaddr'), 0, 12);
     // only look at the first 12 characters for the MAC address
     $bootServer = $this->datasource->TftpServerFromMacAddress($server, $macAddress);
     $server->verbosity && (print "Mac Address: {$macAddress}\n");
     if ($bootServer) {
         $attributes = $storage->getAttributesForClient($packet->getMACAddress());
         $response->setData('op', dhcpPacket::BOOTREPLY);
         $response->setData('hops', $packet->getData('hops'));
         $response->setData('xid', $packet->getData('xid'));
         $response->setData('htype', $packet->getData('htype'));
         $response->setData('ciaddr', $packet->getData('ciaddr'));
         $response->setData('chaddr', $packet->getData('chaddr'));
         $response->setData('message_type', 'ack');
         $response->setData('server_id', $server->getSocketHost());
         $response->setData('tftp_server', $bootServer);
         $server->verbosity && (print "Setting response option 66 to {$bootServer}\n");
         $server->verbosity > 1 && print_r($response);
     }
     return !$this->dryRun && $bootServer !== NULL;
 }