From: Yu Watanabe Date: Sat, 10 Apr 2021 04:31:08 +0000 (+0900) Subject: sd-dhcp6-client: do not use IN_SET() macro when only one target value X-Git-Tag: v249-rc1~440 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=080e5c2fdea83aee0f4f75b4224a16b951dbec69;p=thirdparty%2Fsystemd.git sd-dhcp6-client: do not use IN_SET() macro when only one target value --- diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index ff51758e0bc..6aca898d336 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -602,7 +602,7 @@ int dhcp6_option_parse_ia(sd_dhcp6_client *client, DHCP6Option *iaoption, DHCP6I case SD_DHCP6_OPTION_IA_PD_PREFIX: - if (!IN_SET(ia->type, SD_DHCP6_OPTION_IA_PD)) + if (ia->type != SD_DHCP6_OPTION_IA_PD) return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL), "IA PD Prefix option not in IA PD option"); diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index c8a4c79ffe6..10f82996c8c 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -161,7 +161,7 @@ int sd_dhcp6_client_set_callback( int sd_dhcp6_client_set_ifindex(sd_dhcp6_client *client, int ifindex) { assert_return(client, -EINVAL); assert_return(ifindex > 0, -EINVAL); - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); client->ifindex = ifindex; return 0; @@ -191,8 +191,7 @@ int sd_dhcp6_client_set_local_address( assert_return(client, -EINVAL); assert_return(local_address, -EINVAL); assert_return(in6_addr_is_link_local(local_address) > 0, -EINVAL); - - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); client->local_address = *local_address; @@ -207,8 +206,7 @@ int sd_dhcp6_client_set_mac( assert_return(client, -EINVAL); assert_return(addr, -EINVAL); assert_return(addr_len <= MAX_MAC_ADDR_LEN, -EINVAL); - - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); if (arp_type == ARPHRD_ETHER) assert_return(addr_len == ETH_ALEN, -EINVAL); @@ -238,8 +236,7 @@ int sd_dhcp6_client_set_prefix_delegation_hint( assert_return(client, -EINVAL); assert_return(pd_address, -EINVAL); - - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); client->hint_pd_prefix.iapdprefix.address = *pd_address; client->hint_pd_prefix.iapdprefix.prefixlen = prefixlen; @@ -284,7 +281,7 @@ static int dhcp6_client_set_duid_internal( assert_return(client, -EINVAL); assert_return(duid_len == 0 || duid != NULL, -EINVAL); - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); if (duid) { r = dhcp_validate_duid_len(duid_type, duid_len, true); @@ -393,7 +390,7 @@ int sd_dhcp6_client_duid_as_string( int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) { assert_return(client, -EINVAL); - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); client->ia_na.ia_na.id = htobe32(iaid); client->ia_pd.ia_pd.id = htobe32(iaid); @@ -430,7 +427,7 @@ int sd_dhcp6_client_set_fqdn( int sd_dhcp6_client_set_information_request(sd_dhcp6_client *client, int enabled) { assert_return(client, -EINVAL); - assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY); + assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY); client->information_request = enabled; @@ -1705,7 +1702,7 @@ int sd_dhcp6_client_start(sd_dhcp6_client *client) { assert_return(client->ifindex > 0, -EINVAL); assert_return(in6_addr_is_link_local(&client->local_address) > 0, -EINVAL); - if (!IN_SET(client->state, DHCP6_STATE_STOPPED)) + if (client->state != DHCP6_STATE_STOPPED) return -EBUSY; if (!client->information_request && !client->request)