dispatcher: pass DHCP options as string:string hash
This is what was originally intended, but the NM-side code wasn't doing this due to an oversight...
This commit is contained in:
@@ -390,6 +390,38 @@ dump_object_to_props (GObject *object, GHashTable *hash)
|
|||||||
g_free (pspecs);
|
g_free (pspecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dump_dhcp4_to_props (NMDHCP4Config *config, GHashTable *hash)
|
||||||
|
{
|
||||||
|
GSList *options, *iter;
|
||||||
|
|
||||||
|
options = nm_dhcp4_config_list_options (config);
|
||||||
|
for (iter = options; iter; iter = g_slist_next (iter)) {
|
||||||
|
const char *option = (const char *) iter->data;
|
||||||
|
const char *val;
|
||||||
|
|
||||||
|
val = nm_dhcp4_config_get_option (config, option);
|
||||||
|
value_hash_add_str (hash, option, val);
|
||||||
|
}
|
||||||
|
g_slist_free (options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dump_dhcp6_to_props (NMDHCP6Config *config, GHashTable *hash)
|
||||||
|
{
|
||||||
|
GSList *options, *iter;
|
||||||
|
|
||||||
|
options = nm_dhcp6_config_list_options (config);
|
||||||
|
for (iter = options; iter; iter = g_slist_next (iter)) {
|
||||||
|
const char *option = (const char *) iter->data;
|
||||||
|
const char *val;
|
||||||
|
|
||||||
|
val = nm_dhcp6_config_get_option (config, option);
|
||||||
|
value_hash_add_str (hash, option, val);
|
||||||
|
}
|
||||||
|
g_slist_free (options);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_device_props (NMDevice *device,
|
fill_device_props (NMDevice *device,
|
||||||
GHashTable *dev_hash,
|
GHashTable *dev_hash,
|
||||||
@@ -420,11 +452,11 @@ fill_device_props (NMDevice *device,
|
|||||||
|
|
||||||
dhcp4_config = nm_device_get_dhcp4_config (device);
|
dhcp4_config = nm_device_get_dhcp4_config (device);
|
||||||
if (dhcp4_config)
|
if (dhcp4_config)
|
||||||
dump_object_to_props (G_OBJECT (dhcp4_config), dhcp4_hash);
|
dump_dhcp4_to_props (dhcp4_config, dhcp4_hash);
|
||||||
|
|
||||||
dhcp6_config = nm_device_get_dhcp6_config (device);
|
dhcp6_config = nm_device_get_dhcp6_config (device);
|
||||||
if (dhcp6_config)
|
if (dhcp6_config)
|
||||||
dump_object_to_props (G_OBJECT (dhcp6_config), dhcp6_hash);
|
dump_dhcp6_to_props (dhcp6_config, dhcp6_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -101,6 +101,23 @@ nm_dhcp4_config_get_option (NMDHCP4Config *self, const char *key)
|
|||||||
return value ? g_value_get_string (value) : NULL;
|
return value ? g_value_get_string (value) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Caller owns the list, but not the values in the list */
|
||||||
|
GSList *
|
||||||
|
nm_dhcp4_config_list_options (NMDHCP4Config *self)
|
||||||
|
{
|
||||||
|
GHashTableIter iter;
|
||||||
|
const char *option = NULL;
|
||||||
|
GSList *list = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IS_DHCP4_CONFIG (self), NULL);
|
||||||
|
|
||||||
|
g_hash_table_iter_init (&iter, NM_DHCP4_CONFIG_GET_PRIVATE (self)->options);
|
||||||
|
while (g_hash_table_iter_next (&iter, (gpointer) &option, NULL))
|
||||||
|
list = g_slist_prepend (list, (gpointer) option);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nm_dhcp4_config_get_dbus_path (NMDHCP4Config *self)
|
nm_dhcp4_config_get_dbus_path (NMDHCP4Config *self)
|
||||||
{
|
{
|
||||||
|
@@ -58,4 +58,6 @@ void nm_dhcp4_config_reset (NMDHCP4Config *config);
|
|||||||
|
|
||||||
const char *nm_dhcp4_config_get_option (NMDHCP4Config *config, const char *option);
|
const char *nm_dhcp4_config_get_option (NMDHCP4Config *config, const char *option);
|
||||||
|
|
||||||
|
GSList *nm_dhcp4_config_list_options (NMDHCP4Config *config);
|
||||||
|
|
||||||
#endif /* NM_DHCP4_CONFIG_H */
|
#endif /* NM_DHCP4_CONFIG_H */
|
||||||
|
@@ -101,6 +101,23 @@ nm_dhcp6_config_get_option (NMDHCP6Config *self, const char *key)
|
|||||||
return value ? g_value_get_string (value) : NULL;
|
return value ? g_value_get_string (value) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Caller owns the list, but not the values in the list */
|
||||||
|
GSList *
|
||||||
|
nm_dhcp6_config_list_options (NMDHCP6Config *self)
|
||||||
|
{
|
||||||
|
GHashTableIter iter;
|
||||||
|
const char *option = NULL;
|
||||||
|
GSList *list = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL);
|
||||||
|
|
||||||
|
g_hash_table_iter_init (&iter, NM_DHCP6_CONFIG_GET_PRIVATE (self)->options);
|
||||||
|
while (g_hash_table_iter_next (&iter, (gpointer) &option, NULL))
|
||||||
|
list = g_slist_prepend (list, (gpointer) option);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nm_dhcp6_config_get_dbus_path (NMDHCP6Config *self)
|
nm_dhcp6_config_get_dbus_path (NMDHCP6Config *self)
|
||||||
{
|
{
|
||||||
|
@@ -58,4 +58,6 @@ void nm_dhcp6_config_reset (NMDHCP6Config *config);
|
|||||||
|
|
||||||
const char *nm_dhcp6_config_get_option (NMDHCP6Config *config, const char *option);
|
const char *nm_dhcp6_config_get_option (NMDHCP6Config *config, const char *option);
|
||||||
|
|
||||||
|
GSList *nm_dhcp6_config_list_options (NMDHCP6Config *self);
|
||||||
|
|
||||||
#endif /* NM_DHCP6_CONFIG_H */
|
#endif /* NM_DHCP6_CONFIG_H */
|
||||||
|
Reference in New Issue
Block a user