[kea-dev] fixing the hostname issue

alexis alzrck at gmail.com
Sun Nov 16 00:11:57 UTC 2014


Guys, im working on this and i need your help. Please could you help me
pointing me where im wrong on this


on pkt4_receive in my hooks im setting a new hostname. So when dhcp4_srv
call this hook receives this

then on dhcp4_srv.cc in

Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {


there's a


 processClientName(discover, offer);


so

Dhcpv4Srv::processClientName(const Pkt4Ptr& query, Pkt4Ptr& answer) {

i've added

 try {
        LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_CLIENT_NAME_PROC_FAIL).arg("++++++++++++++++++++++");
        Option4ClientFqdnPtr fqdn =
boost::dynamic_pointer_cast<Option4ClientFqdn>
            (query->getOption(DHO_FQDN));
        if (fqdn) {
        LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_CLIENT_NAME_PROC_FAIL).arg("detecta opcion de fqdn");
            processClientFqdnOption(fqdn, answer);

        } else {
            OptionStringPtr hostname =
boost::dynamic_pointer_cast<OptionString>
                (query->getOption(DHO_HOST_NAME));
            if (hostname) {
        LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_CLIENT_NAME_PROC_FAIL).arg("detecta opcion de hostname");
                processHostnameOption(hostname, answer);
            }
        }
    }

nothing is logged at all (im able to see dhcp4 logger)

Following this as i set option 12, this should match

           if (hostname) {
        LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_CLIENT_NAME_PROC_FAIL).arg("detecta opcion de hostname");
                processHostnameOption(hostname, answer);
            }



Dhcpv4Srv::processHostnameOption(const OptionStringPtr& opt_hostname,
                                 Pkt4Ptr& answer) {



contains conditions based on label_count and calls

d2_mgr.qualifyName(hostname)

where

std::string
        D2ClientMgr::qualifyName(const std::string& partial_name) const {


contains this

// Tack on a trailing dot in case suffix doesn't have one.
            //    std::string str = gen_name.str();
            //    size_t len = str.length();
            //    if ((len > 0) && (str[len - 1] != '.')) {
            //        gen_name << ".";
            //    }

where i guess is the problem when the hostname is not a fqdn and gets the .
appended.


am i ok? after modify this im doing

make clean
make
make install

on dir src/


by now, i have no luck, cant even see this line

        LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_CLIENT_NAME_PROC_FAIL).arg("++++++++++++++++++++++");


thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-dev/attachments/20141115/87d439eb/attachment.html>


More information about the kea-dev mailing list