2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2016-02-16 20:05:15 +01:00
|
|
|
#pragma once
|
|
|
|
|
2015-11-18 22:46:33 +01:00
|
|
|
#include "sd-bus.h"
|
2018-10-08 15:47:10 +02:00
|
|
|
#include "sd-device.h"
|
2013-10-17 03:18:36 +02:00
|
|
|
#include "sd-event.h"
|
2018-07-02 20:19:15 +02:00
|
|
|
#include "sd-id128.h"
|
2015-06-12 16:31:33 +02:00
|
|
|
#include "sd-netlink.h"
|
2017-12-18 15:17:06 +01:00
|
|
|
#include "sd-resolve.h"
|
2013-10-17 03:18:36 +02:00
|
|
|
|
2016-04-29 04:52:04 +02:00
|
|
|
#include "dhcp-identifier.h"
|
2020-09-15 19:58:44 +02:00
|
|
|
#include "firewall-util.h"
|
2013-10-17 03:18:36 +02:00
|
|
|
#include "hashmap.h"
|
2015-08-27 13:59:06 +02:00
|
|
|
#include "networkd-link.h"
|
2015-11-18 22:46:33 +01:00
|
|
|
#include "networkd-network.h"
|
2020-10-02 07:46:29 +02:00
|
|
|
#include "ordered-set.h"
|
|
|
|
#include "set.h"
|
|
|
|
#include "time-util.h"
|
2014-06-18 18:22:14 +02:00
|
|
|
|
2013-10-17 03:18:36 +02:00
|
|
|
struct Manager {
|
2015-06-12 16:31:33 +02:00
|
|
|
sd_netlink *rtnl;
|
2017-12-18 15:17:06 +01:00
|
|
|
/* lazy initialized */
|
|
|
|
sd_netlink *genl;
|
2013-10-17 03:18:36 +02:00
|
|
|
sd_event *event;
|
2017-12-18 15:17:06 +01:00
|
|
|
sd_resolve *resolve;
|
2014-01-13 23:48:28 +01:00
|
|
|
sd_bus *bus;
|
2018-10-08 15:47:10 +02:00
|
|
|
sd_device_monitor *device_monitor;
|
2019-05-27 01:52:27 +02:00
|
|
|
Hashmap *polkit_registry;
|
2020-06-03 09:19:29 +02:00
|
|
|
int ethtool_fd;
|
2013-10-17 03:18:36 +02:00
|
|
|
|
2015-09-30 18:17:43 +02:00
|
|
|
bool enumerating:1;
|
|
|
|
bool dirty:1;
|
2019-10-01 16:23:19 +02:00
|
|
|
bool restarting:1;
|
2020-02-11 13:35:11 +01:00
|
|
|
bool manage_foreign_routes;
|
2015-09-30 18:17:43 +02:00
|
|
|
|
|
|
|
Set *dirty_links;
|
2015-02-04 10:08:12 +01:00
|
|
|
|
2014-05-08 17:21:37 +02:00
|
|
|
char *state_file;
|
2015-02-04 11:44:37 +01:00
|
|
|
LinkOperationalState operational_state;
|
2019-06-09 22:22:25 +02:00
|
|
|
LinkCarrierState carrier_state;
|
|
|
|
LinkAddressState address_state;
|
2014-05-08 17:21:37 +02:00
|
|
|
|
2013-10-17 03:18:36 +02:00
|
|
|
Hashmap *links;
|
2014-01-21 21:58:08 +01:00
|
|
|
Hashmap *netdevs;
|
2019-05-04 13:02:18 +02:00
|
|
|
OrderedHashmap *networks;
|
2018-01-04 14:11:58 +01:00
|
|
|
Hashmap *dhcp6_prefixes;
|
2020-07-22 20:13:42 +02:00
|
|
|
Set *dhcp6_pd_prefixes;
|
2020-10-02 07:46:29 +02:00
|
|
|
OrderedSet *address_pools;
|
2013-10-17 03:18:36 +02:00
|
|
|
|
|
|
|
usec_t network_dirs_ts_usec;
|
2016-03-31 01:33:55 +02:00
|
|
|
|
networkd: rework duid_{type,duid_type,duid,duid_len} setting
Separate fields are replaced with a struct.
Second second duid type field is removed. The first field was used to carry
the result of DUIDType= configuration, and the second was either a copy of
this, or contained the type extracted from DuidRawData. The semantics are changed
so that the type specified in DUIDType is always used. DUIDRawData= no longer
overrides the type setting.
The networkd code is now more constrained than the sd-dhcp code:
DUIDRawData cannot have 0 length, length 0 is treated the same as unsetting.
Likewise, it is not possible to set a DUIDType=0. If it ever becomes necessary
to set type=0 or a zero-length duid, the code can be changed to support that.
Nevertheless, I think that's unlikely.
This addresses #3127 § 1 and 3.
v2:
- rename DUID.duid, DUID.duid_len to DUID.raw_data, DUID.raw_data_len
2016-04-29 05:23:45 +02:00
|
|
|
DUID duid;
|
2018-07-02 20:19:15 +02:00
|
|
|
sd_id128_t product_uuid;
|
|
|
|
bool has_product_uuid;
|
|
|
|
Set *links_requesting_uuid;
|
|
|
|
Set *duids_requesting_uuid;
|
|
|
|
|
2016-11-22 08:36:20 +01:00
|
|
|
char* dynamic_hostname;
|
|
|
|
char* dynamic_timezone;
|
2017-09-14 21:51:39 +02:00
|
|
|
|
|
|
|
Set *rules;
|
|
|
|
Set *rules_foreign;
|
2019-02-18 07:00:15 +01:00
|
|
|
|
2020-10-07 02:41:52 +02:00
|
|
|
/* Manager stores routes without RTA_OIF attribute. */
|
|
|
|
Set *routes;
|
|
|
|
Set *routes_foreign;
|
|
|
|
|
2019-05-24 22:08:13 +02:00
|
|
|
/* For link speed meter*/
|
|
|
|
bool use_speed_meter;
|
|
|
|
sd_event_source *speed_meter_event_source;
|
|
|
|
usec_t speed_meter_interval_usec;
|
|
|
|
usec_t speed_meter_usec_new;
|
|
|
|
usec_t speed_meter_usec_old;
|
2019-07-22 04:25:31 +02:00
|
|
|
|
2020-09-17 11:02:09 +02:00
|
|
|
bool dhcp4_prefix_root_cannot_set_table:1;
|
|
|
|
bool bridge_mdb_on_master_not_supported:1;
|
2020-09-15 19:58:44 +02:00
|
|
|
|
|
|
|
FirewallContext *fw_ctx;
|
2013-10-17 03:18:36 +02:00
|
|
|
};
|
|
|
|
|
2018-07-18 05:37:50 +02:00
|
|
|
int manager_new(Manager **ret);
|
2013-10-17 03:18:36 +02:00
|
|
|
void manager_free(Manager *m);
|
|
|
|
|
2015-02-05 18:00:16 +01:00
|
|
|
int manager_connect_bus(Manager *m);
|
2016-11-28 20:42:40 +01:00
|
|
|
int manager_start(Manager *m);
|
2015-02-04 15:00:20 +01:00
|
|
|
|
2013-11-24 23:37:56 +01:00
|
|
|
int manager_load_config(Manager *m);
|
|
|
|
bool manager_should_reload(Manager *m);
|
|
|
|
|
2020-09-29 09:44:41 +02:00
|
|
|
int manager_enumerate(Manager *m);
|
2013-10-17 03:18:36 +02:00
|
|
|
|
2015-09-30 18:17:43 +02:00
|
|
|
void manager_dirty(Manager *m);
|
2014-01-05 23:01:10 +01:00
|
|
|
|
2015-08-27 16:45:24 +02:00
|
|
|
Link* manager_find_uplink(Manager *m, Link *exclude);
|
|
|
|
|
2016-11-21 23:15:41 +01:00
|
|
|
int manager_set_hostname(Manager *m, const char *hostname);
|
|
|
|
int manager_set_timezone(Manager *m, const char *timezone);
|
|
|
|
|
2013-10-17 03:18:36 +02:00
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
|