mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 05:40:29 +01:00
config: also save next-server in the state file
The early boot tooling gets the root-path from our state file due to a lack of 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. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/168
This commit is contained in:
parent
9a7929bdb1
commit
5cf6cfd999
3 changed files with 16 additions and 2 deletions
|
|
@ -2177,6 +2177,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"),
|
||||
|
|
@ -2375,6 +2376,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];
|
||||
|
|
@ -2429,6 +2431,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,
|
||||
|
|
@ -2441,13 +2449,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,6 +269,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);
|
||||
|
|
|
|||
|
|
@ -6422,6 +6422,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);
|
||||
|
|
@ -6459,8 +6460,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,
|
||||
|
|
@ -6469,6 +6472,7 @@ nm_manager_write_device_state (NMManager *self, NMDevice *device)
|
|||
nm_owned,
|
||||
route_metric_default_aspired,
|
||||
route_metric_default_effective,
|
||||
next_server,
|
||||
root_path);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue