Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dhcpv6: Do not fail when no keyfile saved
During a DHCPv6 transaction, a DUID field was requested from storage by calling connman_service_load_service, which tried to open the keyfile on drive. If the service was not a newly created one, its data would get written to the keyfile and DHCPv6 solicitation would proceed, even if the keyfile would not contain the DUID value - a new one would be generated with the set_duid function. However, since the function connman_service_load_service fails when the file is not present, and does not create a new one, the rest of the set_duid function was not executed, and the DHCPv6 solicitation packet failed to be sent, rendering IPv6 on the interface as non-working. Also, the previous behaviour interferes badly with keyfile storage. A potential service save operation may overwrite the previously written duid value. This change adds a struct connman_ipconfig member, dhcpv6_duid, provides a getter and setter functions for it, and modifies __connman_ipconfig_load and __connman_ipconfig_save functions to load and store the value along with the connman_ipconfig structure. Initialization did not need to be modified, since the structure is allocated with g_try_new0, which zeros the dhcpv6_duid pointer. The memory is freed in __connman_ipconfig_unref_debug.
- Loading branch information
Showing
3 changed files
with
41 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters