mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 18:27:04 +03:00
dhcp6: Add functionality to request DHCPv6 IA PD
Add a function to request IA Prefix Delegation when the DHCPv6 client is started and PD options to DHCPv6 messages.
This commit is contained in:
parent
c77e3db19e
commit
7c3de8f8cf
@ -55,6 +55,7 @@ struct sd_dhcp6_client {
|
|||||||
uint16_t arp_type;
|
uint16_t arp_type;
|
||||||
DHCP6IA ia_na;
|
DHCP6IA ia_na;
|
||||||
DHCP6IA ia_pd;
|
DHCP6IA ia_pd;
|
||||||
|
bool prefix_delegation;
|
||||||
be32_t transaction_id;
|
be32_t transaction_id;
|
||||||
usec_t transaction_start;
|
usec_t transaction_start;
|
||||||
struct sd_dhcp6_lease *lease;
|
struct sd_dhcp6_lease *lease;
|
||||||
@ -300,6 +301,14 @@ int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client, uint16_t option)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sd_dhcp6_client_set_prefix_delegation(sd_dhcp6_client *client, bool delegation) {
|
||||||
|
assert_return(client, -EINVAL);
|
||||||
|
|
||||||
|
client->prefix_delegation = delegation;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int sd_dhcp6_client_get_lease(sd_dhcp6_client *client, sd_dhcp6_lease **ret) {
|
int sd_dhcp6_client_get_lease(sd_dhcp6_client *client, sd_dhcp6_lease **ret) {
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
|
|
||||||
@ -413,6 +422,15 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client->prefix_delegation) {
|
||||||
|
r = dhcp6_option_append_pd(opt, optlen, &client->ia_pd);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
opt += r;
|
||||||
|
optlen -= r;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCP6_STATE_REQUEST:
|
case DHCP6_STATE_REQUEST:
|
||||||
@ -439,6 +457,15 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client->prefix_delegation) {
|
||||||
|
r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
opt += r;
|
||||||
|
optlen -= r;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCP6_STATE_REBIND:
|
case DHCP6_STATE_REBIND:
|
||||||
@ -454,6 +481,15 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client->prefix_delegation) {
|
||||||
|
r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
opt += r;
|
||||||
|
optlen -= r;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCP6_STATE_STOPPED:
|
case DHCP6_STATE_STOPPED:
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <net/ethernet.h>
|
#include <net/ethernet.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "sd-dhcp6-lease.h"
|
#include "sd-dhcp6-lease.h"
|
||||||
@ -118,6 +119,8 @@ int sd_dhcp6_client_get_information_request(
|
|||||||
int sd_dhcp6_client_set_request_option(
|
int sd_dhcp6_client_set_request_option(
|
||||||
sd_dhcp6_client *client,
|
sd_dhcp6_client *client,
|
||||||
uint16_t option);
|
uint16_t option);
|
||||||
|
int sd_dhcp6_client_set_prefix_delegation(sd_dhcp6_client *client,
|
||||||
|
bool delegation);
|
||||||
|
|
||||||
int sd_dhcp6_client_get_lease(
|
int sd_dhcp6_client_get_lease(
|
||||||
sd_dhcp6_client *client,
|
sd_dhcp6_client *client,
|
||||||
|
Loading…
Reference in New Issue
Block a user