summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-08-06 19:08:35 +0200
committerThomas Haller <thaller@redhat.com>2021-08-06 22:00:34 +0200
commit4d820db46c1250c1279f7f8b558c9ceaec122c3f (patch)
tree8d80086f7e53c65e2cde07779c34cf6c61af0923
parentcdb958b4e032a723b0c69d2ed640d8c3c3d44ac9 (diff)
downloadNetworkManager-4d820db46c1250c1279f7f8b558c9ceaec122c3f.tar.gz
ndisc: add nm_ndisc_dhcp_level_to_string() helper
-rw-r--r--src/core/ndisc/nm-ndisc.c10
-rw-r--r--src/core/ndisc/nm-ndisc.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c
index 655a2523ad..4bfd5da186 100644
--- a/src/core/ndisc/nm-ndisc.c
+++ b/src/core/ndisc/nm-ndisc.c
@@ -96,6 +96,16 @@ static gboolean timeout_expire_cb(gpointer user_data);
/*****************************************************************************/
+NM_UTILS_LOOKUP_STR_DEFINE(nm_ndisc_dhcp_level_to_string,
+ NMNDiscDHCPLevel,
+ NM_UTILS_LOOKUP_DEFAULT(NULL),
+ NM_UTILS_LOOKUP_STR_ITEM(NM_NDISC_DHCP_LEVEL_UNKNOWN, "unknown"),
+ NM_UTILS_LOOKUP_STR_ITEM(NM_NDISC_DHCP_LEVEL_NONE, "none"),
+ NM_UTILS_LOOKUP_STR_ITEM(NM_NDISC_DHCP_LEVEL_OTHERCONF, "otherconf"),
+ NM_UTILS_LOOKUP_STR_ITEM(NM_NDISC_DHCP_LEVEL_MANAGED, "managed"), );
+
+/*****************************************************************************/
+
NML3ConfigData *
nm_ndisc_data_to_l3cd(NMDedupMultiIndex * multi_idx,
int ifindex,
diff --git a/src/core/ndisc/nm-ndisc.h b/src/core/ndisc/nm-ndisc.h
index 15f95d206d..968f739ee2 100644
--- a/src/core/ndisc/nm-ndisc.h
+++ b/src/core/ndisc/nm-ndisc.h
@@ -48,6 +48,8 @@ typedef enum {
NM_NDISC_DHCP_LEVEL_MANAGED
} NMNDiscDHCPLevel;
+const char *nm_ndisc_dhcp_level_to_string(NMNDiscDHCPLevel level);
+
#define NM_NDISC_INFINITY_U32 ((uint32_t) -1)
/* It's important that this is G_MAXINT64, so that we can meaningfully do