summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp6-client.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-04-02 01:11:32 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-03 19:23:03 +0900
commit2f53b311c3d0e51d9ed5944ef6a24e64f4e6a950 (patch)
treefee5818bd2f7ac466606e93afba8f34d36421630 /src/libsystemd-network/sd-dhcp6-client.c
parentfbe043001581df609eae40e0d2f2319d52b5237a (diff)
downloadsystemd-2f53b311c3d0e51d9ed5944ef6a24e64f4e6a950.tar.gz
sd-dhcp6-client: rename req_opts_len -> n_req_opts
As 'len' is confusing and we may misunderstand it as the size of the buffer instead of the number of options.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 27864a0a49..e3e18b5826 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -380,14 +380,14 @@ int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client, uint16_t option)
if (!dhcp6_option_can_request(option))
return -EINVAL;
- for (t = 0; t < client->req_opts_len; t++)
+ for (t = 0; t < client->n_req_opts; t++)
if (client->req_opts[t] == htobe16(option))
return -EEXIST;
- if (!GREEDY_REALLOC(client->req_opts, client->req_opts_len + 1))
+ if (!GREEDY_REALLOC(client->req_opts, client->n_req_opts + 1))
return -ENOMEM;
- client->req_opts[client->req_opts_len++] = htobe16(option);
+ client->req_opts[client->n_req_opts++] = htobe16(option);
return 0;
}
@@ -713,7 +713,7 @@ int dhcp6_client_send_message(sd_dhcp6_client *client) {
}
r = dhcp6_option_append(&opt, &optlen, SD_DHCP6_OPTION_ORO,
- client->req_opts_len * sizeof(be16_t),
+ client->n_req_opts * sizeof(be16_t),
client->req_opts);
if (r < 0)
return r;
@@ -1414,7 +1414,6 @@ DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp6_client, sd_dhcp6_client, dhcp6_client_fre
int sd_dhcp6_client_new(sd_dhcp6_client **ret) {
_cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL;
_cleanup_free_ be16_t *req_opts = NULL;
- size_t t;
assert_return(ret, -EINVAL);
@@ -1422,7 +1421,7 @@ int sd_dhcp6_client_new(sd_dhcp6_client **ret) {
if (!req_opts)
return -ENOMEM;
- for (t = 0; t < ELEMENTSOF(default_req_opts); t++)
+ for (size_t t = 0; t < ELEMENTSOF(default_req_opts); t++)
req_opts[t] = htobe16(default_req_opts[t]);
client = new(sd_dhcp6_client, 1);
@@ -1436,7 +1435,7 @@ int sd_dhcp6_client_new(sd_dhcp6_client **ret) {
.ifindex = -1,
.request_ia = DHCP6_REQUEST_IA_NA | DHCP6_REQUEST_IA_PD,
.fd = -1,
- .req_opts_len = ELEMENTSOF(default_req_opts),
+ .n_req_opts = ELEMENTSOF(default_req_opts),
.req_opts = TAKE_PTR(req_opts),
};