Parsing options
Erik Alapää
alapaa at operax.com
Thu Jun 16 20:09:48 UTC 2005
On Thu, 16 Jun 2005, Ted Lemon wrote:
> On Jun 16, 2005, at 6:18 AM, Erik Alapää wrote:
> > What I need is a routine that
> > simply takes a raw dhcp_packet or a dhcp packet struct as defined in
> > includes/dhcpd.h and gets me lease time, circuit and remote id. Looks
> > like I will have to build one from scratch :(
> >
> Version 3.0 of the relay agent already has code in it to abstract out
> the relay agent information option. You could trivially hack it to
> also abstract out the lease information. Check out
> strip_relay_agent_options - just add more entries to the switch
> statement. Bear in mind that the contents of the options are in
> network byte order and not aligned, and you need to sanity check them
> to avoid buffer overflows.
>
> The reason the option parsing code is so complicated is because it
> works both for generating options from configuration files on the
> server side and for dumping them into shell scripts on the client
> side - nothing so complicated is needed for the relay agent. For
> completeness you might want to add support for the overload option,
> but you'll probably never need it.
>
Great, thanks for the info! I will modify the code to get the options
I need, or maybe have a look at the other code snippet that was
posted.
Regards,
--
Erik Alapää
Software Engineer M. Sc., Lic. Ind. Math.
Aurorum Science Park 8
SE 997 75 Luleå
Sweden
+46 70 535 17 14 (mobile)
+46 920 75510 (fax)
http://www.operax.com
More information about the dhcp-hackers
mailing list