Merge pull request #16104 from ssahani/dhcpv6-iaid
networkctl: Display DHCPv6 IAID
This commit is contained in:
@@ -342,6 +342,18 @@ int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_dhcp6_client_get_iaid(sd_dhcp6_client *client, uint32_t *iaid) {
|
||||
assert_return(client, -EINVAL);
|
||||
assert_return(iaid, -EINVAL);
|
||||
|
||||
if (!client->iaid_set)
|
||||
return -ENODATA;
|
||||
|
||||
*iaid = be32toh(client->ia_na.ia_na.id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_dhcp6_client_set_fqdn(
|
||||
sd_dhcp6_client *client,
|
||||
const char *fqdn) {
|
||||
|
||||
@@ -172,6 +172,10 @@ _public_ int sd_network_link_get_dhcp4_client_id_string(int ifindex, char **clie
|
||||
return network_link_get_string(ifindex, "DHCP4_CLIENT_ID", client_id);
|
||||
}
|
||||
|
||||
_public_ int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid) {
|
||||
return network_link_get_string(ifindex, "DHCP6_CLIENT_IAID", iaid);
|
||||
}
|
||||
|
||||
_public_ int sd_network_link_get_required_for_online(int ifindex) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
int r;
|
||||
|
||||
@@ -1381,7 +1381,7 @@ static int link_status_one(
|
||||
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL,
|
||||
**pop3_server = NULL, **smtp_server = NULL, **lpr_server = NULL;
|
||||
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
|
||||
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL;
|
||||
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL, *iaid = NULL;
|
||||
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
|
||||
const char *on_color_operational, *off_color_operational,
|
||||
*on_color_setup, *off_color_setup;
|
||||
@@ -2083,6 +2083,16 @@ static int link_status_one(
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
r = sd_network_link_get_dhcp6_client_iaid_string(info->ifindex, &iaid);
|
||||
if (r >= 0) {
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "DHCP6 Client IAID:",
|
||||
TABLE_STRING, iaid);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
r = dump_lldp_neighbors(table, "Connected To:", info->ifindex);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -4086,8 +4086,9 @@ int link_save(Link *link) {
|
||||
const char *admin_state, *oper_state, *carrier_state, *address_state;
|
||||
_cleanup_free_ char *temp_path = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
Address *a;
|
||||
uint32_t iaid;
|
||||
Route *route;
|
||||
Address *a;
|
||||
Iterator i;
|
||||
int r;
|
||||
|
||||
@@ -4420,6 +4421,10 @@ int link_save(Link *link) {
|
||||
}
|
||||
}
|
||||
|
||||
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
|
||||
if (r >= 0)
|
||||
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
|
||||
|
||||
r = fflush_and_check(f);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -110,6 +110,9 @@ int sd_dhcp6_client_set_duid_llt(
|
||||
int sd_dhcp6_client_set_iaid(
|
||||
sd_dhcp6_client *client,
|
||||
uint32_t iaid);
|
||||
int sd_dhcp6_client_get_iaid(
|
||||
sd_dhcp6_client *client,
|
||||
uint32_t *iaid);
|
||||
int sd_dhcp6_client_set_fqdn(
|
||||
sd_dhcp6_client *client,
|
||||
const char *fqdn);
|
||||
|
||||
@@ -191,6 +191,9 @@ int sd_network_link_get_timezone(int ifindex, char **timezone);
|
||||
/* Get DHCPv4 client id for a given link. */
|
||||
int sd_network_link_get_dhcp4_client_id_string(int ifindex, char **client_id);
|
||||
|
||||
/* Get DHCPv6 client IAID for a given link. */
|
||||
int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid);
|
||||
|
||||
/* Monitor object */
|
||||
typedef struct sd_network_monitor sd_network_monitor;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user