[PATCH] Added support for timezones on dhcp6-client (RFC 4833)

tiggersWelt.net (Support) support at tiggerswelt.net
Tue Jun 20 19:06:14 UTC 2017


Am 20.06.2017 um 20:32 schrieb Bernhard Reutner-Fischer:
[...]
>> @@ -261,17 +263,21 @@ static void option_to_env(uint8_t *option, uint8_t *option_end)
>>                         *new_env() = dlist;
>>                         break;
>>                 case D6_OPT_CLIENT_FQDN:
>> -                       // Work around broken ISC DHCPD6
>> +                       /* Work around broken ISC DHCPD6
>> +                        * ISC DHCPD6 does not implement RFC 4704 correctly: It says the first
>> +                        * byte of option-payload should contain flags where the bits 4-8 are
>> +                        * reserved for future use and MUST be zero. Instead ISC DHCPD6 just
>> +                        * writes the entire FQDN as string to option-payload. We assume a
>> +                        * broken server here if any of the reserved bits is set.
> 
> you mean as literal string or as (DNS-)encoded domain name?

Literal String. If otherwise I would have used udhcp's functions for this.

Haven't used ISC DHCPD6 for a while. If you wish to see some samples, I could
generate new ones.

>> +                        */
>>                         if (option[4] & 0xf8) {
>>                                 olen = ((option[2] << 8) | option[3]);
>> -                               dlist = xmalloc(olen);
>> +                               dlist = xmalloc(olen + 5);
> 
> Wouldn't you want to cap olen a bit?
> 
>>  //fixme:
>> -//- explain
>>  //- add len error check
> 
> exactly

Last time I touched the code, I was not sure what's required here. Thinking
about it twice it would make sense the make sure that option + olen + 4 does not
exceed option_end. Am I right or am I missing something?

>> -//- merge two allocs into one
>> -                               memcpy(dlist, option + 4, olen);
>> -                               *new_env() = xasprintf("fqdn=%s", dlist);
>> -                               free(dlist);
>> +                               memcpy(dlist,"fqdn=",5);
>> +                               memcpy(dlist + 5, option + 4, olen);
>> +                               *new_env() = dlist;
>>                                 break;
>>                         }
>>                         dlist = dname_dec(option + 5, ((option[2] << 8) | option[3]) - 1, "fqdn=");
> 
> Why is the above argument to dname_dec not using olen from above?

Kind of evolution... The hack for ISC DHCP6 was added later than this
RFC-conformant function.

For an RFC-conformant DHCP6-Server only this single line is required. On the
ISC-Hack olen is required in different places.

If I understood the "cap"-argument right, I would move the olen-calculation to a
more general place and check it accordingly. I'll also rename it to something
more catchy.

-- 
    \\\||///
  \\  - -  //
   (  @ @  )
-oOo--( )--oOo-------------------------------------------------------
 tiggersWelt.net                                 www.tiggersWelt.net
 Inhaber Bernd Holzmüller                       info at tiggerswelt.net
                                            Büro: 07 11 / 550 425-90
 Marktstraße 57                              Fax: 07 11 / 550 425-99
 70372 Stuttgart

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3310 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20170620/111ca3d3/attachment.p7s>


More information about the busybox mailing list