summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-06-25 13:53:35 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-07-05 11:04:32 +0200
commit0280fd1a808ed55ca58f6c0c137e2f53d0d1686e (patch)
tree0ecc7b2f911ef7d7afe026c1b23b231a07f0a26f
parent7d3098ff90ec5c5e0406169ea840e69a5dba228b (diff)
downloadNetworkManager-0280fd1a808ed55ca58f6c0c137e2f53d0d1686e.tar.gz
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.
-rw-r--r--shared/systemd/nm-sd-utils-shared.c9
-rw-r--r--shared/systemd/nm-sd-utils-shared.h5
2 files changed, 14 insertions, 0 deletions
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__ */