summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-02-06 19:23:34 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-02-14 06:57:34 +0100
commit0eca25ba0098803b0b14c680aafd77c42bf12b17 (patch)
tree8d204c314f761a7988ffc03de336caa4adcfd899
parentsd-dhcp6-client: merge client_start() and client_reset() (diff)
downloadsystemd-0eca25ba0098803b0b14c680aafd77c42bf12b17.tar.xz
systemd-0eca25ba0098803b0b14c680aafd77c42bf12b17.zip
sd-dhcp6-client: move client_ensure_iaid()
No functional change.
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 5a046414d7..044cf31733 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -384,10 +384,27 @@ int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
return 0;
}
-void dhcp6_client_set_test_mode(sd_dhcp6_client *client, bool test_mode) {
+static int client_ensure_iaid(sd_dhcp6_client *client) {
+ int r;
+ uint32_t iaid;
+
assert(client);
- client->test_mode = test_mode;
+ if (client->iaid_set)
+ return 0;
+
+ r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len,
+ /* legacy_unstable_byteorder = */ true,
+ /* use_mac = */ client->test_mode,
+ &iaid);
+ if (r < 0)
+ return r;
+
+ client->ia_na.header.id = iaid;
+ client->ia_pd.header.id = iaid;
+ client->iaid_set = true;
+
+ return 0;
}
int sd_dhcp6_client_get_iaid(sd_dhcp6_client *client, uint32_t *iaid) {
@@ -402,6 +419,12 @@ int sd_dhcp6_client_get_iaid(sd_dhcp6_client *client, uint32_t *iaid) {
return 0;
}
+void dhcp6_client_set_test_mode(sd_dhcp6_client *client, bool test_mode) {
+ assert(client);
+
+ client->test_mode = test_mode;
+}
+
int sd_dhcp6_client_set_fqdn(
sd_dhcp6_client *client,
const char *fqdn) {
@@ -1022,29 +1045,6 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec, void *userda
return 0;
}
-static int client_ensure_iaid(sd_dhcp6_client *client) {
- int r;
- uint32_t iaid;
-
- assert(client);
-
- if (client->iaid_set)
- return 0;
-
- r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len,
- /* legacy_unstable_byteorder = */ true,
- /* use_mac = */ client->test_mode,
- &iaid);
- if (r < 0)
- return r;
-
- client->ia_na.header.id = iaid;
- client->ia_pd.header.id = iaid;
- client->iaid_set = true;
-
- return 0;
-}
-
static int log_invalid_message_type(sd_dhcp6_client *client, const DHCP6Message *message) {
const char *type_str;