PKTC_CLIENT_CONFIGURATION (122) and (177)

wouter.debie wouter.debie at excentis.com
Tue Nov 20 10:03:59 UTC 2007


Hi

I'm currently adding some features to the dhcp_server by adding a 
database behind it and saving a lot of information about the 
dhcp_process (provisioning).

I need to seek in the dhcp_offer message the dhcpOption 122. I've added 
the following things to perform this job:

******* CODE ************

/include/dhcp.h

#define DHO_SUBNET_SELECTION                    118 /* RFC3011! */
#define DHO_DOMAIN_SEARCH                       119 /* RFC3397 */

#define DHO_CABLELABS_CLIENT_CONFIGURATION      122 /* RFC3495 */

#define DHO_VIVCO_SUBOPTIONS                    124
#define DHO_VIVSO_SUBOPTIONS                    125


******** END CODE *************

Now if I try to perform the following function i don't get the value of 
this option in the dhcp_offer message.  I'm sure it's been send (sniffing)


********* CODE ***************

/server/dhcp.c  --> methode void dhcp_reply (lease)

    unsigned char *lease_pktcOptions = NULL;
    int lease_pktcOptionNr = 0;
    struct data_string data;
    struct option_cache *oc;


/* LOADING CABLELABS CLIENT CONFIGURATION */
    oc = (struct option_cache *)0;

    oc = lookup_option (&dhcp_universe, state -> options,
                        DHO_CABLELABS_CLIENT_CONFIGURATION);
    snprintf(msgbuf, sizeof msgbuf, "try search OPTION !!!");
    log_debug ("seek option");
    if(oc){
      log_debug ("oc is not empty");
    }
    if (oc &&
        evaluate_option_cache (&data, state -> packet, lease,
                               (struct client_state *)0,
                               state->packet->options, state->options,
                               &lease->scope, oc, MDL)){
      lease_pktcOptions = dmalloc(data.len+1,MDL);
      log_debug ("Found OPTION");
      snprintf(msgbuf, sizeof msgbuf, "Found OPTION !!!");
      if (!lease_pktcOptions)
        log_fatal ("no memory for lease_pktcOptions");
      memcpy (lease_pktcOptions, data.data, data.len);
      if(data.len > 0){
        lease_pktcOptionNr = 122;
      }
      data_string_forget (&data,MDL);
    }

*********** END CODE **************

Is this correct? Or did I forgot something ???


Thx

Wouter Debie





More information about the dhcp-users mailing list