diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-27 12:10:45 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-28 11:15:56 +0200 |
commit | 3b85b9f1a615d3b1dc7d50be04c1f4c498bf5f53 (patch) | |
tree | 8b9126cb3f897aa159aad6f34eda9397a5ff856a | |
parent | e1b824b871b40d7f033ebd2fcbe80331b0b14e4c (diff) | |
download | NetworkManager-lr/next-server.tar.gz |
config: also save next-server in the state filelr/next-server
The early boot tooling gets the root-path from our state file due to a
better way to do that. However, when booting with NFS root, the root path
alone is not sufficient; the server address is communicated via the
next-server option. Save that one in the state file as well.
-rw-r--r-- | src/nm-config.c | 11 | ||||
-rw-r--r-- | src/nm-config.h | 1 | ||||
-rw-r--r-- | src/nm-manager.c | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/nm-config.c b/src/nm-config.c index 8262d78721..9b484f0638 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -2187,6 +2187,7 @@ _nm_config_state_set (NMConfig *self, #define DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_ROUTE_METRIC_DEFAULT_ASPIRED "route-metric-default-aspired" #define DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_ROUTE_METRIC_DEFAULT_EFFECTIVE "route-metric-default-effective" #define DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_ROOT_PATH "root-path" +#define DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_NEXT_SERVER "next-server" NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_device_state_managed_type_to_str, NMConfigDeviceStateManagedType, NM_UTILS_LOOKUP_DEFAULT_NM_ASSERT ("unknown"), @@ -2385,6 +2386,7 @@ nm_config_device_state_write (int ifindex, int nm_owned, guint32 route_metric_default_aspired, guint32 route_metric_default_effective, + const char *next_server, const char *root_path) { char path[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR) + 60]; @@ -2439,6 +2441,12 @@ nm_config_device_state_write (int ifindex, route_metric_default_aspired); } } + if (next_server) { + g_key_file_set_string (kf, + DEVICE_RUN_STATE_KEYFILE_GROUP_DEVICE, + DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_NEXT_SERVER, + next_server); + } if (root_path) { g_key_file_set_string (kf, DEVICE_RUN_STATE_KEYFILE_GROUP_DEVICE, @@ -2451,13 +2459,14 @@ nm_config_device_state_write (int ifindex, g_error_free (local); return FALSE; } - _LOGT ("device-state: write #%d (%s); managed=%s%s%s%s%s%s%s, route-metric-default=%"G_GUINT32_FORMAT"-%"G_GUINT32_FORMAT"%s%s%s", + _LOGT ("device-state: write #%d (%s); managed=%s%s%s%s%s%s%s, route-metric-default=%"G_GUINT32_FORMAT"-%"G_GUINT32_FORMAT"%s%s%s%s%s%s", ifindex, path, _device_state_managed_type_to_str (managed), NM_PRINT_FMT_QUOTED (connection_uuid, ", connection-uuid=", connection_uuid, "", ""), NM_PRINT_FMT_QUOTED (perm_hw_addr_fake, ", perm-hw-addr-fake=", perm_hw_addr_fake, "", ""), route_metric_default_aspired, route_metric_default_effective, + NM_PRINT_FMT_QUOTED (next_server, ", next-server=", next_server, "", ""), NM_PRINT_FMT_QUOTED (root_path, ", root-path=", root_path, "", "")); return TRUE; } diff --git a/src/nm-config.h b/src/nm-config.h index 66f1b69c09..01f85ba79f 100644 --- a/src/nm-config.h +++ b/src/nm-config.h @@ -270,6 +270,7 @@ gboolean nm_config_device_state_write (int ifindex, int nm_owned, guint32 route_metric_default_aspired, guint32 route_metric_default_effective, + const char *next_server, const char *root_path); void nm_config_device_state_prune_unseen (GHashTable *seen_ifindexes); diff --git a/src/nm-manager.c b/src/nm-manager.c index b6beb61286..06bf216737 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -6421,6 +6421,7 @@ nm_manager_write_device_state (NMManager *self, NMDevice *device) guint32 route_metric_default_effective; int nm_owned; NMDhcp4Config *dhcp4_config; + const char *next_server = NULL; const char *root_path = NULL; ifindex = nm_device_get_ip_ifindex (device); @@ -6458,8 +6459,10 @@ nm_manager_write_device_state (NMManager *self, NMDevice *device) TRUE, &route_metric_default_aspired); dhcp4_config = nm_device_get_dhcp4_config (device); - if (dhcp4_config) + if (dhcp4_config) { root_path = nm_dhcp4_config_get_option (dhcp4_config, "root_path"); + next_server = nm_dhcp4_config_get_option (dhcp4_config, "next_server"); + } return nm_config_device_state_write (ifindex, managed_type, @@ -6468,6 +6471,7 @@ nm_manager_write_device_state (NMManager *self, NMDevice *device) nm_owned, route_metric_default_aspired, route_metric_default_effective, + next_server, root_path); } |