mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
sd-dhcp: drop deserialize_dhcp_option() as it is equivalent to unhexmem()
This commit is contained in:
parent
509685f91a
commit
ce088d6fb4
@ -656,14 +656,3 @@ int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t siz
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int deserialize_dhcp_option(void **data, size_t *data_len, const char *string) {
|
||||
assert(data);
|
||||
assert(data_len);
|
||||
assert(string);
|
||||
|
||||
if (strlen(string) % 2)
|
||||
return -EINVAL;
|
||||
|
||||
return unhexmem(string, strlen(string), (void **)data, data_len);
|
||||
}
|
||||
|
@ -78,5 +78,5 @@ struct sd_dhcp_route;
|
||||
void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, size_t size);
|
||||
int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t *ret_allocated, const char *string);
|
||||
|
||||
/* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
|
||||
int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
|
||||
int deserialize_dhcp_option(void **data, size_t *data_len, const char *string);
|
||||
|
@ -1193,13 +1193,13 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
|
||||
}
|
||||
|
||||
if (client_id_hex) {
|
||||
r = deserialize_dhcp_option(&lease->client_id, &lease->client_id_len, client_id_hex);
|
||||
r = unhexmem(client_id_hex, (size_t) -1, &lease->client_id, &lease->client_id_len);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to parse client ID %s, ignoring: %m", client_id_hex);
|
||||
}
|
||||
|
||||
if (vendor_specific_hex) {
|
||||
r = deserialize_dhcp_option(&lease->vendor_specific, &lease->vendor_specific_len, vendor_specific_hex);
|
||||
r = unhexmem(vendor_specific_hex, (size_t) -1, &lease->vendor_specific, &lease->vendor_specific_len);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to parse vendor specific data %s, ignoring: %m", vendor_specific_hex);
|
||||
}
|
||||
@ -1211,7 +1211,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
|
||||
if (!options[i])
|
||||
continue;
|
||||
|
||||
r = deserialize_dhcp_option(&data, &len, options[i]);
|
||||
r = unhexmem(options[i], (size_t) -1, &data, &len);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to parse private DHCP option %s, ignoring: %m", options[i]);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user