network: drop link_load()

The link state file does not exist, as it is always removed on stop.
This commit is contained in:
Yu Watanabe 2020-10-28 15:48:34 +09:00
parent 6fdcef2174
commit 61eb77c4b6
1 changed files with 0 additions and 41 deletions

View File

@ -2411,43 +2411,6 @@ int link_initialized(Link *link, sd_device *device) {
return 0;
}
static int link_load(Link *link) {
_cleanup_free_ char *network_file = NULL;
int r;
assert(link);
r = parse_env_file(NULL, link->state_file,
"NETWORK_FILE", &network_file);
if (r < 0 && r != -ENOENT)
return log_link_error_errno(link, r, "Failed to read %s: %m", link->state_file);
if (network_file) {
Network *network;
char *suffix;
/* drop suffix */
suffix = strrchr(network_file, '.');
if (!suffix) {
log_link_debug(link, "Failed to get network name from %s", network_file);
return 0;
}
*suffix = '\0';
r = network_get_by_name(link->manager, basename(network_file), &network);
if (r < 0) {
log_link_debug_errno(link, r, "Failed to get network %s: %m", basename(network_file));
return 0;
}
r = network_apply(network, link);
if (r < 0)
return log_link_error_errno(link, r, "Failed to apply network %s: %m", basename(network_file));
}
return 0;
}
int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
char ifindex_str[2 + DECIMAL_STR_MAX(int)];
@ -2467,10 +2430,6 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
log_link_debug(link, "Link %d added", link->ifindex);
r = link_load(link);
if (r < 0)
return r;
if (path_is_read_only_fs("/sys") <= 0) {
/* udev should be around */
sprintf(ifindex_str, "n%d", link->ifindex);