From: Zbigniew Jędrzejewski-Szmek Date: Thu, 23 Aug 2018 09:11:13 +0000 (+0200) Subject: Merge pull request #9406 from yuwata/rfe-9228 X-Git-Tag: v240~807 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c07fe6d0df3e433b579c9cb8b8ea9cfb2fb62173;p=thirdparty%2Fsystemd.git Merge pull request #9406 from yuwata/rfe-9228 Trivial conflict solved in merge and include net/if_arp.h added. --- c07fe6d0df3e433b579c9cb8b8ea9cfb2fb62173 diff --cc src/libsystemd-network/dhcp-identifier.c index d1e929ba7b2,a8ed98f29a9..531cf6783bf --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/dhcp-identifier.c @@@ -1,6 -1,8 +1,9 @@@ /* SPDX-License-Identifier: LGPL-2.1+ */ + #include ++#include + -#include "libudev.h" +#include "sd-device.h" #include "sd-id128.h" #include "dhcp-identifier.h" @@@ -8,10 -10,13 +11,12 @@@ #include "network-internal.h" #include "siphash24.h" #include "sparse-endian.h" -#include "udev-util.h" #include "virt.h" - #define SYSTEMD_PEN 43793 - #define HASH_KEY SD_ID128_MAKE(80,11,8c,c2,fe,4a,03,ee,3e,d6,0c,6f,36,39,14,09) + #define SYSTEMD_PEN 43793 + #define HASH_KEY SD_ID128_MAKE(80,11,8c,c2,fe,4a,03,ee,3e,d6,0c,6f,36,39,14,09) + #define APPLICATION_ID SD_ID128_MAKE(a5,0a,d1,12,bf,60,45,77,a2,fb,74,1a,b1,95,5b,03) + #define USEC_2000 ((usec_t) 946684800000000) /* 2000-01-01 00:00:00 UTC */ int dhcp_validate_duid_len(uint16_t duid_type, size_t duid_len) { struct duid d; @@@ -69,10 -124,29 +124,29 @@@ int dhcp_identifier_set_duid_en(struct return 0; } + int dhcp_identifier_set_duid_uuid(struct duid *duid, size_t *len) { + sd_id128_t machine_id; + int r; + + assert(duid); + assert(len); + + r = sd_id128_get_machine_app_specific(APPLICATION_ID, &machine_id); + if (r < 0) + return r; + + unaligned_write_be16(&duid->type, DUID_TYPE_UUID); + memcpy(&duid->raw.data, &machine_id, sizeof(machine_id)); + + *len = sizeof(duid->type) + sizeof(machine_id); + + return 0; + } + int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, void *_id) { - /* name is a pointer to memory in the udev_device struct, so must - have the same scope */ - _cleanup_(udev_device_unrefp) struct udev_device *device = NULL; + /* name is a pointer to memory in the sd_device struct, so must + * have the same scope */ + _cleanup_(sd_device_unrefp) sd_device *device = NULL; const char *name = NULL; uint64_t id; diff --cc src/network/networkd-manager.h index edaafb6a066,410e00da638..fbfcdad3041 --- a/src/network/networkd-manager.h +++ b/src/network/networkd-manager.h @@@ -5,9 -5,10 +5,10 @@@ #include "sd-bus.h" #include "sd-event.h" + #include "sd-id128.h" #include "sd-netlink.h" #include "sd-resolve.h" -#include "udev.h" +#include "libudev.h" #include "dhcp-identifier.h" #include "hashmap.h"