2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2015-08-27 13:59:06 +02:00
|
|
|
#pragma once
|
|
|
|
|
2016-04-29 04:52:04 +02:00
|
|
|
#include "sd-bus.h"
|
2018-08-22 07:30:49 +02:00
|
|
|
#include "sd-device.h"
|
2016-04-29 04:52:04 +02:00
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
#include "condition.h"
|
2018-05-22 13:10:17 +02:00
|
|
|
#include "conf-parser.h"
|
2016-04-29 04:52:04 +02:00
|
|
|
#include "dhcp-identifier.h"
|
|
|
|
#include "hashmap.h"
|
2018-05-22 13:10:17 +02:00
|
|
|
#include "netdev/netdev.h"
|
2017-04-25 12:36:50 +02:00
|
|
|
#include "networkd-address-label.h"
|
2018-05-22 13:10:17 +02:00
|
|
|
#include "networkd-address.h"
|
2016-06-01 15:18:21 +02:00
|
|
|
#include "networkd-brvlan.h"
|
2015-08-27 13:59:06 +02:00
|
|
|
#include "networkd-fdb.h"
|
2017-02-11 00:47:55 +01:00
|
|
|
#include "networkd-ipv6-proxy-ndp.h"
|
2018-05-22 13:10:17 +02:00
|
|
|
#include "networkd-lldp-tx.h"
|
2018-11-29 04:00:58 +01:00
|
|
|
#include "networkd-neighbor.h"
|
2018-01-04 14:11:38 +01:00
|
|
|
#include "networkd-radv.h"
|
2015-11-18 22:46:33 +01:00
|
|
|
#include "networkd-route.h"
|
2017-09-14 21:51:39 +02:00
|
|
|
#include "networkd-routing-policy-rule.h"
|
2015-08-27 13:59:06 +02:00
|
|
|
#include "networkd-util.h"
|
2018-05-22 13:10:17 +02:00
|
|
|
#include "resolve-util.h"
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
#define DHCP_ROUTE_METRIC 1024
|
|
|
|
#define IPV4LL_ROUTE_METRIC 2048
|
|
|
|
|
2016-06-01 15:18:21 +02:00
|
|
|
#define BRIDGE_VLAN_BITMAP_MAX 4096
|
|
|
|
#define BRIDGE_VLAN_BITMAP_LEN (BRIDGE_VLAN_BITMAP_MAX / 32)
|
|
|
|
|
2017-08-15 06:50:25 +02:00
|
|
|
typedef enum DHCPClientIdentifier {
|
2015-08-27 13:59:06 +02:00
|
|
|
DHCP_CLIENT_ID_MAC,
|
|
|
|
DHCP_CLIENT_ID_DUID,
|
2018-03-12 17:18:07 +01:00
|
|
|
/* The following option may not be good for RFC regarding DHCP (3315 and 4361).
|
|
|
|
* But some setups require this. E.g., Sky Broadband, the second largest provider in the UK
|
|
|
|
* requires the client id to be set to a custom string, reported at
|
|
|
|
* https://github.com/systemd/systemd/issues/7828 */
|
|
|
|
DHCP_CLIENT_ID_DUID_ONLY,
|
2015-08-27 13:59:06 +02:00
|
|
|
_DHCP_CLIENT_ID_MAX,
|
|
|
|
_DHCP_CLIENT_ID_INVALID = -1,
|
2017-08-15 06:50:25 +02:00
|
|
|
} DHCPClientIdentifier;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
typedef enum IPv6PrivacyExtensions {
|
|
|
|
/* The values map to the kernel's /proc/sys/net/ipv6/conf/xxx/use_tempaddr values */
|
|
|
|
IPV6_PRIVACY_EXTENSIONS_NO,
|
|
|
|
IPV6_PRIVACY_EXTENSIONS_PREFER_PUBLIC,
|
|
|
|
IPV6_PRIVACY_EXTENSIONS_YES, /* aka prefer-temporary */
|
|
|
|
_IPV6_PRIVACY_EXTENSIONS_MAX,
|
|
|
|
_IPV6_PRIVACY_EXTENSIONS_INVALID = -1,
|
|
|
|
} IPv6PrivacyExtensions;
|
|
|
|
|
2016-01-25 22:27:01 +01:00
|
|
|
typedef enum DHCPUseDomains {
|
|
|
|
DHCP_USE_DOMAINS_NO,
|
|
|
|
DHCP_USE_DOMAINS_YES,
|
|
|
|
DHCP_USE_DOMAINS_ROUTE,
|
|
|
|
_DHCP_USE_DOMAINS_MAX,
|
|
|
|
_DHCP_USE_DOMAINS_INVALID = -1,
|
|
|
|
} DHCPUseDomains;
|
|
|
|
|
sd-lldp: rework sd-lldp API
This reworks the sd-lldp substantially, simplifying things on one hand, and
extending the logic a bit on the other.
Specifically:
- Besides the sd_lldp object only one other object is maintained now,
sd_lldp_neighbor. It's used both as storage for literal LLDP packets, and for
maintainging info about peers in the database. Separation between packet, TLV
and chassis data is not maintained anymore. This should be a major
simplification.
- The sd-lldp API has been extended so that a couple of per-neighbor fields may
be queried directly, without iterating through the object. Other fields that
may appear multiple times, OTOH have to be iterated through.
- The maximum number of entries in the neighbor database is now configurable
during runtime.
- The generation of callbacks from sd_lldp objects is more restricted:
callbacks are only invoked when actual data changed.
- The TTL information is now hooked with a timer event, so that removals from
the neighbor database due to TTLs now result in a callback event.
- Querying LLDP neighbor database will now return a strictly ordered array, to
guarantee stability.
- A "capabilities" mask may now be configured, that selects what type of LLDP
neighbor data is collected. This may be used to restrict collection of LLDP
info about routers instead of all neighbors. This is now exposed via
networkd's LLDP= setting.
- sd-lldp's API to serialize the collected data to text files has been removed.
Instead, there's now an API to extract the raw binary data from LLDP neighbor
objects, as well as one to convert this raw binary data back to an LLDP
neighbor object. networkd will save this raw binary data to /run now, and the
client side can simply parse the information.
- support for parsing the more exotic TLVs has been removed, since we are not
using that. Instead there are now APIs to extract the raw data from TLVs.
Given how easy it is to parse the TLVs clients should do so now directly
instead of relying on our APIs for that.
- A lot of the APIs that parse out LLDP strings have been simplified so that
they actually return strings, instead of char arrays with a length. To deal
with possibly dangerous characters the strings are escaped if needed.
- APIs to extract and format the chassis and port IDs as strings has been
added.
- lldp.h has been simplified a lot. The enums are anonymous now, since they
were never used as enums, but simply as constants. Most definitions we don't
actually use ourselves have eben removed.
2016-02-19 17:58:52 +01:00
|
|
|
typedef enum LLDPMode {
|
|
|
|
LLDP_MODE_NO = 0,
|
|
|
|
LLDP_MODE_YES = 1,
|
|
|
|
LLDP_MODE_ROUTERS_ONLY = 2,
|
|
|
|
_LLDP_MODE_MAX,
|
|
|
|
_LLDP_MODE_INVALID = -1,
|
|
|
|
} LLDPMode;
|
|
|
|
|
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
|
|
|
typedef struct DUID {
|
|
|
|
/* Value of Type in [DHCP] section */
|
|
|
|
DUIDType type;
|
|
|
|
|
|
|
|
uint8_t raw_data_len;
|
|
|
|
uint8_t raw_data[MAX_DUID_LEN];
|
2018-08-07 06:57:48 +02:00
|
|
|
usec_t llt_time;
|
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;
|
|
|
|
|
2018-01-04 14:11:39 +01:00
|
|
|
typedef enum RADVPrefixDelegation {
|
|
|
|
RADV_PREFIX_DELEGATION_NONE,
|
|
|
|
RADV_PREFIX_DELEGATION_STATIC,
|
|
|
|
RADV_PREFIX_DELEGATION_DHCP6,
|
|
|
|
RADV_PREFIX_DELEGATION_BOTH,
|
2018-11-01 19:15:25 +01:00
|
|
|
_RADV_PREFIX_DELEGATION_MAX,
|
|
|
|
_RADV_PREFIX_DELEGATION_INVALID = -1,
|
2018-01-04 14:11:39 +01:00
|
|
|
} RADVPrefixDelegation;
|
|
|
|
|
2017-02-15 05:30:35 +01:00
|
|
|
typedef struct NetworkConfigSection {
|
|
|
|
unsigned line;
|
|
|
|
char filename[];
|
|
|
|
} NetworkConfigSection;
|
|
|
|
|
|
|
|
int network_config_section_new(const char *filename, unsigned line, NetworkConfigSection **s);
|
|
|
|
void network_config_section_free(NetworkConfigSection *network);
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(NetworkConfigSection*, network_config_section_free);
|
2018-11-12 07:24:11 +01:00
|
|
|
extern const struct hash_ops network_config_hash_ops;
|
2017-02-15 05:30:35 +01:00
|
|
|
|
2016-04-29 04:52:04 +02:00
|
|
|
typedef struct Manager Manager;
|
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
struct Network {
|
|
|
|
Manager *manager;
|
|
|
|
|
|
|
|
char *filename;
|
|
|
|
char *name;
|
|
|
|
|
2018-05-09 04:59:18 +02:00
|
|
|
Set *match_mac;
|
2015-08-27 13:59:06 +02:00
|
|
|
char **match_path;
|
|
|
|
char **match_driver;
|
|
|
|
char **match_type;
|
|
|
|
char **match_name;
|
|
|
|
|
|
|
|
Condition *match_host;
|
|
|
|
Condition *match_virt;
|
core,udev,networkd: add ConditionKernelVersion=
This adds a simple condition/assert/match to the service manager, to
udev's .link handling and to networkd, for matching the kernel version
string.
In this version we only do fnmatch() based globbing, but we might want
to extend that to version comparisons later on, if we like, by slightly
extending the syntax with ">=", "<=", ">", "<" and "==" expressions.
2017-12-13 20:34:13 +01:00
|
|
|
Condition *match_kernel_cmdline;
|
|
|
|
Condition *match_kernel_version;
|
2015-08-27 13:59:06 +02:00
|
|
|
Condition *match_arch;
|
|
|
|
|
|
|
|
char *description;
|
|
|
|
|
|
|
|
NetDev *bridge;
|
|
|
|
NetDev *bond;
|
2016-06-13 01:05:49 +02:00
|
|
|
NetDev *vrf;
|
2015-08-27 13:59:06 +02:00
|
|
|
Hashmap *stacked_netdevs;
|
|
|
|
|
|
|
|
/* DHCP Client Support */
|
|
|
|
AddressFamilyBoolean dhcp;
|
2017-08-15 06:50:25 +02:00
|
|
|
DHCPClientIdentifier dhcp_client_identifier;
|
2015-08-27 13:59:06 +02:00
|
|
|
char *dhcp_vendor_class_identifier;
|
2018-05-07 14:21:02 +02:00
|
|
|
char **dhcp_user_class;
|
2016-01-25 21:47:02 +01:00
|
|
|
char *dhcp_hostname;
|
2016-11-18 17:01:32 +01:00
|
|
|
unsigned dhcp_route_metric;
|
|
|
|
uint32_t dhcp_route_table;
|
2016-12-06 12:22:33 +01:00
|
|
|
uint16_t dhcp_client_port;
|
2017-07-30 01:10:40 +02:00
|
|
|
bool dhcp_anonymize;
|
2016-01-25 21:47:02 +01:00
|
|
|
bool dhcp_send_hostname;
|
2015-08-27 13:59:06 +02:00
|
|
|
bool dhcp_broadcast;
|
|
|
|
bool dhcp_critical;
|
2016-11-18 17:01:32 +01:00
|
|
|
bool dhcp_use_dns;
|
|
|
|
bool dhcp_use_ntp;
|
|
|
|
bool dhcp_use_mtu;
|
2016-01-25 21:47:02 +01:00
|
|
|
bool dhcp_use_routes;
|
|
|
|
bool dhcp_use_timezone;
|
2018-01-22 09:09:18 +01:00
|
|
|
bool rapid_commit;
|
2016-11-18 17:01:32 +01:00
|
|
|
bool dhcp_use_hostname;
|
2017-09-07 11:08:39 +02:00
|
|
|
bool dhcp_route_table_set;
|
2016-11-18 17:01:32 +01:00
|
|
|
DHCPUseDomains dhcp_use_domains;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
/* DHCP Server Support */
|
|
|
|
bool dhcp_server;
|
2015-08-27 14:48:37 +02:00
|
|
|
bool dhcp_server_emit_dns;
|
|
|
|
struct in_addr *dhcp_server_dns;
|
|
|
|
unsigned n_dhcp_server_dns;
|
|
|
|
bool dhcp_server_emit_ntp;
|
|
|
|
struct in_addr *dhcp_server_ntp;
|
|
|
|
unsigned n_dhcp_server_ntp;
|
2016-05-18 01:34:25 +02:00
|
|
|
bool dhcp_server_emit_router;
|
2015-08-27 13:59:06 +02:00
|
|
|
bool dhcp_server_emit_timezone;
|
2015-08-27 14:48:37 +02:00
|
|
|
char *dhcp_server_timezone;
|
2015-08-27 13:59:06 +02:00
|
|
|
usec_t dhcp_server_default_lease_time_usec, dhcp_server_max_lease_time_usec;
|
2015-08-29 00:18:20 +02:00
|
|
|
uint32_t dhcp_server_pool_offset;
|
|
|
|
uint32_t dhcp_server_pool_size;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
/* IPV4LL Support */
|
|
|
|
AddressFamilyBoolean link_local;
|
|
|
|
bool ipv4ll_route;
|
|
|
|
|
2017-05-12 15:48:30 +02:00
|
|
|
/* IPv6 prefix delegation support */
|
2018-01-04 14:11:39 +01:00
|
|
|
RADVPrefixDelegation router_prefix_delegation;
|
2017-05-12 15:48:30 +02:00
|
|
|
usec_t router_lifetime_usec;
|
|
|
|
uint8_t router_preference;
|
|
|
|
bool router_managed;
|
|
|
|
bool router_other_information;
|
2017-09-29 10:10:19 +02:00
|
|
|
bool router_emit_dns;
|
|
|
|
bool router_emit_domains;
|
2017-08-14 11:53:10 +02:00
|
|
|
usec_t router_dns_lifetime_usec;
|
|
|
|
struct in6_addr *router_dns;
|
|
|
|
unsigned n_router_dns;
|
2017-08-16 12:29:51 +02:00
|
|
|
char **router_search_domains;
|
2018-09-07 22:15:55 +02:00
|
|
|
bool dhcp6_force_pd_other_information; /* Start DHCPv6 PD also when 'O'
|
|
|
|
RA flag is set, see RFC 7084,
|
|
|
|
WPD-4 */
|
2017-05-12 15:48:30 +02:00
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
/* Bridge Support */
|
2018-04-27 10:32:28 +02:00
|
|
|
int use_bpdu;
|
|
|
|
int hairpin;
|
|
|
|
int fast_leave;
|
|
|
|
int allow_port_to_be_root;
|
|
|
|
int unicast_flood;
|
2018-12-03 11:47:36 +01:00
|
|
|
int multicast_to_unicast;
|
2017-04-11 23:17:31 +02:00
|
|
|
uint32_t cost;
|
|
|
|
uint16_t priority;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2016-08-04 17:11:13 +02:00
|
|
|
bool use_br_vlan;
|
2016-06-01 15:18:21 +02:00
|
|
|
uint16_t pvid;
|
|
|
|
uint32_t br_vid_bitmap[BRIDGE_VLAN_BITMAP_LEN];
|
|
|
|
uint32_t br_untagged_bitmap[BRIDGE_VLAN_BITMAP_LEN];
|
|
|
|
|
2018-04-10 17:26:20 +02:00
|
|
|
/* CAN support */
|
|
|
|
size_t can_bitrate;
|
|
|
|
unsigned can_sample_point;
|
|
|
|
usec_t can_restart_us;
|
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
AddressFamilyBoolean ip_forward;
|
|
|
|
bool ip_masquerade;
|
|
|
|
|
2015-09-12 04:48:06 +02:00
|
|
|
int ipv6_accept_ra;
|
2015-10-12 11:01:10 +02:00
|
|
|
int ipv6_dad_transmits;
|
2015-11-10 04:56:38 +01:00
|
|
|
int ipv6_hop_limit;
|
2017-05-09 20:04:55 +02:00
|
|
|
int ipv6_proxy_ndp;
|
2016-04-14 11:56:57 +02:00
|
|
|
int proxy_arp;
|
2018-04-20 16:33:00 +02:00
|
|
|
uint32_t ipv6_mtu;
|
2015-09-12 04:48:06 +02:00
|
|
|
|
network: beef up ipv6 RA support considerably
This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:
- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
new configuration options have been added to networkd to make this
configurable.
- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
message, and has direct, friendly acessor functions for the singleton RA
properties, as well as an iterative interface to iterate through known and
unsupported options. The router object may either be retrieved from the wire,
or generated from raw data. In many ways the sd-ndisc API now matches the
sd-lldp API, except that no implicit database of seen data is kept. (Note
that sd-ndisc actually had a half-written, but unused implementaiton of such
a store, which is removed now.)
- sd-ndisc will now collect the reception timestamps of RA, which is useful to
make sd_ndisc_router fully descriptive of what it covers.
Fixes: #1079
2016-06-02 20:38:12 +02:00
|
|
|
bool ipv6_accept_ra_use_dns;
|
2016-12-21 19:10:36 +01:00
|
|
|
bool active_slave;
|
|
|
|
bool primary_slave;
|
network: beef up ipv6 RA support considerably
This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:
- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
new configuration options have been added to networkd to make this
configurable.
- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
message, and has direct, friendly acessor functions for the singleton RA
properties, as well as an iterative interface to iterate through known and
unsupported options. The router object may either be retrieved from the wire,
or generated from raw data. In many ways the sd-ndisc API now matches the
sd-lldp API, except that no implicit database of seen data is kept. (Note
that sd-ndisc actually had a half-written, but unused implementaiton of such
a store, which is removed now.)
- sd-ndisc will now collect the reception timestamps of RA, which is useful to
make sd_ndisc_router fully descriptive of what it covers.
Fixes: #1079
2016-06-02 20:38:12 +02:00
|
|
|
DHCPUseDomains ipv6_accept_ra_use_domains;
|
2016-09-19 04:59:11 +02:00
|
|
|
uint32_t ipv6_accept_ra_route_table;
|
network: beef up ipv6 RA support considerably
This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:
- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
new configuration options have been added to networkd to make this
configurable.
- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
message, and has direct, friendly acessor functions for the singleton RA
properties, as well as an iterative interface to iterate through known and
unsupported options. The router object may either be retrieved from the wire,
or generated from raw data. In many ways the sd-ndisc API now matches the
sd-lldp API, except that no implicit database of seen data is kept. (Note
that sd-ndisc actually had a half-written, but unused implementaiton of such
a store, which is removed now.)
- sd-ndisc will now collect the reception timestamps of RA, which is useful to
make sd_ndisc_router fully descriptive of what it covers.
Fixes: #1079
2016-06-02 20:38:12 +02:00
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
union in_addr_union ipv6_token;
|
|
|
|
IPv6PrivacyExtensions ipv6_privacy_extensions;
|
|
|
|
|
|
|
|
struct ether_addr *mac;
|
2018-04-20 16:33:00 +02:00
|
|
|
uint32_t mtu;
|
2016-08-04 16:00:58 +02:00
|
|
|
int arp;
|
2018-05-29 16:58:11 +02:00
|
|
|
int multicast;
|
2018-06-01 16:22:12 +02:00
|
|
|
int allmulticast;
|
2016-09-28 00:18:14 +02:00
|
|
|
bool unmanaged;
|
2017-09-06 16:57:04 +02:00
|
|
|
bool configure_without_carrier;
|
2016-03-31 01:33:55 +02:00
|
|
|
uint32_t iaid;
|
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;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2018-11-23 22:19:26 +01:00
|
|
|
bool iaid_set;
|
|
|
|
|
2017-11-30 18:03:50 +01:00
|
|
|
bool required_for_online; /* Is this network required to be considered online? */
|
|
|
|
|
2016-02-21 14:14:08 +01:00
|
|
|
LLDPMode lldp_mode; /* LLDP reception */
|
2016-05-06 21:27:36 +02:00
|
|
|
LLDPEmit lldp_emit; /* LLDP transmission */
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
LIST_HEAD(Address, static_addresses);
|
|
|
|
LIST_HEAD(Route, static_routes);
|
|
|
|
LIST_HEAD(FdbEntry, static_fdb_entries);
|
2017-02-11 00:47:55 +01:00
|
|
|
LIST_HEAD(IPv6ProxyNDPAddress, ipv6_proxy_ndp_addresses);
|
2018-11-29 04:00:58 +01:00
|
|
|
LIST_HEAD(Neighbor, neighbors);
|
2017-04-25 12:36:50 +02:00
|
|
|
LIST_HEAD(AddressLabel, address_labels);
|
2017-05-12 15:48:28 +02:00
|
|
|
LIST_HEAD(Prefix, static_prefixes);
|
2017-09-14 21:51:39 +02:00
|
|
|
LIST_HEAD(RoutingPolicyRule, rules);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2016-06-03 19:14:12 +02:00
|
|
|
unsigned n_static_addresses;
|
|
|
|
unsigned n_static_routes;
|
|
|
|
unsigned n_static_fdb_entries;
|
2017-02-11 00:47:55 +01:00
|
|
|
unsigned n_ipv6_proxy_ndp_addresses;
|
2018-11-29 04:00:58 +01:00
|
|
|
unsigned n_neighbors;
|
2017-04-25 12:36:50 +02:00
|
|
|
unsigned n_address_labels;
|
2017-05-12 15:48:28 +02:00
|
|
|
unsigned n_static_prefixes;
|
2017-09-14 21:51:39 +02:00
|
|
|
unsigned n_rules;
|
2016-06-03 19:14:12 +02:00
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
Hashmap *addresses_by_section;
|
|
|
|
Hashmap *routes_by_section;
|
|
|
|
Hashmap *fdb_entries_by_section;
|
2018-11-29 04:00:58 +01:00
|
|
|
Hashmap *neighbors_by_section;
|
2017-04-25 12:36:50 +02:00
|
|
|
Hashmap *address_labels_by_section;
|
2017-05-12 15:48:28 +02:00
|
|
|
Hashmap *prefixes_by_section;
|
2017-09-14 21:51:39 +02:00
|
|
|
Hashmap *rules_by_section;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2018-12-04 15:34:04 +01:00
|
|
|
/* All kinds of DNS configuration */
|
2016-11-18 17:04:26 +01:00
|
|
|
struct in_addr_data *dns;
|
|
|
|
unsigned n_dns;
|
2018-12-04 15:34:04 +01:00
|
|
|
char **search_domains, **route_domains;
|
|
|
|
int dns_default_route;
|
2015-08-27 13:59:06 +02:00
|
|
|
ResolveSupport llmnr;
|
2016-01-05 17:32:25 +01:00
|
|
|
ResolveSupport mdns;
|
2016-01-05 19:57:33 +01:00
|
|
|
DnssecMode dnssec_mode;
|
2018-06-13 20:26:24 +02:00
|
|
|
DnsOverTlsMode dns_over_tls_mode;
|
2016-01-06 18:36:32 +01:00
|
|
|
Set *dnssec_negative_trust_anchors;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2018-12-04 15:34:04 +01:00
|
|
|
char **ntp;
|
|
|
|
char **bind_carrier;
|
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
LIST_FIELDS(Network, networks);
|
|
|
|
};
|
|
|
|
|
|
|
|
void network_free(Network *network);
|
|
|
|
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(Network*, network_free);
|
|
|
|
|
|
|
|
int network_load(Manager *manager);
|
2018-11-04 22:27:07 +01:00
|
|
|
int network_load_one(Manager *manager, const char *filename);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
int network_get_by_name(Manager *manager, const char *name, Network **ret);
|
2018-08-22 07:30:49 +02:00
|
|
|
int network_get(Manager *manager, sd_device *device, const char *ifname, const struct ether_addr *mac, Network **ret);
|
2016-09-28 12:32:31 +02:00
|
|
|
int network_apply(Network *network, Link *link);
|
2017-08-03 01:10:51 +02:00
|
|
|
void network_apply_anonymize_if_set(Network *network);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2016-04-21 02:34:13 +02:00
|
|
|
bool network_has_static_ipv6_addresses(Network *network);
|
|
|
|
|
2018-05-22 13:10:17 +02:00
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_netdev);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_domains);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_tunnel);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dns);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_client_identifier);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6token);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_privacy_extensions);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_hostname);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_timezone);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_dns);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_ntp);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dnssec_negative_trust_anchors);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_domains);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_lldp_mode);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_route_table);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_user_class);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_ntp);
|
2018-11-23 22:19:26 +01:00
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_iaid);
|
2015-08-27 13:59:06 +02:00
|
|
|
/* Legacy IPv4LL support */
|
2018-05-22 13:10:17 +02:00
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_ipv4ll);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2017-01-10 08:39:05 +01:00
|
|
|
const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
extern const sd_bus_vtable network_vtable[];
|
|
|
|
|
|
|
|
int network_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
|
|
|
|
int network_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
|
|
|
|
|
|
|
|
const char* ipv6_privacy_extensions_to_string(IPv6PrivacyExtensions i) _const_;
|
|
|
|
IPv6PrivacyExtensions ipv6_privacy_extensions_from_string(const char *s) _pure_;
|
2016-01-25 22:27:01 +01:00
|
|
|
|
|
|
|
const char* dhcp_use_domains_to_string(DHCPUseDomains p) _const_;
|
|
|
|
DHCPUseDomains dhcp_use_domains_from_string(const char *s) _pure_;
|
sd-lldp: rework sd-lldp API
This reworks the sd-lldp substantially, simplifying things on one hand, and
extending the logic a bit on the other.
Specifically:
- Besides the sd_lldp object only one other object is maintained now,
sd_lldp_neighbor. It's used both as storage for literal LLDP packets, and for
maintainging info about peers in the database. Separation between packet, TLV
and chassis data is not maintained anymore. This should be a major
simplification.
- The sd-lldp API has been extended so that a couple of per-neighbor fields may
be queried directly, without iterating through the object. Other fields that
may appear multiple times, OTOH have to be iterated through.
- The maximum number of entries in the neighbor database is now configurable
during runtime.
- The generation of callbacks from sd_lldp objects is more restricted:
callbacks are only invoked when actual data changed.
- The TTL information is now hooked with a timer event, so that removals from
the neighbor database due to TTLs now result in a callback event.
- Querying LLDP neighbor database will now return a strictly ordered array, to
guarantee stability.
- A "capabilities" mask may now be configured, that selects what type of LLDP
neighbor data is collected. This may be used to restrict collection of LLDP
info about routers instead of all neighbors. This is now exposed via
networkd's LLDP= setting.
- sd-lldp's API to serialize the collected data to text files has been removed.
Instead, there's now an API to extract the raw binary data from LLDP neighbor
objects, as well as one to convert this raw binary data back to an LLDP
neighbor object. networkd will save this raw binary data to /run now, and the
client side can simply parse the information.
- support for parsing the more exotic TLVs has been removed, since we are not
using that. Instead there are now APIs to extract the raw data from TLVs.
Given how easy it is to parse the TLVs clients should do so now directly
instead of relying on our APIs for that.
- A lot of the APIs that parse out LLDP strings have been simplified so that
they actually return strings, instead of char arrays with a length. To deal
with possibly dangerous characters the strings are escaped if needed.
- APIs to extract and format the chassis and port IDs as strings has been
added.
- lldp.h has been simplified a lot. The enums are anonymous now, since they
were never used as enums, but simply as constants. Most definitions we don't
actually use ourselves have eben removed.
2016-02-19 17:58:52 +01:00
|
|
|
|
|
|
|
const char* lldp_mode_to_string(LLDPMode m) _const_;
|
|
|
|
LLDPMode lldp_mode_from_string(const char *s) _pure_;
|
2018-11-01 19:15:25 +01:00
|
|
|
|
|
|
|
const char* radv_prefix_delegation_to_string(RADVPrefixDelegation i) _const_;
|
|
|
|
RADVPrefixDelegation radv_prefix_delegation_from_string(const char *s) _pure_;
|