1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /***
3 Copyright © 2014 Vinay Kulkarni <kulkarniv@vmware.com>
4 ***/
5
6 #include "conf-parser.h"
7 #include "def.h"
8 #include "networkd-conf.h"
9 #include "networkd-manager.h"
10 #include "networkd-speed-meter.h"
11
manager_parse_config_file(Manager * m)12 int manager_parse_config_file(Manager *m) {
13 int r;
14
15 assert(m);
16
17 r = config_parse_many_nulstr(
18 PKGSYSCONFDIR "/networkd.conf",
19 CONF_PATHS_NULSTR("systemd/networkd.conf.d"),
20 "Network\0"
21 "DHCPv4\0"
22 "DHCPv6\0"
23 "DHCP\0",
24 config_item_perf_lookup, networkd_gperf_lookup,
25 CONFIG_PARSE_WARN,
26 m,
27 NULL);
28 if (r < 0)
29 return r;
30
31 if (m->use_speed_meter && m->speed_meter_interval_usec < SPEED_METER_MINIMUM_TIME_INTERVAL) {
32 log_warning("SpeedMeterIntervalSec= is too small, using %s.",
33 FORMAT_TIMESPAN(SPEED_METER_MINIMUM_TIME_INTERVAL, USEC_PER_SEC));
34 m->speed_meter_interval_usec = SPEED_METER_MINIMUM_TIME_INTERVAL;
35 }
36
37 return 0;
38 }
39