mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 06:25:37 +03:00
sd-dhcp6-client: move client_ensure_iaid()
No functional change.
This commit is contained in:
parent
af2b484141
commit
0eca25ba00
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user