From 0280fd1a808ed55ca58f6c0c137e2f53d0d1686e Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 25 Jun 2019 13:53:35 +0200 Subject: [PATCH] shared: add nm_sd_dns_name_to_wire_format() Add nm_sd_dns_name_to_wire_format() based on systemd utilities to convert a name into its wire format according to RFC 1035 section 3.1. It will be used to build the content of the DHCP FQDN option. --- shared/systemd/nm-sd-utils-shared.c | 9 +++++++++ shared/systemd/nm-sd-utils-shared.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/shared/systemd/nm-sd-utils-shared.c b/shared/systemd/nm-sd-utils-shared.c index ecd2749213..a1f34c6ac4 100644 --- a/shared/systemd/nm-sd-utils-shared.c +++ b/shared/systemd/nm-sd-utils-shared.c @@ -24,6 +24,7 @@ #include "path-util.h" #include "hexdecoct.h" +#include "dns-domain.h" /*****************************************************************************/ @@ -83,3 +84,11 @@ nm_sd_utils_unbase64mem (const char *p, { return unbase64mem_full (p, l, secure, (void **) mem, len); } + +int nm_sd_dns_name_to_wire_format (const char *domain, + guint8 *buffer, + size_t len, + gboolean canonical) +{ + return dns_name_to_wire_format (domain, buffer, len, canonical); +} diff --git a/shared/systemd/nm-sd-utils-shared.h b/shared/systemd/nm-sd-utils-shared.h index b3b77c8842..48a8cf37ac 100644 --- a/shared/systemd/nm-sd-utils-shared.h +++ b/shared/systemd/nm-sd-utils-shared.h @@ -39,4 +39,9 @@ int nm_sd_utils_unbase64mem (const char *p, /*****************************************************************************/ +int nm_sd_dns_name_to_wire_format (const char *domain, + guint8 *buffer, + size_t len, + gboolean canonical); + #endif /* __NM_SD_UTILS_SHARED_H__ */