summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-03-21 22:30:53 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-03-21 22:30:53 -0400
commit85d8f87e242378aa847d6498d98fb977c5c08213 (patch)
tree89af2437f2ec80a41576ce30180055fb8b830b73 /src/network
parente31512b1c93a7ebd7e67730ac6d5d9a15b9b51ab (diff)
parentafec45395fb019f19ac1e157fce9128b0137b25e (diff)
Merge pull request #2882 from systemd/revert-2818-master
Revert "DHCP DUID and IAID configurability"
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-conf.c133
-rw-r--r--src/network/networkd-conf.h32
-rw-r--r--src/network/networkd-dhcp4.c8
-rw-r--r--src/network/networkd-dhcp6.c10
-rw-r--r--src/network/networkd-gperf.gperf18
-rw-r--r--src/network/networkd-link.c18
-rw-r--r--src/network/networkd-manager.c2
-rw-r--r--src/network/networkd-network-gperf.gperf1
-rw-r--r--src/network/networkd-network.h2
-rw-r--r--src/network/networkd.c5
-rw-r--r--src/network/networkd.h5
11 files changed, 1 insertions, 233 deletions
diff --git a/src/network/networkd-conf.c b/src/network/networkd-conf.c
deleted file mode 100644
index 4bc92b8171..0000000000
--- a/src/network/networkd-conf.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2014 Tom Gundersen <teg@jklm.no>
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
- ***/
-
-#include <ctype.h>
-
-#include "conf-parser.h"
-#include "def.h"
-#include "dhcp-identifier.h"
-#include "networkd-conf.h"
-#include "string-table.h"
-
-int manager_parse_config_file(Manager *m) {
- assert(m);
-
- return config_parse_many(PKGSYSCONFDIR "/networkd.conf",
- CONF_PATHS_NULSTR("systemd/networkd.conf.d"),
- "DUID\0",
- config_item_perf_lookup, networkd_gperf_lookup,
- false, m);
-}
-
-static const char* const dhcp_duid_type_table[_DHCP_DUID_TYPE_MAX] = {
- [DHCP_DUID_TYPE_RAW] = "raw",
- [DHCP_DUID_TYPE_LLT] = "link-layer-time",
- [DHCP_DUID_TYPE_EN] = "vendor",
- [DHCP_DUID_TYPE_LL] = "link-layer",
- [DHCP_DUID_TYPE_UUID] = "uuid"
-};
-DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_duid_type, DHCPDUIDType);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_duid_type, dhcp_duid_type, DHCPDUIDType, "Failed to parse DHCP DUID type");
-
-int config_parse_dhcp_duid_raw(
- const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
- int r;
- long byte;
- char *cbyte, *pnext;
- const char *pduid = (const char *)rvalue;
- size_t count = 0, duid_len = 0;
- Manager *m = userdata;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(m);
- assert(m->dhcp_duid_type != _DHCP_DUID_TYPE_INVALID);
-
- switch (m->dhcp_duid_type) {
- case DHCP_DUID_TYPE_LLT:
- /* RawData contains DUID-LLT link-layer address (offset 6) */
- duid_len = 6;
- break;
- case DHCP_DUID_TYPE_EN:
- /* RawData contains DUID-EN identifier (offset 4) */
- duid_len = 4;
- break;
- case DHCP_DUID_TYPE_LL:
- /* RawData contains DUID-LL link-layer address (offset 2) */
- duid_len = 2;
- break;
- case DHCP_DUID_TYPE_UUID:
- /* RawData specifies UUID (offset 0) - fall thru */
- case DHCP_DUID_TYPE_RAW:
- /* First two bytes of RawData is DUID Type - fall thru */
- default:
- break;
- }
-
- if (m->dhcp_duid_type != DHCP_DUID_TYPE_RAW)
- m->dhcp_duid.type = htobe16(m->dhcp_duid_type);
-
- /* RawData contains DUID in format " NN:NN:NN... " */
- while (true) {
- r = extract_first_word(&pduid, &cbyte, ":", 0);
- if (r < 0) {
- log_error("Failed to read DUID.");
- return -EINVAL;
- }
- if (r == 0)
- break;
- if (duid_len >= MAX_DUID_LEN) {
- log_error("DUID length exceeds maximum length.");
- return -EINVAL;
- }
-
- errno = 0;
- byte = strtol(cbyte, &pnext, 16);
- if ((errno == ERANGE && (byte == LONG_MAX || byte == LONG_MIN))
- || (errno != 0 && byte == 0) || (cbyte == pnext)) {
- log_error("Invalid DUID byte: %s.", cbyte);
- return -EINVAL;
- }
-
- /* If DHCP_DUID_TYPE_RAW, first two bytes holds DUID Type */
- if ((m->dhcp_duid_type == DHCP_DUID_TYPE_RAW) && (count < 2)) {
- m->dhcp_duid.type |= (byte << (8 * count));
- count++;
- continue;
- }
-
- m->dhcp_duid.raw.data[duid_len++] = byte;
- }
-
- m->dhcp_duid_len = sizeof(m->dhcp_duid.type) + duid_len;
-
- return 0;
-}
diff --git a/src/network/networkd-conf.h b/src/network/networkd-conf.h
deleted file mode 100644
index 6d9ce010e3..0000000000
--- a/src/network/networkd-conf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#pragma once
-
-/***
- This file is part of systemd.
-
- Copyright 2014 Tom Gundersen <teg@jklm.no>
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "networkd.h"
-
-
-int manager_parse_config_file(Manager *m);
-
-const struct ConfigPerfItem* networkd_gperf_lookup(const char *key, unsigned length);
-
-int config_parse_dhcp_duid_type(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_dhcp_duid_raw(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 3bbb21295c..68998eabf2 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -625,13 +625,7 @@ int dhcp4_configure(Link *link) {
switch (link->network->dhcp_client_identifier) {
case DHCP_CLIENT_ID_DUID:
- /* If configured, apply user specified DUID and/or IAID */
- r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
- link->network->iaid_value,
- link->manager->dhcp_duid_len,
- &link->manager->dhcp_duid);
- if (r < 0)
- return r;
+ /* Library defaults to this. */
break;
case DHCP_CLIENT_ID_MAC:
r = sd_dhcp_client_set_client_id(link->dhcp_client,
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 9f59cb3f8a..5f7a005c36 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -230,16 +230,6 @@ int dhcp6_configure(Link *link) {
if (r < 0)
goto error;
- r = sd_dhcp6_client_set_iaid(client, link->network->iaid_value);
- if (r < 0)
- goto error;
-
- r = sd_dhcp6_client_set_duid(client,
- link->manager->dhcp_duid_len,
- &link->manager->dhcp_duid);
- if (r < 0)
- goto error;
-
r = sd_dhcp6_client_set_index(client, link->ifindex);
if (r < 0)
goto error;
diff --git a/src/network/networkd-gperf.gperf b/src/network/networkd-gperf.gperf
deleted file mode 100644
index 3ef4155476..0000000000
--- a/src/network/networkd-gperf.gperf
+++ /dev/null
@@ -1,18 +0,0 @@
-%{
-#include <stddef.h>
-#include "conf-parser.h"
-#include "networkd-conf.h"
-%}
-struct ConfigPerfItem;
-%null_strings
-%language=ANSI-C
-%define slot-name section_and_lvalue
-%define hash-function-name networkd_gperf_hash
-%define lookup-function-name networkd_gperf_lookup
-%readonly-tables
-%omit-struct-type
-%struct-type
-%includes
-%%
-DUID.Type, config_parse_dhcp_duid_type, 0, offsetof(Manager, dhcp_duid_type)
-DUID.RawData, config_parse_dhcp_duid_raw, 0, offsetof(Manager, dhcp_duid)
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 67b04560cd..ff4bd76554 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2781,13 +2781,6 @@ int link_update(Link *link, sd_netlink_message *m) {
ARPHRD_ETHER);
if (r < 0)
return log_link_warning_errno(link, r, "Could not update MAC address in DHCP client: %m");
-
- r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
- link->network->iaid_value,
- link->manager->dhcp_duid_len,
- &link->manager->dhcp_duid);
- if (r < 0)
- return log_link_warning_errno(link, r, "Could not update DUID/IAID in DHCP client: %m");
}
if (link->dhcp6_client) {
@@ -2797,17 +2790,6 @@ int link_update(Link *link, sd_netlink_message *m) {
ARPHRD_ETHER);
if (r < 0)
return log_link_warning_errno(link, r, "Could not update MAC address in DHCPv6 client: %m");
-
- r = sd_dhcp6_client_set_iaid(link->dhcp6_client,
- link->network->iaid_value);
- if (r < 0)
- return log_link_warning_errno(link, r, "Could not update DHCPv6 IAID: %m");
-
- r = sd_dhcp6_client_set_duid(link->dhcp6_client,
- link->manager->dhcp_duid_len,
- &link->manager->dhcp_duid);
- if (r < 0)
- return log_link_warning_errno(link, r, "Could not update DHCPv6 DUID: %m");
}
}
}
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 8d443f7b0f..b8cb7f875d 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -1037,8 +1037,6 @@ int manager_new(Manager **ret) {
if (r < 0)
return r;
- m->dhcp_duid_type = _DHCP_DUID_TYPE_INVALID;
-
*ret = m;
m = NULL;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 7a9a136d5b..a5d1714293 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -26,7 +26,6 @@ Match.KernelCommandLine, config_parse_net_condition,
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch)
Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
Link.MTUBytes, config_parse_iec_size, 0, offsetof(Network, mtu)
-Link.IAIDValue, config_parse_iaid_value, 0, offsetof(Network, iaid_value)
Network.Description, config_parse_string, 0, offsetof(Network, description)
Network.Bridge, config_parse_netdev, 0, offsetof(Network, bridge)
Network.Bond, config_parse_netdev, 0, offsetof(Network, bond)
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index c5530cdfba..4a13e2b574 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -30,7 +30,6 @@ typedef struct Network Network;
#include "networkd-route.h"
#include "networkd-util.h"
#include "networkd.h"
-#include "sparse-endian.h"
#define DHCP_ROUTE_METRIC 1024
#define IPV4LL_ROUTE_METRIC 2048
@@ -145,7 +144,6 @@ struct Network {
struct ether_addr *mac;
unsigned mtu;
- be32_t iaid_value;
LLDPMode lldp_mode; /* LLDP reception */
bool lldp_emit; /* LLDP transmission */
diff --git a/src/network/networkd.c b/src/network/networkd.c
index c8f81a2ca6..3a2615e6fd 100644
--- a/src/network/networkd.c
+++ b/src/network/networkd.c
@@ -21,7 +21,6 @@
#include "capability-util.h"
#include "networkd.h"
-#include "networkd-conf.h"
#include "signal-util.h"
#include "user-util.h"
@@ -90,10 +89,6 @@ int main(int argc, char *argv[]) {
goto out;
}
- r = manager_parse_config_file(m);
- if (r < 0)
- log_warning_errno(r, "Failed to parse configuration file: %m");
-
r = manager_load_config(m);
if (r < 0) {
log_error_errno(r, "Could not load configuration files: %m");
diff --git a/src/network/networkd.h b/src/network/networkd.h
index d815f30610..6bdd8302a0 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -35,7 +35,6 @@ typedef struct Manager Manager;
#include "networkd-link.h"
#include "networkd-network.h"
#include "networkd-util.h"
-#include "dhcp-identifier.h"
struct Manager {
sd_netlink *rtnl;
@@ -62,10 +61,6 @@ struct Manager {
LIST_HEAD(AddressPool, address_pools);
usec_t network_dirs_ts_usec;
-
- DHCPDUIDType dhcp_duid_type;
- size_t dhcp_duid_len;
- struct duid dhcp_duid;
};
extern const char* const network_dirs[];