mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 10:48:12 +02:00
n-dhcp4/lease: expose the server IP address
This is useful for network booting.
https://github.com/nettools/n-dhcp4/pull/7
(cherry picked from commit edda3d3606)
This commit is contained in:
parent
68841b76a6
commit
435dcc3dc6
4 changed files with 17 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ global:
|
||||||
n_dhcp4_client_lease_ref;
|
n_dhcp4_client_lease_ref;
|
||||||
n_dhcp4_client_lease_unref;
|
n_dhcp4_client_lease_unref;
|
||||||
n_dhcp4_client_lease_get_yiaddr;
|
n_dhcp4_client_lease_get_yiaddr;
|
||||||
|
n_dhcp4_client_lease_get_siaddr;
|
||||||
n_dhcp4_client_lease_get_lifetime;
|
n_dhcp4_client_lease_get_lifetime;
|
||||||
n_dhcp4_client_lease_query;
|
n_dhcp4_client_lease_query;
|
||||||
n_dhcp4_client_lease_select;
|
n_dhcp4_client_lease_select;
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,20 @@ _c_public_ void n_dhcp4_client_lease_get_yiaddr(NDhcp4ClientLease *lease, struct
|
||||||
yiaddr->s_addr = header->yiaddr;
|
yiaddr->s_addr = header->yiaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* n_dhcp4_client_lease_get_siaddr() - get the server IP address
|
||||||
|
* @lease: the lease to operate on
|
||||||
|
* @siaddr: return argument for the IP address
|
||||||
|
*
|
||||||
|
* Gets the server IP address cotained in the lease. Or INADDR_ANY if the
|
||||||
|
* lease does not contain an IP address.
|
||||||
|
*/
|
||||||
|
_c_public_ void n_dhcp4_client_lease_get_siaddr(NDhcp4ClientLease *lease, struct in_addr *siaddr) {
|
||||||
|
NDhcp4Header *header = n_dhcp4_incoming_get_header(lease->message);
|
||||||
|
|
||||||
|
siaddr->s_addr = header->siaddr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* n_dhcp4_client_lease_get_lifetime() - get the lifetime
|
* n_dhcp4_client_lease_get_lifetime() - get the lifetime
|
||||||
* @lease: the lease to operate on
|
* @lease: the lease to operate on
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ NDhcp4ClientLease *n_dhcp4_client_lease_ref(NDhcp4ClientLease *lease);
|
||||||
NDhcp4ClientLease *n_dhcp4_client_lease_unref(NDhcp4ClientLease *lease);
|
NDhcp4ClientLease *n_dhcp4_client_lease_unref(NDhcp4ClientLease *lease);
|
||||||
|
|
||||||
void n_dhcp4_client_lease_get_yiaddr(NDhcp4ClientLease *lease, struct in_addr *yiaddr);
|
void n_dhcp4_client_lease_get_yiaddr(NDhcp4ClientLease *lease, struct in_addr *yiaddr);
|
||||||
|
void n_dhcp4_client_lease_get_siaddr(NDhcp4ClientLease *lease, struct in_addr *siaddr);
|
||||||
void n_dhcp4_client_lease_get_lifetime(NDhcp4ClientLease *lease, uint64_t *ns_lifetimep);
|
void n_dhcp4_client_lease_get_lifetime(NDhcp4ClientLease *lease, uint64_t *ns_lifetimep);
|
||||||
int n_dhcp4_client_lease_query(NDhcp4ClientLease *lease, uint8_t option, uint8_t **datap, size_t *n_datap);
|
int n_dhcp4_client_lease_query(NDhcp4ClientLease *lease, uint8_t option, uint8_t **datap, size_t *n_datap);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ static void test_api_functions(void) {
|
||||||
(void *)n_dhcp4_client_lease_unrefp,
|
(void *)n_dhcp4_client_lease_unrefp,
|
||||||
(void *)n_dhcp4_client_lease_unrefv,
|
(void *)n_dhcp4_client_lease_unrefv,
|
||||||
(void *)n_dhcp4_client_lease_get_yiaddr,
|
(void *)n_dhcp4_client_lease_get_yiaddr,
|
||||||
|
(void *)n_dhcp4_client_lease_get_siaddr,
|
||||||
(void *)n_dhcp4_client_lease_get_lifetime,
|
(void *)n_dhcp4_client_lease_get_lifetime,
|
||||||
(void *)n_dhcp4_client_lease_query,
|
(void *)n_dhcp4_client_lease_query,
|
||||||
(void *)n_dhcp4_client_lease_select,
|
(void *)n_dhcp4_client_lease_select,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue