diff --git a/src/core/dhcp/nm-dhcp-options.c b/src/core/dhcp/nm-dhcp-options.c index c10077a43..c3ef8478e 100644 --- a/src/core/dhcp/nm-dhcp-options.c +++ b/src/core/dhcp/nm-dhcp-options.c @@ -241,6 +241,20 @@ nm_dhcp_option_add_option(GHashTable * options, nm_dhcp_option_take_option(options, requests, option, g_strdup(value)); } +void +nm_dhcp_option_add_option_utf8safe_escape(GHashTable * options, + const NMDhcpOption *requests, + guint option, + const guint8 * data, + gsize n_data) +{ + gs_free char *to_free = NULL; + const char * escaped; + + escaped = nm_utils_buf_utf8safe_escape((char *) data, n_data, 0, &to_free); + nm_dhcp_option_add_option(options, requests, option, escaped ?: ""); +} + void nm_dhcp_option_add_option_u64(GHashTable * options, const NMDhcpOption *requests, diff --git a/src/core/dhcp/nm-dhcp-options.h b/src/core/dhcp/nm-dhcp-options.h index c2a403a4b..9e6e4d1cf 100644 --- a/src/core/dhcp/nm-dhcp-options.h +++ b/src/core/dhcp/nm-dhcp-options.h @@ -195,6 +195,11 @@ void nm_dhcp_option_add_option(GHashTable * options, const NMDhcpOption *requests, guint option, const char * value); +void nm_dhcp_option_add_option_utf8safe_escape(GHashTable * options, + const NMDhcpOption *requests, + guint option, + const guint8 * data, + gsize n_data); void nm_dhcp_option_add_option_u64(GHashTable * options, const NMDhcpOption *requests, guint option,