diff options
author | Thomas Haller <thaller@redhat.com> | 2021-02-10 15:14:10 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-02-11 09:23:07 +0100 |
commit | fc83acbd99f9d2558176b1546ba560696fd13974 (patch) | |
tree | 111534ed8042b1150d102310e49022741dd4890c | |
parent | 41634d51993d04c7fc7c56c624f1e781ac4faa2d (diff) | |
download | NetworkManager-fc83acbd99f9d2558176b1546ba560696fd13974.tar.gz |
dhcp: add nm_dhcp_option_add_option_in_addr() helper
-rw-r--r-- | src/core/dhcp/nm-dhcp-options.c | 11 | ||||
-rw-r--r-- | src/core/dhcp/nm-dhcp-options.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/core/dhcp/nm-dhcp-options.c b/src/core/dhcp/nm-dhcp-options.c index c3ef8478e8..e03fa23192 100644 --- a/src/core/dhcp/nm-dhcp-options.c +++ b/src/core/dhcp/nm-dhcp-options.c @@ -268,6 +268,17 @@ nm_dhcp_option_add_option_u64(GHashTable * options, } void +nm_dhcp_option_add_option_in_addr(GHashTable * options, + const NMDhcpOption *requests, + guint option, + in_addr_t value) +{ + char sbuf[NM_UTILS_INET_ADDRSTRLEN]; + + nm_dhcp_option_add_option(options, requests, option, _nm_utils_inet4_ntop(value, sbuf)); +} + +void nm_dhcp_option_add_requests_to_options(GHashTable *options, const NMDhcpOption *requests) { guint i; diff --git a/src/core/dhcp/nm-dhcp-options.h b/src/core/dhcp/nm-dhcp-options.h index 9e6e4d1cf1..2ebf339ed7 100644 --- a/src/core/dhcp/nm-dhcp-options.h +++ b/src/core/dhcp/nm-dhcp-options.h @@ -200,6 +200,10 @@ void nm_dhcp_option_add_option_utf8safe_escape(GHashTable * option guint option, const guint8 * data, gsize n_data); +void nm_dhcp_option_add_option_in_addr(GHashTable * options, + const NMDhcpOption *requests, + guint option, + in_addr_t value); void nm_dhcp_option_add_option_u64(GHashTable * options, const NMDhcpOption *requests, guint option, |