|
@@ -395,6 +395,11 @@ Dhcpv4Srv::run() {
|
|
|
|
|
|
adjustRemoteAddr(query, rsp);
|
|
|
|
|
|
+ // Let's do class specific processing. This is done before
|
|
|
+ // pkt4_send.
|
|
|
+ //
|
|
|
+ /// @todo: decide whether we want to add a new hook point for
|
|
|
+ /// doing class specific processing.
|
|
|
if (!classSpecificProcessing(query, rsp)) {
|
|
|
/// @todo add more verbosity here
|
|
|
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_CLASS_PROCESSING_FAILED);
|
|
@@ -1805,15 +1810,29 @@ void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) {
|
|
|
}
|
|
|
|
|
|
// DOCSIS specific section
|
|
|
- if (vendor_class->getValue().find("docsis3.0") != std::string::npos) {
|
|
|
- pkt->addClass("docsis3.0");
|
|
|
- classes += "docsis3.0 ";
|
|
|
+
|
|
|
+ // Let's keep this as a series of checks. So far we're supporting only
|
|
|
+ // docsis3.0, but there are also docsis2.0, docsis1.1 and docsis1.0. We
|
|
|
+ // may come up with adding several classes, e.g. for docsis2.0 we would
|
|
|
+ // add classes docsis2.0, docsis1.1 and docsis1.0.
|
|
|
+
|
|
|
+ // Also we are using find, because we have at least one traffic capture
|
|
|
+ // where the user class was followed by a space ("docsis3.0 ").
|
|
|
+
|
|
|
+ // For now, the code is very simple, but it is expected to get much more
|
|
|
+ // complex soon. One specific case is that the vendor class is an option
|
|
|
+ // sent by the client, so we should not trust it. To confirm that the device
|
|
|
+ // is indeed a modem, John B. suggested to check whether chaddr field
|
|
|
+ // quals subscriber-id option that was inserted by the relay (CMTS).
|
|
|
+ // This kind of logic will appear here soon.
|
|
|
+ if (vendor_class->getValue().find(DOCSIS3_CLASS_MODEM) != std::string::npos) {
|
|
|
+ pkt->addClass(DOCSIS3_CLASS_MODEM);
|
|
|
+ classes += string(DOCSIS3_CLASS_MODEM) + " ";
|
|
|
} else
|
|
|
- if (vendor_class->getValue().find("eRouter1.0") != std::string::npos) {
|
|
|
- pkt->addClass("eRouter1.0");
|
|
|
- classes += "eRouter1.0 ";
|
|
|
- }else
|
|
|
- {
|
|
|
+ if (vendor_class->getValue().find(DOCSIS3_CLASS_EROUTER) != std::string::npos) {
|
|
|
+ pkt->addClass(DOCSIS3_CLASS_EROUTER);
|
|
|
+ classes += string(DOCSIS3_CLASS_EROUTER) + " ";
|
|
|
+ } else {
|
|
|
classes += vendor_class->getValue();
|
|
|
pkt->addClass(vendor_class->getValue());
|
|
|
}
|
|
@@ -1831,7 +1850,7 @@ bool Dhcpv4Srv::classSpecificProcessing(const Pkt4Ptr& query, const Pkt4Ptr& rsp
|
|
|
return (true);
|
|
|
}
|
|
|
|
|
|
- if (query->inClass("docsis3.0")) {
|
|
|
+ if (query->inClass(DOCSIS3_CLASS_MODEM)) {
|
|
|
|
|
|
// Set next-server. This is TFTP server address. Cable modems will
|
|
|
// download their configuration from that server.
|
|
@@ -1852,7 +1871,7 @@ bool Dhcpv4Srv::classSpecificProcessing(const Pkt4Ptr& query, const Pkt4Ptr& rsp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (query->inClass("eRouter1.0")) {
|
|
|
+ if (query->inClass(DOCSIS3_CLASS_EROUTER)) {
|
|
|
|
|
|
// Do not set TFTP server address for eRouter devices.
|
|
|
rsp->setSiaddr(IOAddress("0.0.0.0"));
|