]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/udev/net/link-config.h
udev/net: introduce [Link] Property=, ImportProperty=, and UnsetProperty= settings
[thirdparty/systemd.git] / src / udev / net / link-config.h
index 38a02a75b90d4aa9582aa77345ae6daa0501e897..98cadc212e1fe9fe8380843eda3ba5ccc595a386 100644 (file)
@@ -7,8 +7,10 @@
 #include "condition.h"
 #include "conf-parser.h"
 #include "ethtool-util.h"
+#include "hashmap.h"
 #include "list.h"
 #include "net-condition.h"
+#include "netif-naming-scheme.h"
 
 typedef struct LinkConfigContext LinkConfigContext;
 typedef struct LinkConfig LinkConfig;
@@ -21,26 +23,39 @@ typedef enum MACAddressPolicy {
         _MAC_ADDRESS_POLICY_INVALID = -EINVAL,
 } MACAddressPolicy;
 
-typedef enum NamePolicy {
-        NAMEPOLICY_KERNEL,
-        NAMEPOLICY_KEEP,
-        NAMEPOLICY_DATABASE,
-        NAMEPOLICY_ONBOARD,
-        NAMEPOLICY_SLOT,
-        NAMEPOLICY_PATH,
-        NAMEPOLICY_MAC,
-        _NAMEPOLICY_MAX,
-        _NAMEPOLICY_INVALID = -EINVAL,
-} NamePolicy;
+typedef struct Link {
+        int ifindex;
+        const char *ifname;
+        const char *new_name;
+        char **altnames;
+
+        LinkConfig *config;
+        sd_device *device;
+        sd_device *device_db_clone;
+        sd_device_action_t action;
+
+        char *kind;
+        const char *driver;
+        uint16_t iftype;
+        uint32_t flags;
+        struct hw_addr_data hw_addr;
+        struct hw_addr_data permanent_hw_addr;
+        unsigned name_assign_type;
+        unsigned addr_assign_type;
+} Link;
 
 struct LinkConfig {
         char *filename;
+        char **dropins;
 
         NetMatch match;
         LIST_HEAD(Condition, conditions);
 
         char *description;
-        struct ether_addr *mac;
+        char **properties;
+        char **import_properties;
+        char **unset_properties;
+        struct hw_addr_data hw_addr;
         MACAddressPolicy mac_address_policy;
         NamePolicy *name_policy;
         NamePolicy *alternative_names_policy;
@@ -58,6 +73,8 @@ struct LinkConfig {
         int autonegotiation;
         uint32_t advertise[N_ADVERTISE];
         uint32_t wol;
+        char *wol_password_file;
+        uint8_t *wol_password;
         NetDevPort port;
         int features[_NET_DEV_FEAT_MAX];
         netdev_channels channels;
@@ -66,8 +83,12 @@ struct LinkConfig {
         int tx_flow_control;
         int autoneg_flow_control;
         netdev_coalesce_param coalesce;
+        uint8_t mdi;
 
-        LIST_FIELDS(LinkConfig, links);
+        uint32_t sr_iov_num_vfs;
+        OrderedHashmap *sr_iov_by_section;
+
+        LIST_FIELDS(LinkConfig, configs);
 };
 
 int link_config_ctx_new(LinkConfigContext **ret);
@@ -78,15 +99,12 @@ int link_load_one(LinkConfigContext *ctx, const char *filename);
 int link_config_load(LinkConfigContext *ctx);
 bool link_config_should_reload(LinkConfigContext *ctx);
 
-int link_config_get(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, LinkConfig **ret);
-int link_config_apply(LinkConfigContext *ctx, const LinkConfig *config, sd_netlink **rtnl, sd_device *device, const char **ret_name);
-int link_get_driver(LinkConfigContext *ctx, sd_device *device, char **ret);
-
-const char *name_policy_to_string(NamePolicy p) _const_;
-NamePolicy name_policy_from_string(const char *p) _pure_;
+int link_new(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, sd_device *device_db_clone, Link **ret);
+Link *link_free(Link *link);
+DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
 
-const char *alternative_names_policy_to_string(NamePolicy p) _const_;
-NamePolicy alternative_names_policy_from_string(const char *p) _pure_;
+int link_get_config(LinkConfigContext *ctx, Link *link);
+int link_apply_config(LinkConfigContext *ctx, sd_netlink **rtnl, Link *link, bool test);
 
 const char *mac_address_policy_to_string(MACAddressPolicy p) _const_;
 MACAddressPolicy mac_address_policy_from_string(const char *p) _pure_;
@@ -94,9 +112,12 @@ MACAddressPolicy mac_address_policy_from_string(const char *p) _pure_;
 /* gperf lookup function */
 const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
 
+CONFIG_PARSER_PROTOTYPE(config_parse_udev_property);
+CONFIG_PARSER_PROTOTYPE(config_parse_udev_property_name);
 CONFIG_PARSER_PROTOTYPE(config_parse_ifalias);
 CONFIG_PARSER_PROTOTYPE(config_parse_rx_tx_queues);
 CONFIG_PARSER_PROTOTYPE(config_parse_txqueuelen);
+CONFIG_PARSER_PROTOTYPE(config_parse_wol_password);
 CONFIG_PARSER_PROTOTYPE(config_parse_mac_address_policy);
 CONFIG_PARSER_PROTOTYPE(config_parse_name_policy);
 CONFIG_PARSER_PROTOTYPE(config_parse_alternative_names_policy);