X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-network%2Fdhcp-identifier.c;h=f7a1492363435d1e62b81f117dcc9295cf36fe70;hb=113b3fc1a8061f4a24dd0db74e9a3cd0083b2251;hp=5386dca9e2d4957087b84e354bb0299f71d9e800;hpb=cfb5b3805759e63dc5e0cae6e92e1df885b5c5b6;p=elogind.git
diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c
index 5386dca9e..f7a149236 100644
--- a/src/libsystemd-network/dhcp-identifier.c
+++ b/src/libsystemd-network/dhcp-identifier.c
@@ -19,7 +19,6 @@
along with systemd; If not, see .
***/
-#include
#include "sd-id128.h"
#include "libudev.h"
@@ -28,7 +27,6 @@
#include "virt.h"
#include "sparse-endian.h"
#include "siphash24.h"
-#include "util.h"
#include "dhcp6-protocol.h"
#include "dhcp-identifier.h"
@@ -78,20 +76,19 @@ int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, uint32_t
sprintf(ifindex_str, "n%d", ifindex);
device = udev_device_new_from_device_id(udev, ifindex_str);
- if (!device)
- return -errno;
+ if (device) {
+ if (udev_device_get_is_initialized(device) <= 0)
+ /* not yet ready */
+ return -EBUSY;
- if (udev_device_get_is_initialized(device) <= 0)
- /* not yet ready */
- return -EBUSY;
-
- name = net_get_name(device);
+ name = net_get_name(device);
+ }
}
if (name)
siphash24((uint8_t*)&id, name, strlen(name), HASH_KEY.bytes);
else
- /* fall back to mac address if no predictable name available */
+ /* fall back to MAC address if no predictable name available */
siphash24((uint8_t*)&id, mac, mac_len, HASH_KEY.bytes);
/* fold into 32 bits */