networkd-dhcp6: generalize DHCPv6 client (re)starting
authorTom Yan <tom.ty89@gmail.com>
Wed, 1 Jun 2016 06:54:46 +0000 (14:54 +0800)
committerTom Yan <tom.ty89@gmail.com>
Wed, 1 Jun 2016 06:54:46 +0000 (14:54 +0800)
commit720bec40e94a65d7a63a0091773b2bab2934ee41
treecbe9b2feba5ca74afd85aedcf3e4d3abe1dfc952
parente33a06a1eb7406ece8e35f6346ba0ea208c11cf1
networkd-dhcp6: generalize DHCPv6 client (re)starting

dhcp6_request_address() was merely a function to switch the DHCPv6 client from "stateless" mode to "stateful" mode. It was also a one-way switch. Also, to (re)start the client, we would need to repeat separate function calls.

In this patch, dhcp6_request_address() is made a general starter/manager of the DHCPv6 client. It now takes an extra parameter so we will be specifying which mode the DHCPv6 client should be started in. Also it will keep track of the current mode and compare with the newly requested mode, and only restart the client in case there is a difference between them.

This also makes sure that the DHCPv6 client will be (re)started accordingly as per the Router Advertisement flags.
src/network/networkd-dhcp6.c
src/network/networkd-link.c
src/network/networkd-link.h
src/network/networkd-ndisc.c