[patch] cope with buggy dhcp servers
Denys Vlasenko
vda.linux at googlemail.com
Sat Nov 24 23:44:43 UTC 2007
On Saturday 24 November 2007 01:47, Cristian Ionescu-Idbohrn wrote:
> On Sat, 24 Nov 2007, Cristian Ionescu-Idbohrn wrote:
> > On Fri, 23 Nov 2007, Cristian Ionescu-Idbohrn wrote:
> > > Still... This tweak is needed _only_ if the dhcp-server is brain
> > > dead, problem which most clients don't suffer of.
> >
> > This is what I could come out with. Please comment.
>
> The difference to previous patch is just better wording of Config.in
> option.
+#define UDHCP_UDP_PACKET_SIZE_MIN ((sizeof(struct udp_dhcp_packet)) - \
+ (CONFIG_UDHCP_OPTIONS_SLACK_FOR_BUGGY_SERVERS))
+
/* Let's see whether compiler understood us right */
struct BUG_bad_sizeof_struct_udp_dhcp_packet {
char BUG_bad_sizeof_struct_udp_dhcp_packet
- [sizeof(struct udp_dhcp_packet) != 576 ? -1 : 1];
+ [sizeof(struct udp_dhcp_packet) !=
+ ((UDHCP_UDP_PACKET_SIZE_MIN) +
+ (CONFIG_UDHCP_OPTIONS_SLACK_FOR_BUGGY_SERVERS)) ? -1 : 1];
This check as written above can never fail.
The sheck should have literal 576 - we are checking than neither we nor
compiler goof up.
Maximum allowed slack size seems to be wrong, should be 1500 - 576 = 924.
See attached patch.
I changed the default from 0 to 300, it doesn't seem to have any effect on
code size:
$ make bloatcheck
function old new delta
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes
text data bss dec hex filename
776551 929 9100 786580 c0094 busybox_old
776551 929 9100 786580 c0094 busybox_unstripped
Please test whether patch works for you.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 3076 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20071124/7e8b9f0d/attachment-0002.bin
More information about the busybox
mailing list