tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: DHCP client with minimal functionality and size



On Thursday 10 April 2008 14:56:49 David Brownlee wrote:
> > So if 57k is "quite a bit", what is "optimal"?
>
>       I think 57K is a good size for a full feature DHCP client.
>       Certainly compared to the 350K of dhclient.
>
>       Yes, it would be nice to have a tiny, minimal featured dhcp client
>       for specific uses, but that is much less important if your main
>       client is 57K as opposed to 350K.

I've been working on dhcpcd more than I'd like since someone said 57k stripped 
was quite a bit. I've re-structured the code so that OS specific stuff is now 
in small files outside the main code. I've also moved to get the 
configuration suff from the DHCP message directly instead of populating a 
custom structure. Lastly, some parts of the code have been optimized to make 
it smaller.

The end result on NetBSD-4/i386 is ..... 47k un-stripped, 41k stripped :)
I could also save ~600 bytes by merging all the .c files into one and 
compiling that. However, I do have one feature to add which may take up a k 
or two.

It's currently under-going a bit of regression testing to make sure that 
nothing is broken after this, but it's looking very good right now. Hopefully 
I'll release it next week.

>       Is there anything dhclient does that dhcpcd does not? How about
>       people migrating who have /etc/dhclient-enter-hooks and/or
>       /etc/dhclient-exit-hooks?

That's the main bug bear really. dhcpcd does ALL it's configuration itself 
without the need for scripts. dhcpcd can call a script when a dhcp lease is 
gained or lost, but it's only supplied with information about the lease it 
just gained. This script cannot stop or change the way dhcpcd goes about 
configuring the system based on the lease.

However, you can stop dhcpcd from say installing default routes, 
touching /etc/resolv.conf or doing any ntp changes through command line 
options.

Also, the curret dhcpcd is hardcoded to a small list of parameters to request 
and make available to the script. One of the goals with the new framework is 
to allow the user to request parameters to be made available to the script 
which previous dhcpcd didn't care about. This is the missing feature I 
mentioned earlier, and it's the one thing that dhclient can to that dhcpcd 
currently cannot.

Thanks

Roy


Home | Main Index | Thread Index | Old Index