udhcp6: fix problems found running against dnsmasq
Patch is based on work by tiggerswelt.net. They say: " But when we tried to use dnsmasq on server-side, udhcpc6 was unable to forward the acquired address to its setup-script although the IPv6-Address had been assigned by the server as we could see via tcpdump. We traced this issue down to a problem on how udhcpc6 parses DHCPv6-Options: When moving to next option, a pointer-address is increased and a length buffer is decreased by the length of the option. The problem is that it is done in this order: option += 4 + option[3]; len_m4 -= 4 + option[3]; But this has to be switched as the length is decreased by the length of the *next* option, not the current one. This affected both - internal checks if a required option is present and the function to expose options to the environment of the setup-script. There was also a bug parsing D6_OPT_STATUS_CODE Options, that made dnsmasq not work as udhcpc6 thought it is receiving a non-positive status-code (because it did not parse the status-code as required in RFC 3315). In addition we introduced basic support for RFC 3646 (OPTION_DNS_SERVERS and OPTION_DOMAIN_LIST) and RFC 4704 (OPTION_CLIENT_FQDN). " Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@ -81,9 +81,14 @@ struct d6_option {
|
||||
#define D6_OPT_RECONF_MSG 19
|
||||
#define D6_OPT_RECONF_ACCEPT 20
|
||||
|
||||
#define D6_OPT_DNS_SERVERS 23
|
||||
#define D6_OPT_DOMAIN_LIST 24
|
||||
|
||||
#define D6_OPT_IA_PD 25
|
||||
#define D6_OPT_IAPREFIX 26
|
||||
|
||||
#define D6_OPT_CLIENT_FQDN 39
|
||||
|
||||
/*** Other shared functions ***/
|
||||
|
||||
struct client6_data_t {
|
||||
|
Reference in New Issue
Block a user