]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: clean up duplicate code 862/head 877/head
authorAlex Crawford <alex.crawford@coreos.com>
Sat, 1 Aug 2015 04:48:47 +0000 (21:48 -0700)
committerAlex Crawford <alex.crawford@coreos.com>
Wed, 5 Aug 2015 16:00:57 +0000 (09:00 -0700)
src/libsystemd-network/sd-dhcp-lease.c

index 3d0c8ff890e2d7a058b06fe921c5b420b3cb4d46..0d1e3746aaacd67ddc4ef0081e319f53f8bf9b05 100644 (file)
@@ -943,19 +943,13 @@ int sd_dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
         }
 
         if (client_id_hex) {
-                if (strlen(client_id_hex) % 2)
-                        return -EINVAL;
-
-                r = unhexmem(client_id_hex, strlen(client_id_hex), (void**) &lease->client_id, &lease->client_id_len);
+                r = deserialize_dhcp_option(&lease->client_id, &lease->client_id_len, client_id_hex);
                 if (r < 0)
                         return r;
         }
 
         if (vendor_specific_hex) {
-                if (strlen(vendor_specific_hex) % 2)
-                        return -EINVAL;
-
-                r = unhexmem(vendor_specific_hex, strlen(vendor_specific_hex), (void**) &lease->vendor_specific, &lease->vendor_specific_len);
+                r = deserialize_dhcp_option(&lease->vendor_specific, &lease->vendor_specific_len, vendor_specific_hex);
                 if (r < 0)
                         return r;
         }