From: Tomek Mrugalski Date: Tue, 31 Dec 2013 14:10:43 +0000 (+0100) Subject: [3203] Minor tweaks in v4 client classification X-Git-Tag: bind10-1.2.0beta1-release~130^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=daa4b00d29427a0ba98f88bf7eb6cdecd39ada2e;p=thirdparty%2Fkea.git [3203] Minor tweaks in v4 client classification --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index c2f6c80f76..4da9f82c3a 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1808,16 +1808,16 @@ void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) { if (vendor_class->getValue().find("docsis3.0") != std::string::npos) { pkt->addClass("docsis3.0"); classes += "docsis3.0 "; - } - + } else if (vendor_class->getValue().find("eRouter1.0") != std::string::npos) { pkt->addClass("eRouter1.0"); classes += "eRouter1.0 "; + }else + { + classes += vendor_class->getValue(); + pkt->addClass(vendor_class->getValue()); } - classes += vendor_class->getValue(); - pkt->addClass(vendor_class->getValue()); - if (!classes.empty()) { LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_CLASS_ASSIGNED) .arg(classes); @@ -1833,10 +1833,12 @@ bool Dhcpv4Srv::classSpecificProcessing(const Pkt4Ptr& query, const Pkt4Ptr& rsp if (query->inClass("docsis3.0")) { - // set next-server - // @todo uncomment this once 3191 is merged - // rsp->setSiaddr(subnet->getSiaddr()); + // Set next-server. This is TFTP server address. Cable modems will + // download their configuration from that server. + rsp->setSiaddr(subnet->getSiaddr()); + // Now try to set up file field in DHCPv4 packet. We will just copy + // content of the boot-file option, which contains the same information. Subnet::OptionDescriptor desc = subnet->getOptionDescriptor("dhcp4", DHO_BOOT_FILE_NAME); @@ -1852,7 +1854,8 @@ bool Dhcpv4Srv::classSpecificProcessing(const Pkt4Ptr& query, const Pkt4Ptr& rsp if (query->inClass("eRouter1.0")) { - + // Do not set TFTP server address for eRouter devices. + rsp->setSiaddr(IOAddress("0.0.0.0")); } return (true); diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index 53abc53e0c..391045bc66 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -517,7 +517,13 @@ protected: const std::string& option_space, isc::dhcp::OptionCollection& options); - /// @brief Assigns incoming packet to a given class + /// @brief Assigns incoming packet to zero or more classes. + /// + /// @note For now, the client classification is very simple. It just uses + /// content of the vendor-class-identifier option as a class. The resulting + /// class will be stored in packet (see @ref isc::dhcp::Pkt4::classes_ and + /// @ref isc::dhcp::Pkt4::inClass). + /// /// @param pkt packet to be classified void classifyPacket(const Pkt4Ptr& pkt);