diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-22 15:31:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-22 15:31:55 +0200 |
commit | 9c90e27767697e01b0cfb9f345b928763942b731 (patch) | |
tree | b9a73972a13c83ceaab9a65ce31f515df90ac8f3 /src/network | |
parent | 85fade1edbc3d6ccf7e0685bbf4790f30d35009e (diff) | |
parent | 9ef61f2e4802abdb4a2853a82126420b1e77b419 (diff) |
Merge pull request #1333 from dvdhrm/sd-network-cleanup
sd-network: random API cleanups
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-dhcp4.c | 12 | ||||
-rw-r--r-- | src/network/networkd-dhcp6.c | 34 | ||||
-rw-r--r-- | src/network/networkd-ipv4ll.c | 6 | ||||
-rw-r--r-- | src/network/networkd-link.c | 15 |
4 files changed, 35 insertions, 32 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 4ffb01382f..04f04df117 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -471,9 +471,9 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) { return; switch (event) { - case DHCP_EVENT_EXPIRED: - case DHCP_EVENT_STOP: - case DHCP_EVENT_IP_CHANGE: + case SD_DHCP_CLIENT_EVENT_EXPIRED: + case SD_DHCP_CLIENT_EVENT_STOP: + case SD_DHCP_CLIENT_EVENT_IP_CHANGE: if (link->network->dhcp_critical) { log_link_error(link, "DHCPv4 connection considered system critical, ignoring request to reconfigure it."); return; @@ -487,7 +487,7 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) { } } - if (event == DHCP_EVENT_IP_CHANGE) { + if (event == SD_DHCP_CLIENT_EVENT_IP_CHANGE) { r = dhcp_lease_acquired(client, link); if (r < 0) { link_enter_failed(link); @@ -496,14 +496,14 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) { } break; - case DHCP_EVENT_RENEW: + case SD_DHCP_CLIENT_EVENT_RENEW: r = dhcp_lease_renew(client, link); if (r < 0) { link_enter_failed(link); return; } break; - case DHCP_EVENT_IP_ACQUIRE: + case SD_DHCP_CLIENT_EVENT_IP_ACQUIRE: r = dhcp_lease_acquired(client, link); if (r < 0) { link_enter_failed(link); diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 3a5ac1c39b..fca73b3154 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -84,8 +84,8 @@ static int dhcp6_address_update(Link *link, struct in6_addr *ip6_addr, addr->cinfo.ifa_valid = lifetime_valid; log_link_info(link, - "DHCPv6 address "SD_ICMP6_ADDRESS_FORMAT_STR"/%d timeout preferred %d valid %d", - SD_ICMP6_ADDRESS_FORMAT_VAL(addr->in_addr.in6), + "DHCPv6 address "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d timeout preferred %d valid %d", + SD_ICMP6_ND_ADDRESS_FORMAT_VAL(addr->in_addr.in6), addr->prefixlen, lifetime_preferred, lifetime_valid); r = address_update(addr, link, dhcp6_address_handler); @@ -144,13 +144,13 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) { return; switch(event) { - case DHCP6_EVENT_STOP: - case DHCP6_EVENT_RESEND_EXPIRE: - case DHCP6_EVENT_RETRANS_MAX: + case SD_DHCP6_CLIENT_EVENT_STOP: + case SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE: + case SD_DHCP6_CLIENT_EVENT_RETRANS_MAX: log_link_debug(link, "DHCPv6 event %d", event); break; - case DHCP6_EVENT_IP_ACQUIRE: + case SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE: r = dhcp6_lease_address_acquired(client, link); if (r < 0) { link_enter_failed(link); @@ -158,7 +158,7 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) { } /* fall through */ - case DHCP6_EVENT_INFORMATION_REQUEST: + case SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST: r = dhcp6_lease_information_acquired(client, link); if (r < 0) { link_enter_failed(link); @@ -185,7 +185,7 @@ static int dhcp6_configure(Link *link, int event) { assert_return(link, -EINVAL); if (link->dhcp6_client) { - if (event != ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED) + if (event != SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED) return 0; r = sd_dhcp6_client_get_information_request(link->dhcp6_client, @@ -254,7 +254,7 @@ static int dhcp6_configure(Link *link, int event) { return r; } - if (event == ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER) { + if (event == SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER) { r = sd_dhcp6_client_set_information_request(link->dhcp6_client, true); if (r < 0) { @@ -287,8 +287,8 @@ static int dhcp6_prefix_expired(Link *link) { if (r < 0) return r; - log_link_info(link, "IPv6 prefix "SD_ICMP6_ADDRESS_FORMAT_STR"/%d expired", - SD_ICMP6_ADDRESS_FORMAT_VAL(*expired_prefix), + log_link_info(link, "IPv6 prefix "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d expired", + SD_ICMP6_ND_ADDRESS_FORMAT_VAL(*expired_prefix), expired_prefixlen); sd_dhcp6_lease_reset_address_iter(lease); @@ -302,7 +302,7 @@ static int dhcp6_prefix_expired(Link *link) { if (r < 0) continue; - log_link_info(link, "IPv6 prefix length updated "SD_ICMP6_ADDRESS_FORMAT_STR"/%d", SD_ICMP6_ADDRESS_FORMAT_VAL(ip6_addr), 128); + log_link_info(link, "IPv6 prefix length updated "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d", SD_ICMP6_ND_ADDRESS_FORMAT_VAL(ip6_addr), 128); dhcp6_address_update(link, &ip6_addr, 128, lifetime_preferred, lifetime_valid); } @@ -321,17 +321,17 @@ static void icmp6_router_handler(sd_icmp6_nd *nd, int event, void *userdata) { return; switch(event) { - case ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE: + case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE: return; - case ICMP6_EVENT_ROUTER_ADVERTISMENT_TIMEOUT: - case ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER: - case ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED: + case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_TIMEOUT: + case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER: + case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED: dhcp6_configure(link, event); break; - case ICMP6_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED: + case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED: if (!link->rtnl_extended_attrs) dhcp6_prefix_expired(link); diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c index 1c34f55b4b..af3e3884e6 100644 --- a/src/network/networkd-ipv4ll.c +++ b/src/network/networkd-ipv4ll.c @@ -179,15 +179,15 @@ static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata){ return; switch(event) { - case IPV4LL_EVENT_STOP: - case IPV4LL_EVENT_CONFLICT: + case SD_IPV4LL_EVENT_STOP: + case SD_IPV4LL_EVENT_CONFLICT: r = ipv4ll_address_lost(link); if (r < 0) { link_enter_failed(link); return; } break; - case IPV4LL_EVENT_BIND: + case SD_IPV4LL_EVENT_BIND: r = ipv4ll_address_claimed(ll, link); if (r < 0) { link_enter_failed(link); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 215c47b8af..86f1c3bb1a 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1112,13 +1112,16 @@ static void lldp_handler(sd_lldp *lldp, int event, void *userdata) { assert(link->network); assert(link->manager); - if (event != UPDATE_INFO) - return; - - r = sd_lldp_save(link->lldp, link->lldp_file); - if (r < 0) - log_link_warning_errno(link, r, "Could not save LLDP: %m"); + switch (event) { + case SD_LLDP_EVENT_UPDATE_INFO: + r = sd_lldp_save(link->lldp, link->lldp_file); + if (r < 0) + log_link_warning_errno(link, r, "Could not save LLDP: %m"); + break; + default: + break; + } } static int link_acquire_conf(Link *link) { |