%struct-type
%includes
%%
-Match.MACAddress, config_parse_hwaddrs, 0, offsetof(link_config, match.mac)
-Match.PermanentMACAddress, config_parse_hwaddrs, 0, offsetof(link_config, match.permanent_mac)
-Match.OriginalName, config_parse_match_ifnames, 0, offsetof(link_config, match.ifname)
-Match.Path, config_parse_match_strv, 0, offsetof(link_config, match.path)
-Match.Driver, config_parse_match_strv, 0, offsetof(link_config, match.driver)
-Match.Type, config_parse_match_strv, 0, offsetof(link_config, match.iftype)
-Match.Property, config_parse_match_property, 0, offsetof(link_config, match.property)
-Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(link_config, conditions)
-Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(link_config, conditions)
-Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(link_config, conditions)
-Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(link_config, conditions)
-Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(link_config, conditions)
-Link.Description, config_parse_string, 0, offsetof(link_config, description)
-Link.MACAddressPolicy, config_parse_mac_address_policy, 0, offsetof(link_config, mac_address_policy)
-Link.MACAddress, config_parse_hwaddr, 0, offsetof(link_config, mac)
-Link.NamePolicy, config_parse_name_policy, 0, offsetof(link_config, name_policy)
-Link.Name, config_parse_ifname, 0, offsetof(link_config, name)
-Link.AlternativeName, config_parse_ifnames, IFNAME_VALID_ALTERNATIVE, offsetof(link_config, alternative_names)
-Link.AlternativeNamesPolicy, config_parse_alternative_names_policy, 0, offsetof(link_config, alternative_names_policy)
-Link.Alias, config_parse_ifalias, 0, offsetof(link_config, alias)
-Link.TransmitQueues, config_parse_rx_tx_queues, 0, offsetof(link_config, txqueues)
-Link.ReceiveQueues, config_parse_rx_tx_queues, 0, offsetof(link_config, rxqueues)
-Link.TransmitQueueLength, config_parse_txqueuelen, 0, offsetof(link_config, txqueuelen)
-Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(link_config, mtu)
-Link.BitsPerSecond, config_parse_si_uint64, 0, offsetof(link_config, speed)
-Link.Duplex, config_parse_duplex, 0, offsetof(link_config, duplex)
-Link.AutoNegotiation, config_parse_tristate, 0, offsetof(link_config, autonegotiation)
-Link.WakeOnLan, config_parse_wol, 0, offsetof(link_config, wol)
-Link.Port, config_parse_port, 0, offsetof(link_config, port)
-Link.ReceiveChecksumOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_RX])
-Link.TransmitChecksumOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TX])
-Link.GenericSegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_GSO])
-Link.TCPSegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TSO])
-Link.TCP6SegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TSO6])
+Match.MACAddress, config_parse_hwaddrs, 0, offsetof(LinkConfig, match.mac)
+Match.PermanentMACAddress, config_parse_hwaddrs, 0, offsetof(LinkConfig, match.permanent_mac)
+Match.OriginalName, config_parse_match_ifnames, 0, offsetof(LinkConfig, match.ifname)
+Match.Path, config_parse_match_strv, 0, offsetof(LinkConfig, match.path)
+Match.Driver, config_parse_match_strv, 0, offsetof(LinkConfig, match.driver)
+Match.Type, config_parse_match_strv, 0, offsetof(LinkConfig, match.iftype)
+Match.Property, config_parse_match_property, 0, offsetof(LinkConfig, match.property)
+Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(LinkConfig, conditions)
+Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(LinkConfig, conditions)
+Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(LinkConfig, conditions)
+Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(LinkConfig, conditions)
+Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(LinkConfig, conditions)
+Link.Description, config_parse_string, 0, offsetof(LinkConfig, description)
+Link.MACAddressPolicy, config_parse_mac_address_policy, 0, offsetof(LinkConfig, mac_address_policy)
+Link.MACAddress, config_parse_hwaddr, 0, offsetof(LinkConfig, mac)
+Link.NamePolicy, config_parse_name_policy, 0, offsetof(LinkConfig, name_policy)
+Link.Name, config_parse_ifname, 0, offsetof(LinkConfig, name)
+Link.AlternativeName, config_parse_ifnames, IFNAME_VALID_ALTERNATIVE, offsetof(LinkConfig, alternative_names)
+Link.AlternativeNamesPolicy, config_parse_alternative_names_policy, 0, offsetof(LinkConfig, alternative_names_policy)
+Link.Alias, config_parse_ifalias, 0, offsetof(LinkConfig, alias)
+Link.TransmitQueues, config_parse_rx_tx_queues, 0, offsetof(LinkConfig, txqueues)
+Link.ReceiveQueues, config_parse_rx_tx_queues, 0, offsetof(LinkConfig, rxqueues)
+Link.TransmitQueueLength, config_parse_txqueuelen, 0, offsetof(LinkConfig, txqueuelen)
+Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(LinkConfig, mtu)
+Link.BitsPerSecond, config_parse_si_uint64, 0, offsetof(LinkConfig, speed)
+Link.Duplex, config_parse_duplex, 0, offsetof(LinkConfig, duplex)
+Link.AutoNegotiation, config_parse_tristate, 0, offsetof(LinkConfig, autonegotiation)
+Link.WakeOnLan, config_parse_wol, 0, offsetof(LinkConfig, wol)
+Link.Port, config_parse_port, 0, offsetof(LinkConfig, port)
+Link.ReceiveChecksumOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_RX])
+Link.TransmitChecksumOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TX])
+Link.GenericSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GSO])
+Link.TCPSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TSO])
+Link.TCP6SegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TSO6])
Link.UDPSegmentationOffload, config_parse_warn_compat, DISABLED_LEGACY, 0
-Link.GenericReceiveOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_GRO])
-Link.LargeReceiveOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_LRO])
-Link.RxChannels, config_parse_channel, 0, offsetof(link_config, channels)
-Link.TxChannels, config_parse_channel, 0, offsetof(link_config, channels)
-Link.OtherChannels, config_parse_channel, 0, offsetof(link_config, channels)
-Link.CombinedChannels, config_parse_channel, 0, offsetof(link_config, channels)
-Link.Advertise, config_parse_advertise, 0, offsetof(link_config, advertise)
-Link.RxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
-Link.RxMiniBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
-Link.RxJumboBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
-Link.TxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
-Link.RxFlowControl, config_parse_tristate, 0, offsetof(link_config, rx_flow_control)
-Link.TxFlowControl, config_parse_tristate, 0, offsetof(link_config, tx_flow_control)
-Link.AutoNegotiationFlowControl, config_parse_tristate, 0, offsetof(link_config, autoneg_flow_control)
-Link.GenericSegmentOffloadMaxBytes, config_parse_iec_size, 0, offsetof(link_config, gso_max_size)
-Link.GenericSegmentOffloadMaxSegments, config_parse_uint32, 0, offsetof(link_config, gso_max_segments)
+Link.GenericReceiveOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GRO])
+Link.LargeReceiveOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_LRO])
+Link.RxChannels, config_parse_channel, 0, offsetof(LinkConfig, channels)
+Link.TxChannels, config_parse_channel, 0, offsetof(LinkConfig, channels)
+Link.OtherChannels, config_parse_channel, 0, offsetof(LinkConfig, channels)
+Link.CombinedChannels, config_parse_channel, 0, offsetof(LinkConfig, channels)
+Link.Advertise, config_parse_advertise, 0, offsetof(LinkConfig, advertise)
+Link.RxBufferSize, config_parse_nic_buffer_size, 0, offsetof(LinkConfig, ring)
+Link.RxMiniBufferSize, config_parse_nic_buffer_size, 0, offsetof(LinkConfig, ring)
+Link.RxJumboBufferSize, config_parse_nic_buffer_size, 0, offsetof(LinkConfig, ring)
+Link.TxBufferSize, config_parse_nic_buffer_size, 0, offsetof(LinkConfig, ring)
+Link.RxFlowControl, config_parse_tristate, 0, offsetof(LinkConfig, rx_flow_control)
+Link.TxFlowControl, config_parse_tristate, 0, offsetof(LinkConfig, tx_flow_control)
+Link.AutoNegotiationFlowControl, config_parse_tristate, 0, offsetof(LinkConfig, autoneg_flow_control)
+Link.GenericSegmentOffloadMaxBytes, config_parse_iec_size, 0, offsetof(LinkConfig, gso_max_size)
+Link.GenericSegmentOffloadMaxSegments, config_parse_uint32, 0, offsetof(LinkConfig, gso_max_segments)
#include "utf8.h"
struct LinkConfigContext {
- LIST_HEAD(link_config, links);
+ LIST_HEAD(LinkConfig, links);
int ethtool_fd;
bool enable_name_policy;
sd_netlink *rtnl;
usec_t network_dirs_ts_usec;
};
-static link_config* link_config_free(link_config *link) {
+static LinkConfig* link_config_free(LinkConfig *link) {
if (!link)
return NULL;
return mfree(link);
}
-DEFINE_TRIVIAL_CLEANUP_FUNC(link_config*, link_config_free);
+DEFINE_TRIVIAL_CLEANUP_FUNC(LinkConfig*, link_config_free);
static void link_configs_free(LinkConfigContext *ctx) {
- link_config *link, *link_next;
+ LinkConfig *link, *link_next;
if (!ctx)
return;
}
int link_load_one(LinkConfigContext *ctx, const char *filename) {
- _cleanup_(link_config_freep) link_config *link = NULL;
+ _cleanup_(link_config_freep) LinkConfig *link = NULL;
_cleanup_free_ char *name = NULL;
const char *dropin_dirname;
size_t i;
if (!name)
return -ENOMEM;
- link = new(link_config, 1);
+ link = new(LinkConfig, 1);
if (!link)
return -ENOMEM;
- *link = (link_config) {
+ *link = (LinkConfig) {
.filename = TAKE_PTR(name),
.mac_address_policy = _MAC_ADDRESS_POLICY_INVALID,
.wol = _WOL_INVALID,
return paths_check_timestamp(NETWORK_DIRS, &ctx->network_dirs_ts_usec, false);
}
-int link_config_get(LinkConfigContext *ctx, sd_device *device, link_config **ret) {
+int link_config_get(LinkConfigContext *ctx, sd_device *device, LinkConfig **ret) {
unsigned name_assign_type = NET_NAME_UNKNOWN;
struct ether_addr permanent_mac = {};
unsigned short iftype = 0;
- link_config *link;
+ LinkConfig *link;
const char *name;
int ifindex, r;
return -ENOENT;
}
-static int link_config_apply_ethtool_settings(int *ethtool_fd, const link_config *config, sd_device *device) {
+static int link_config_apply_ethtool_settings(int *ethtool_fd, const LinkConfig *config, sd_device *device) {
const char *name;
int r;
return 1;
}
-static int link_config_apply_rtnl_settings(sd_netlink **rtnl, const link_config *config, sd_device *device) {
+static int link_config_apply_rtnl_settings(sd_netlink **rtnl, const LinkConfig *config, sd_device *device) {
struct ether_addr generated_mac, *mac = NULL;
int ifindex, r;
return 0;
}
-static int link_config_generate_new_name(const LinkConfigContext *ctx, const link_config *config, sd_device *device, const char **ret_name) {
+static int link_config_generate_new_name(const LinkConfigContext *ctx, const LinkConfig *config, sd_device *device, const char **ret_name) {
unsigned name_type = NET_NAME_UNKNOWN;
int r;
return 0;
}
-static int link_config_apply_alternative_names(sd_netlink **rtnl, const link_config *config, sd_device *device, const char *new_name) {
+static int link_config_apply_alternative_names(sd_netlink **rtnl, const LinkConfig *config, sd_device *device, const char *new_name) {
_cleanup_strv_free_ char **altnames = NULL, **current_altnames = NULL;
const char *current_name;
int ifindex, r;
return 0;
}
-int link_config_apply(LinkConfigContext *ctx, const link_config *config, sd_device *device, const char **ret_name) {
+int link_config_apply(LinkConfigContext *ctx, const LinkConfig *config, sd_device *device, const char **ret_name) {
const char *new_name;
sd_device_action_t a;
int r;