static int dhcp6_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
                                 void *userdata) {
        _cleanup_link_unref_ Link *link = userdata;
        int r;

        assert(link);

        r = sd_rtnl_message_get_errno(m);
        if (r < 0 && r != -EEXIST) {
                if (link->rtnl_extended_attrs) {
                        log_link_warning(link, "Could not set extended netlink attributes, reverting to fallback mechanism");

                        link->rtnl_extended_attrs = false;
                        dhcp6_lease_address_acquired(link->dhcp6_client, link);

                        return 1;
                }

                log_link_error(link, "Could not set DHCPv6 address: %s",
                               strerror(-r));

                link_enter_failed(link);

        } else if (r >= 0)
                link_rtnl_process_address(rtnl, m, link->manager);

        return 1;
}
示例#2
0
static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
                                 void *userdata) {
    _cleanup_link_unref_ Link *link = userdata;
    int r;

    assert(link);

    r = sd_netlink_message_get_errno(m);
    if (r < 0 && r != -EEXIST) {
        log_link_error_errno(link, r, "Could not set DHCPv4 address: %m");
        link_enter_failed(link);
    } else if (r >= 0)
        link_rtnl_process_address(rtnl, m, link->manager);

    link_set_dhcp_routes(link);

    return 1;
}
static int dhcp6_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
                                 void *userdata) {
        _cleanup_link_unref_ Link *link = userdata;
        int r;

        assert(link);

        r = sd_rtnl_message_get_errno(m);
        if (r < 0 && r != -EEXIST) {
                log_link_error(link, "Could not set DHCPv6 address: %s",
                               strerror(-r));

                link_enter_failed(link);

        } else if (r >= 0)
                link_rtnl_process_address(rtnl, m, link->manager);

        return 1;
}
示例#4
0
static int ipv4ll_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
        _cleanup_link_unref_ Link *link = userdata;
        int r;

        assert(link);
        assert(!link->ipv4ll_address);

        r = sd_rtnl_message_get_errno(m);
        if (r < 0 && r != -EEXIST) {
                log_link_error(link, "could not set ipv4ll address: %s", strerror(-r));
                link_enter_failed(link);
        } else if (r >= 0)
                link_rtnl_process_address(rtnl, m, link->manager);

        link->ipv4ll_address = true;

        if (link->ipv4ll_route == true)
                link_client_handler(link);

        return 1;
}