X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-network%2Fnetwork-internal.c;h=f3dc42f6dd94660645c44a9ce2be84ae59a232cc;hb=9bdb98c59451ed090f8d35d470a54710f389ce71;hp=3686267b073168bf1e953b99aed73f6af09d1ea0;hpb=9f2a50a3005a771a3b6cea2136b6a6c7e5686a0e;p=elogind.git diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 3686267b0..f3dc42f6d 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -79,7 +79,7 @@ bool net_match_config(const struct ether_addr *match_mac, Condition *match_virt, Condition *match_kernel, Condition *match_arch, - const char *dev_mac, + const struct ether_addr *dev_mac, const char *dev_path, const char *dev_parent_driver, const char *dev_driver, @@ -98,7 +98,7 @@ bool net_match_config(const struct ether_addr *match_mac, if (match_arch && !condition_test_architecture(match_arch)) return 0; - if (match_mac && (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN))) + if (match_mac && (!dev_mac || memcmp(match_mac, dev_mac, ETH_ALEN))) return 0; if (match_path && (!dev_path || fnmatch(match_path, dev_path, 0))) @@ -326,3 +326,38 @@ int net_parse_inaddr(const char *address, unsigned char *family, void *dst) { return 0; } + +int load_module(struct kmod_ctx *ctx, const char *mod_name) { + struct kmod_list *modlist = NULL, *l; + int r; + + assert(ctx); + assert(mod_name); + + r = kmod_module_new_from_lookup(ctx, mod_name, &modlist); + if (r < 0) + return r; + + if (!modlist) { + log_error("Failed to find module '%s'", mod_name); + return -ENOENT; + } + + kmod_list_foreach(l, modlist) { + struct kmod_module *mod = kmod_module_get_module(l); + + r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); + if (r == 0) + log_info("Inserted module '%s'", kmod_module_get_name(mod)); + else { + log_error("Failed to insert '%s': %s", kmod_module_get_name(mod), + strerror(-r)); + } + + kmod_module_unref(mod); + } + + kmod_module_unref_list(modlist); + + return r; +}