Free Options

Glenn Satchell Glenn.Satchell at uniq.com.au
Fri Jan 11 11:20:28 UTC 2008


There is no need to hack C code to define your own options. See the
dhcp-options man page and look for the section titled "DEFINING NEW
OPTIONS".

     option new-name code new-code = definition ;

eg

     option myoption_name 224 = text;

and you set a value using something like

     option myoption_name "hello world";

There are many different types, which are listed in that section of the
man page.

Now how you use it is up to you. You'll need to add some code to the
dhclient end to process that value and then perform the desired action.
Other clients may just ignore your option of course.

regards,
-glenn
     

>Date: Thu, 10 Jan 2008 18:28:01 +0100 (CET)
>From: Ruben Rios <ruben_roller at yahoo.es>
>Subject: Re: Free Options
>To: dhcp-users at isc.org
>
>By the way, does anybody know what do I need to do to add my own option to the 
DHCP message. I am just trying to figure out how to do it by reading code and 
every time I think I am done learning I find something new that makes me feel 
like I know nothing yet.
>
>At first I have added this line in dhcp.h
>
>#define DHO_MY_OPTION 224
>
>How does the server or the client know what to do when finding that option? 
Does it has something to do with what is defined in tables.c? I mean the static 
struct option dhcp_options. Is that what makes both parties to know how to 
process the data? If I want to send an ASCII string, should I just add the line:
>
>{"myoption_name", "X", &dhcp_universe, 224, 1}
>
>I believe until now everyting is correct and necessary, isn't it?  But what 
else is necessary to do in order to load the data for this option and retrieve 
it at the other end of the communication?
>
>I hope someone can help me,
>Rubén Ríos
>
>       
>---------------------------------
>
>Web Revelación Yahoo! 2007:
> Premio Favorita del Público - ¡Vota tu preferida!


More information about the dhcp-users mailing list