summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-05-04 11:31:59 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-04 11:31:59 +0200
commit5119d304ffe4d1bcac27626c842413f5f2defe0d (patch)
tree885cf6798f613b967fe2c0acd387af9cc371761a /src/network/networkd-link.c
parentf8e2f4d6a0c6bcb5a03abe580d657b932cdb9798 (diff)
parent7c285c74190e827c18a336f882cf4d9dcf4ee02a (diff)
Merge pull request #3156 from keszybz/duid-settings
Rework DUID setting
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 5fc513bfda..c646af1f1a 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -28,9 +28,8 @@
#include "fileio.h"
#include "netlink-util.h"
#include "network-internal.h"
-#include "networkd-link.h"
+#include "networkd.h"
#include "networkd-lldp-tx.h"
-#include "networkd-netdev.h"
#include "set.h"
#include "socket-util.h"
#include "stdio-util.h"
@@ -2880,6 +2879,8 @@ int link_update(Link *link, sd_netlink_message *m) {
}
if (link->dhcp_client) {
+ const DUID *duid = link_duid(link);
+
r = sd_dhcp_client_set_mac(link->dhcp_client,
(const uint8_t *) &link->mac,
sizeof (link->mac),
@@ -2887,23 +2888,18 @@ int link_update(Link *link, sd_netlink_message *m) {
if (r < 0)
return log_link_warning_errno(link, r, "Could not update MAC address in DHCP client: %m");
- if (link->network->duid_type != _DUID_TYPE_INVALID)
- r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
- link->network->iaid,
- link->network->dhcp_duid_type,
- link->network->dhcp_duid,
- link->network->dhcp_duid_len);
- else
- r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
- link->network->iaid,
- link->manager->dhcp_duid_type,
- link->manager->dhcp_duid,
- link->manager->dhcp_duid_len);
+ r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
+ link->network->iaid,
+ duid->type,
+ duid->raw_data_len > 0 ? duid->raw_data : NULL,
+ duid->raw_data_len);
if (r < 0)
return log_link_warning_errno(link, r, "Could not update DUID/IAID in DHCP client: %m");
}
if (link->dhcp6_client) {
+ const DUID* duid = link_duid(link);
+
r = sd_dhcp6_client_set_mac(link->dhcp6_client,
(const uint8_t *) &link->mac,
sizeof (link->mac),
@@ -2916,16 +2912,10 @@ int link_update(Link *link, sd_netlink_message *m) {
if (r < 0)
return log_link_warning_errno(link, r, "Could not update DHCPv6 IAID: %m");
- if (link->network->duid_type != _DUID_TYPE_INVALID)
- r = sd_dhcp6_client_set_duid(link->dhcp6_client,
- link->network->dhcp_duid_type,
- link->network->dhcp_duid,
- link->network->dhcp_duid_len);
- else
- r = sd_dhcp6_client_set_duid(link->dhcp6_client,
- link->manager->dhcp_duid_type,
- link->manager->dhcp_duid,
- link->manager->dhcp_duid_len);
+ r = sd_dhcp6_client_set_duid(link->dhcp6_client,
+ duid->type,
+ duid->raw_data_len > 0 ? duid->raw_data : NULL,
+ duid->raw_data_len);
if (r < 0)
return log_link_warning_errno(link, r, "Could not update DHCPv6 DUID: %m");
}