Group,

I've ran across an issue with DHCP snooping on some of my switches with only 
KEA server.  The switches cannot track the DHCP responses from the server and I 
found the issue is that all of the other DHCP servers we have list DHCP options 
in numerical order.  Other such servers always start their options with (53) 
Message Type (54) DHCP Server Identifier (51) Lease time, then numerically 
sorted.  I edited the file libdhcp++.cc with the following method which changed 
the order and fixed my issue; I cannot find any RFC reference that this order 
is mandatory but for some reason ISC DHCP server also follows this other order:

void
LibDHCP::packOptions4(isc::util::OutputBuffer& buf,
                     const OptionCollection& options) {
    OptionPtr agent;
    OptionPtr end;

                //BEGINNING BLOCK I ADDED
                //DHO_DHCP_MESSAGE_TYPE = 53
                //DHO_DHCP_SERVER_IDENTIFIER  =54
                //DHO_DHCP_LEASE_TIME =51
                OptionPtr type;
                OptionPtr id;
                OptionPtr leaset;
    for (OptionCollection::const_iterator it = options.begin();
         it != options.end(); ++it) {

        // type, id, leaset options must be last.
        switch (it->first) {
                                                case DHO_DHCP_MESSAGE_TYPE:
                                                                type = 
it->second;
                                                                break;
                                                case DHO_DHCP_SERVER_IDENTIFIER:
                                                                id = it->second;
                                                                break;
                                                case DHO_DHCP_LEASE_TIME:
                                                                leaset = 
it->second;
                                                                break;
        }
    }

                if (type){
                                type->pack(buf);
                }
                if (id){
                                id->pack(buf);
                }
                if (leaset){
                                leaset->pack(buf);
                }
                //ENDING BLOCK I ADDED
    for (OptionCollection::const_iterator it = options.begin();
         it != options.end(); ++it) {

        // RAI and END options must be last.
        switch (it->first) {
            case DHO_DHCP_AGENT_OPTIONS:
                agent = it->second;
                break;
            case DHO_END:
                end = it->second;
                break;
                                                case DHO_DHCP_MESSAGE_TYPE:  
//ALSO ADDED
                                                                break;
                                                case 
DHO_DHCP_SERVER_IDENTIFIER:  //ALSO ADDED
                                                                break;
                                                case DHO_DHCP_LEASE_TIME:  
//ALSO ADDED
                                                                break;
            default:
                it->second->pack(buf);
                break;
        }
    }

    // Add the RAI option if it exists.
    if (agent) {
       agent->pack(buf);
    }

    // And at the end the END option.
    if (end)  {
       end->pack(buf);
    }
}

///END OF CODE

Any comments?


_______________________________________________
Kea-users mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-users

Reply via email to