summaryrefslogtreecommitdiff
path: root/src/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h359
1 files changed, 57 insertions, 302 deletions
diff --git a/src/types.h b/src/types.h
index 27a23fc..e77a7f5 100644
--- a/src/types.h
+++ b/src/types.h
@@ -22,19 +22,10 @@
#include <yaml.h>
#include <uuid.h>
-typedef enum {
- NETPLAN_RA_MODE_KERNEL,
- NETPLAN_RA_MODE_ENABLED,
- NETPLAN_RA_MODE_DISABLED,
-} NetplanRAMode;
-
-typedef enum {
- NETPLAN_OPTIONAL_IPV4_LL = 1<<0,
- NETPLAN_OPTIONAL_IPV6_RA = 1<<1,
- NETPLAN_OPTIONAL_DHCP4 = 1<<2,
- NETPLAN_OPTIONAL_DHCP6 = 1<<3,
- NETPLAN_OPTIONAL_STATIC = 1<<4,
-} NetplanOptionalAddressFlag;
+/* Quite a few types are part of our current ABI, and so were isolated
+ * in order to make it easier to tell what's fair game and allow for ABI
+ * compatibility checks using 'abidiff' (abigail-tools). */
+#include "abi.h"
typedef enum {
NETPLAN_ADDRGEN_DEFAULT,
@@ -48,306 +39,34 @@ struct NetplanOptionalAddressType {
NetplanOptionalAddressFlag flag;
};
-// Not strictly speaking a type, but seems fair to keep it around.
-extern struct NetplanOptionalAddressType NETPLAN_OPTIONAL_ADDRESS_TYPES[];
-
-/* Tunnel mode enum; sync with NetworkManager's DBUS API */
-/* TODO: figure out whether networkd's GRETAP and NM's ISATAP
- * are the same thing.
- */
typedef enum {
- NETPLAN_TUNNEL_MODE_UNKNOWN = 0,
- NETPLAN_TUNNEL_MODE_IPIP = 1,
- NETPLAN_TUNNEL_MODE_GRE = 2,
- NETPLAN_TUNNEL_MODE_SIT = 3,
- NETPLAN_TUNNEL_MODE_ISATAP = 4, // NM only.
- NETPLAN_TUNNEL_MODE_VTI = 5,
- NETPLAN_TUNNEL_MODE_IP6IP6 = 6,
- NETPLAN_TUNNEL_MODE_IPIP6 = 7,
- NETPLAN_TUNNEL_MODE_IP6GRE = 8,
- NETPLAN_TUNNEL_MODE_VTI6 = 9,
-
- /* systemd-only, apparently? */
- NETPLAN_TUNNEL_MODE_GRETAP = 101,
- NETPLAN_TUNNEL_MODE_IP6GRETAP = 102,
- NETPLAN_TUNNEL_MODE_WIREGUARD = 103,
-
- NETPLAN_TUNNEL_MODE_MAX_,
-} NetplanTunnelMode;
+ NETPLAN_VXLAN_NOTIFICATION_L2_MISS = 1<<0,
+ NETPLAN_VXLAN_NOTIFICATION_L3_MISS = 1<<1,
+} NetplanVxlanNotificationFlags;
typedef enum {
- NETPLAN_WIFI_WOWLAN_DEFAULT = 1<<0,
- NETPLAN_WIFI_WOWLAN_ANY = 1<<1,
- NETPLAN_WIFI_WOWLAN_DISCONNECT = 1<<2,
- NETPLAN_WIFI_WOWLAN_MAGIC = 1<<3,
- NETPLAN_WIFI_WOWLAN_GTK_REKEY_FAILURE = 1<<4,
- NETPLAN_WIFI_WOWLAN_EAP_IDENTITY_REQ = 1<<5,
- NETPLAN_WIFI_WOWLAN_4WAY_HANDSHAKE = 1<<6,
- NETPLAN_WIFI_WOWLAN_RFKILL_RELEASE = 1<<7,
- NETPLAN_WIFI_WOWLAN_TCP = 1<<8,
-} NetplanWifiWowlanFlag;
-
-struct NetplanWifiWowlanType {
- char* name;
- NetplanWifiWowlanFlag flag;
-};
-
-extern struct NetplanWifiWowlanType NETPLAN_WIFI_WOWLAN_TYPES[];
+ NETPLAN_VXLAN_CHECKSUM_UDP = 1<<0,
+ NETPLAN_VXLAN_CHECKSUM_ZERO_UDP6_TX = 1<<1,
+ NETPLAN_VXLAN_CHECKSUM_ZERO_UDP6_RX = 1<<2,
+ NETPLAN_VXLAN_CHECKSUM_REMOTE_TX = 1<<3,
+ NETPLAN_VXLAN_CHECKSUM_REMOTE_RX = 1<<4,
+} NetplanVxlanChecksumFlags;
typedef enum {
- NETPLAN_AUTH_KEY_MANAGEMENT_NONE,
- NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSK,
- NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAP,
- NETPLAN_AUTH_KEY_MANAGEMENT_8021X,
- NETPLAN_AUTH_KEY_MANAGEMENT_MAX,
-} NetplanAuthKeyManagementType;
+ NETPLAN_VXLAN_EXTENSION_GROUP_POLICY = 1<<0,
+ NETPLAN_VXLAN_EXTENSION_GENERIC_PROTOCOL = 1<<1,
+} NetplanVxlanExtensionFlags;
-typedef enum {
- NETPLAN_AUTH_EAP_NONE,
- NETPLAN_AUTH_EAP_TLS,
- NETPLAN_AUTH_EAP_PEAP,
- NETPLAN_AUTH_EAP_TTLS,
- NETPLAN_AUTH_EAP_METHOD_MAX,
-} NetplanAuthEAPMethod;
+// Not strictly speaking a type, but seems fair to keep it around.
+extern struct NetplanOptionalAddressType NETPLAN_OPTIONAL_ADDRESS_TYPES[];
+
+extern struct NetplanWifiWowlanType NETPLAN_WIFI_WOWLAN_TYPES[];
typedef struct missing_node {
char* netdef_id;
const yaml_node_t* node;
} NetplanMissingNode;
-typedef struct authentication_settings {
- NetplanAuthKeyManagementType key_management;
- NetplanAuthEAPMethod eap_method;
- char* identity;
- char* anonymous_identity;
- char* password;
- char* ca_certificate;
- char* client_certificate;
- char* client_key;
- char* client_key_password;
- char* phase2_auth; /* netplan-feature: auth-phase2 */
-} NetplanAuthenticationSettings;
-
-/* Fields below are valid for dhcp4 and dhcp6 unless otherwise noted. */
-typedef struct dhcp_overrides {
- gboolean use_dns;
- gboolean use_ntp;
- gboolean send_hostname;
- gboolean use_hostname;
- gboolean use_mtu;
- gboolean use_routes;
- char* use_domains; /* netplan-feature: dhcp-use-domains */
- char* hostname;
- guint metric;
-} NetplanDHCPOverrides;
-
-typedef struct ovs_controller {
- char* connection_mode;
- GArray* addresses;
-} NetplanOVSController;
-
-typedef struct ovs_settings {
- GHashTable* external_ids;
- GHashTable* other_config;
- char* lacp;
- char* fail_mode;
- gboolean mcast_snooping;
- GArray* protocols;
- gboolean rstp;
- NetplanOVSController controller;
- NetplanAuthenticationSettings ssl;
-} NetplanOVSSettings;
-
-typedef union {
- struct NetplanNMSettings {
- char *name;
- char *uuid;
- char *stable_id;
- char *device;
- GData* passthrough; /* See g_datalist* functions */
- } nm;
- struct NetplanNetworkdSettings {
- char *unit;
- } networkd;
-} NetplanBackendSettings;
-
-struct netplan_net_definition {
- NetplanDefType type;
- NetplanBackend backend;
- char* id;
- /* only necessary for NetworkManager connection UUIDs in some cases */
- uuid_t uuid;
-
- /* status options */
- gboolean optional;
- NetplanOptionalAddressFlag optional_addresses;
- gboolean critical;
-
- /* addresses */
- gboolean dhcp4;
- gboolean dhcp6;
- char* dhcp_identifier;
- NetplanDHCPOverrides dhcp4_overrides;
- NetplanDHCPOverrides dhcp6_overrides;
- NetplanRAMode accept_ra;
- GArray* ip4_addresses;
- GArray* ip6_addresses;
- GArray* address_options;
- gboolean ip6_privacy;
- guint ip6_addr_gen_mode;
- char* ip6_addr_gen_token;
- char* gateway4;
- char* gateway6;
- GArray* ip4_nameservers;
- GArray* ip6_nameservers;
- GArray* search_domains;
- GArray* routes;
- GArray* ip_rules;
- GArray* wireguard_peers;
- struct {
- gboolean ipv4;
- gboolean ipv6;
- } linklocal;
-
- /* master ID for slave devices */
- char* bridge;
- char* bond;
-
- /* peer ID for OVS patch ports */
- char* peer;
-
- /* vlan */
- guint vlan_id;
- NetplanNetDefinition* vlan_link;
- gboolean has_vlans;
-
- /* Configured custom MAC address */
- char* set_mac;
-
- /* interface mtu */
- guint mtubytes;
- /* ipv6 mtu */
- /* netplan-feature: ipv6-mtu */
- guint ipv6_mtubytes;
-
- /* these properties are only valid for physical interfaces (type < ND_VIRTUAL) */
- char* set_name;
- struct {
- /* A glob (or tab-separated list of globs) to match a specific driver */
- char* driver;
- char* mac;
- char* original_name;
- } match;
- gboolean has_match;
- gboolean wake_on_lan;
- NetplanWifiWowlanFlag wowlan;
- gboolean emit_lldp;
-
- /* these properties are only valid for NETPLAN_DEF_TYPE_WIFI */
- GHashTable* access_points; /* SSID → NetplanWifiAccessPoint* */
-
- struct {
- char* mode;
- char* lacp_rate;
- char* monitor_interval;
- guint min_links;
- char* transmit_hash_policy;
- char* selection_logic;
- gboolean all_slaves_active;
- char* arp_interval;
- GArray* arp_ip_targets;
- char* arp_validate;
- char* arp_all_targets;
- char* up_delay;
- char* down_delay;
- char* fail_over_mac_policy;
- guint gratuitous_arp;
- /* TODO: unsolicited_na */
- guint packets_per_slave;
- char* primary_reselect_policy;
- guint resend_igmp;
- char* learn_interval;
- char* primary_slave;
- } bond_params;
-
- /* netplan-feature: modems */
- struct {
- char* apn;
- gboolean auto_config;
- char* device_id;
- char* network_id;
- char* number;
- char* password;
- char* pin;
- char* sim_id;
- char* sim_operator_id;
- char* username;
- } modem_params;
-
- struct {
- char* ageing_time;
- guint priority;
- guint port_priority;
- char* forward_delay;
- char* hello_time;
- char* max_age;
- guint path_cost;
- gboolean stp;
- } bridge_params;
- gboolean custom_bridging;
-
- struct {
- NetplanTunnelMode mode;
- char *local_ip;
- char *remote_ip;
- char *input_key;
- char *output_key;
- char *private_key; /* used for wireguard */
- guint fwmark;
- guint port;
- } tunnel;
-
- NetplanAuthenticationSettings auth;
- gboolean has_auth;
-
- /* these properties are only valid for SR-IOV NICs */
- /* netplan-feature: sriov */
- struct netplan_net_definition* sriov_link;
- gboolean sriov_vlan_filter;
- guint sriov_explicit_vf_count;
-
- /* these properties are only valid for OpenVSwitch */
- /* netplan-feature: openvswitch */
- NetplanOVSSettings ovs_settings;
-
- NetplanBackendSettings backend_settings;
-
- char* filename;
- /* it cannot be in the tunnel struct: https://github.com/canonical/netplan/pull/206 */
- guint tunnel_ttl;
-
- /* netplan-feature: activation-mode */
- char* activation_mode;
-
- /* configure without carrier */
- gboolean ignore_carrier;
-
- /* offload options */
- gboolean receive_checksum_offload;
- gboolean transmit_checksum_offload;
- gboolean tcp_segmentation_offload;
- gboolean tcp6_segmentation_offload;
- gboolean generic_segmentation_offload;
- gboolean generic_receive_offload;
- gboolean large_receive_offload;
-
- struct private_netdef_data* _private;
-
- /* netplan-feature: eswitch-mode */
- char* embedded_switch_mode;
- gboolean sriov_delay_virtual_functions_rebind;
-};
-
struct private_netdef_data {
GHashTable* dirty_fields;
};
@@ -430,6 +149,25 @@ typedef struct {
guint tos;
} NetplanIPRule;
+struct netplan_vxlan {
+ NetplanNetDefinition* link;
+ guint vni;
+ guint ageing;
+ guint limit;
+ guint tos;
+ guint flow_label;
+ guint source_port_min;
+ guint source_port_max;
+ gboolean mac_learning;
+ gboolean arp_proxy;
+ gboolean short_circuit;
+ gboolean independent;
+ NetplanFlags notifications;
+ NetplanFlags checksums;
+ NetplanFlags extensions;
+ NetplanTristate do_not_fragment;
+};
+
struct netplan_state {
/* Since both netdefs and netdefs_ordered store pointers to the same elements,
* we consider that only netdefs_ordered is owner of this data. One should not
@@ -440,6 +178,10 @@ struct netplan_state {
GList *netdefs_ordered;
NetplanBackend backend;
NetplanOVSSettings ovs_settings;
+
+ /* Hashset of the source files used to create this state. Owns its data (glib-allocated
+ * char*) and is initialized with g_hash_table_new_full to avoid leaks. */
+ GHashTable* sources;
};
struct netplan_parser {
@@ -453,6 +195,9 @@ struct netplan_parser {
NetplanBackend global_backend;
NetplanOVSSettings global_ovs_settings;
+ /* Keep track of the files used as data source */
+ GHashTable* sources;
+
/* Data currently being processed */
struct {
/* Refs to objects allocated elsewhere */
@@ -465,7 +210,8 @@ struct netplan_parser {
NetplanAddressOptions* addr_options;
NetplanIPRoute* route;
NetplanIPRule* ip_rule;
- const char *filename;
+ NetplanVxlan* vxlan;
+ const char *filepath;
/* Plain old data representing the backend for which we are
* currently parsing. Not necessarily the same as the global
@@ -491,6 +237,9 @@ struct netplan_parser {
* */
GHashTable* ids_in_file;
int missing_ids_found;
+
+ /* Which fields have been nullified by a subsequent patch? */
+ GHashTable* null_fields;
};
#define NETPLAN_ADVERTISED_RECEIVE_WINDOW_UNSPEC 0
@@ -506,9 +255,15 @@ void
reset_netdef(NetplanNetDefinition* netdef, NetplanDefType type, NetplanBackend renderer);
void
+reset_ip_rule(NetplanIPRule* ip_rule);
+
+void
reset_ovs_settings(NetplanOVSSettings *settings);
void
+reset_vxlan(NetplanVxlan* vxlan);
+
+void
access_point_clear(NetplanWifiAccessPoint** ap, NetplanBackend backend);
void