X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fudev%2Fnet%2Flink-config.c;h=fe916a4326755e7fc0be49d2c89d77db6e831533;hp=a9acc3ddb7f3173058a07209f4680abb16abba54;hb=e9f3d2d508bfd9fb5b54e82994bda365a71eb864;hpb=edf029b7fd9a5853a87d3ca99aac2922bb8a277e diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index a9acc3ddb..fe916a432 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -92,14 +92,20 @@ static int link_config_ctx_connect(link_config_ctx *ctx) { if (ctx->ethtool_fd == -1) { r = ethtool_connect(&ctx->ethtool_fd); - if (r < 0) + if (r < 0) { + log_warning("link_config: could not connect to ethtool: %s", + strerror(-r)); return r; + } } if (!ctx->rtnl) { r = sd_rtnl_open(&ctx->rtnl, 0); - if (r < 0) + if (r < 0) { + log_warning("link_config: could not connect to rtnl: %s", + strerror(-r)); return r; + } } return 0; @@ -168,8 +174,10 @@ static int load_link(link_config_ctx *ctx, const char *filename) { link->wol = _WOL_INVALID; link->duplex = _DUP_INVALID; - r = config_parse(NULL, filename, file, "Match\0Link\0Ethernet\0", config_item_perf_lookup, - (void*) link_config_gperf_lookup, false, false, link); + r = config_parse(NULL, filename, file, + "Match\0Link\0Ethernet\0", + config_item_perf_lookup, link_config_gperf_lookup, + false, false, link); if (r < 0) { log_warning("Could not parse config file %s: %s", filename, strerror(-r)); return r; @@ -185,7 +193,7 @@ static int load_link(link_config_ctx *ctx, const char *filename) { } static bool enable_name_policy(void) { - _cleanup_free_ char *line; + _cleanup_free_ char *line = NULL; char *w, *state; int r; size_t l; @@ -377,7 +385,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev case MACPOLICY_PERSISTENT: if (mac_is_random(device)) { r = get_mac(device, false, &generated_mac); - if (r < 0) + if (r == -ENOENT) + break; + else if (r < 0) return r; mac = &generated_mac; } @@ -385,7 +395,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev case MACPOLICY_RANDOM: if (!mac_is_random(device)) { r = get_mac(device, true, &generated_mac); - if (r < 0) + if (r == -ENOENT) + break; + else if (r < 0) return r; mac = &generated_mac; }