diff options
author | Susant Sahani <susant@redhat.com> | 2015-03-09 15:28:29 +0530 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-04-20 20:14:34 +0200 |
commit | 81bd37a85fed090350a84db1f0741125582d160e (patch) | |
tree | e3387ad5f1d14c2a4c620fce4e07c126b9daa54c /src | |
parent | cffacc741cb79f63999720525ceaa65aae01a542 (diff) |
networkd: Add support for bond option.
This patch adds configurational support for bond option.
Test conf:
bond.netdev
---
[NetDev]
Name=bond1
Kind=bond
[Bond]
ArpAllTargets=all
PrimaryReselect=better
ArpIntervalSec=10s
ArpIpTargets= 192.168.8.102 192.168.8.101 192.168.8.102
---
$cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
ARP Polling Interval (ms): 10000
ARP IP target/s (n.n.n.n form): 192.168.8.100, 192.168.8.101, 192.168.8.102
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-types.c | 26 | ||||
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-types.h | 22 | ||||
-rw-r--r-- | src/network/networkd-netdev-bond.c | 318 | ||||
-rw-r--r-- | src/network/networkd-netdev-bond.h | 85 | ||||
-rw-r--r-- | src/network/networkd-netdev-gperf.gperf | 13 |
5 files changed, 460 insertions, 4 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 49784bf6c6..a5c9fdf66a 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -90,6 +90,30 @@ static const NLType rtnl_link_info_data_vxlan_types[IFLA_VXLAN_MAX+1] = { [IFLA_VXLAN_L3MISS] = { .type = NLA_U8 }, }; +static const NLType rtnl_bond_arp_target_types[BOND_ARP_TARGETS_MAX + 1] = { + [BOND_ARP_TARGETS_0] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_1] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_2] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_3] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_4] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_5] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_6] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_7] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_8] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_9] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_10] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_11] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_12] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_13] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_14] = { .type = NLA_U32 }, + [BOND_ARP_TARGETS_MAX] = { .type = NLA_U32 }, +}; + +static const NLTypeSystem rtnl_bond_arp_type_system = { + .max = ELEMENTSOF(rtnl_bond_arp_target_types) - 1, + .types = rtnl_bond_arp_target_types, +}; + static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { [IFLA_BOND_MODE] = { .type = NLA_U8 }, [IFLA_BOND_ACTIVE_SLAVE] = { .type = NLA_U32 }, @@ -98,7 +122,7 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { [IFLA_BOND_DOWNDELAY] = { .type = NLA_U32 }, [IFLA_BOND_USE_CARRIER] = { .type = NLA_U8 }, [IFLA_BOND_ARP_INTERVAL] = { .type = NLA_U32 }, - [IFLA_BOND_ARP_IP_TARGET] = { .type = NLA_NESTED }, + [IFLA_BOND_ARP_IP_TARGET] = { .type = NLA_NESTED, .type_system = &rtnl_bond_arp_type_system }, [IFLA_BOND_ARP_VALIDATE] = { .type = NLA_U32 }, [IFLA_BOND_ARP_ALL_TARGETS] = { .type = NLA_U32 }, [IFLA_BOND_PRIMARY] = { .type = NLA_U32 }, diff --git a/src/libsystemd/sd-rtnl/rtnl-types.h b/src/libsystemd/sd-rtnl/rtnl-types.h index 1ab9444987..72773eaa66 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.h +++ b/src/libsystemd/sd-rtnl/rtnl-types.h @@ -94,3 +94,25 @@ typedef enum NLUnionLinkInfoData { const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_; NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_; + +/* Maximum ARP IP target defined in kernel */ +#define BOND_MAX_ARP_TARGETS 16 + +typedef enum BondArpTargets { + BOND_ARP_TARGETS_0, + BOND_ARP_TARGETS_1, + BOND_ARP_TARGETS_2, + BOND_ARP_TARGETS_3, + BOND_ARP_TARGETS_4, + BOND_ARP_TARGETS_5, + BOND_ARP_TARGETS_6, + BOND_ARP_TARGETS_7, + BOND_ARP_TARGETS_8, + BOND_ARP_TARGETS_9, + BOND_ARP_TARGETS_10, + BOND_ARP_TARGETS_11, + BOND_ARP_TARGETS_12, + BOND_ARP_TARGETS_13, + BOND_ARP_TARGETS_14, + BOND_ARP_TARGETS_MAX = BOND_MAX_ARP_TARGETS, +} BondArpTargets; diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c index c9115516fd..70df08a5e1 100644 --- a/src/network/networkd-netdev-bond.c +++ b/src/network/networkd-netdev-bond.c @@ -25,9 +25,41 @@ #include "conf-parser.h" #include "sd-rtnl.h" +#include "rtnl-types.h" #include "networkd-netdev-bond.h" #include "missing.h" +/* + * Number of seconds between instances where the bonding + * driver sends learning packets to each slaves peer switch + */ +#define LEARNING_PACKETS_INTERVAL_MIN_SEC (1 * USEC_PER_SEC) +#define LEARNING_PACKETS_INTERVAL_MAX_SEC (0x7fffffff * USEC_PER_SEC) + +/* Number of IGMP membership reports to be issued after + * a failover event. + */ +#define RESEND_IGMP_MIN 0 +#define RESEND_IGMP_MAX 255 +#define RESEND_IGMP_DEFAULT 1 + +/* + * Number of packets to transmit through a slave before + * moving to the next one. + */ +#define PACKETS_PER_SLAVE_MIN 0 +#define PACKETS_PER_SLAVE_MAX 65535 +#define PACKETS_PER_SLAVE_DEFAULT 1 + +/* + * Number of peer notifications (gratuitous ARPs and + * unsolicited IPv6 Neighbor Advertisements) to be issued after a + * failover event. + */ +#define GRATUITOUS_ARP_MIN 0 +#define GRATUITOUS_ARP_MAX 255 +#define GRATUITOUS_ARP_DEFAULT 1 + static const char* const bond_mode_table[_NETDEV_BOND_MODE_MAX] = { [NETDEV_BOND_MODE_BALANCE_RR] = "balance-rr", [NETDEV_BOND_MODE_ACTIVE_BACKUP] = "active-backup", @@ -41,7 +73,6 @@ static const char* const bond_mode_table[_NETDEV_BOND_MODE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(bond_mode, BondMode); DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_mode, bond_mode, BondMode, "Failed to parse bond mode"); - static const char* const bond_xmit_hash_policy_table[_NETDEV_BOND_XMIT_HASH_POLICY_MAX] = { [NETDEV_BOND_XMIT_HASH_POLICY_LAYER2] = "layer2", [NETDEV_BOND_XMIT_HASH_POLICY_LAYER34] = "layer3+4", @@ -64,6 +95,51 @@ static const char* const bond_lacp_rate_table[_NETDEV_BOND_LACP_RATE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(bond_lacp_rate, BondLacpRate); DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_lacp_rate, bond_lacp_rate, BondLacpRate, "Failed to parse bond lacp rate") +static const char* const bond_ad_select_table[_NETDEV_BOND_AD_SELECT_MAX] = { + [NETDEV_BOND_AD_SELECT_STABLE] = "stable", + [NETDEV_BOND_AD_SELECT_BANDWIDTH] = "bandwidth", + [NETDEV_BOND_AD_SELECT_COUNT] = "count", +}; + +DEFINE_STRING_TABLE_LOOKUP(bond_ad_select, BondAdSelect); +DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_ad_select, bond_ad_select, BondAdSelect, "Failed to parse bond AD select"); + +static const char* const bond_fail_over_mac_table[_NETDEV_BOND_FAIL_OVER_MAC_MAX] = { + [NETDEV_BOND_FAIL_OVER_MAC_NONE] = "none", + [NETDEV_BOND_FAIL_OVER_MAC_ACTIVE] = "active", + [NETDEV_BOND_FAIL_OVER_MAC_FOLLOW] = "follow", +}; + +DEFINE_STRING_TABLE_LOOKUP(bond_fail_over_mac, BondFailOverMac); +DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_fail_over_mac, bond_fail_over_mac, BondFailOverMac, "Failed to parse bond fail over MAC"); + +static const char *const bond_arp_validate_table[_NETDEV_BOND_ARP_VALIDATE_MAX] = { + [NETDEV_BOND_ARP_VALIDATE_NONE] = "none", + [NETDEV_BOND_ARP_VALIDATE_ACTIVE]= "active", + [NETDEV_BOND_ARP_VALIDATE_BACKUP]= "backup", + [NETDEV_BOND_ARP_VALIDATE_ALL]= "all", +}; + +DEFINE_STRING_TABLE_LOOKUP(bond_arp_validate, BondArpValidate); +DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_validate, bond_arp_validate, BondArpValidate, "Failed to parse bond arp validate"); + +static const char *const bond_arp_all_targets_table[_NETDEV_BOND_ARP_ALL_TARGETS_MAX] = { + [NETDEV_BOND_ARP_ALL_TARGETS_ANY] = "any", + [NETDEV_BOND_ARP_ALL_TARGETS_ALL] = "all", +}; + +DEFINE_STRING_TABLE_LOOKUP(bond_arp_all_targets, BondArpAllTargets); +DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_all_targets, bond_arp_all_targets, BondArpAllTargets, "Failed to parse bond Arp all targets"); + +static const char *bond_primary_reselect_table[_NETDEV_BOND_PRIMARY_RESELECT_MAX] = { + [NETDEV_BOND_PRIMARY_RESELECT_ALWAYS] = "always", + [NETDEV_BOND_PRIMARY_RESELECT_BETTER]= "better", + [NETDEV_BOND_PRIMARY_RESELECT_FAILURE]= "failure", +}; + +DEFINE_STRING_TABLE_LOOKUP(bond_primary_reselect, BondPrimaryReselect); +DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_primary_reselect, bond_primary_reselect, BondPrimaryReselect, "Failed to parse bond primary reselect"); + static uint8_t bond_mode_to_kernel(BondMode mode) { switch (mode) { case NETDEV_BOND_MODE_BALANCE_RR: @@ -104,7 +180,8 @@ static uint8_t bond_xmit_hash_policy_to_kernel(BondXmitHashPolicy policy) { static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) { Bond *b = BOND(netdev); - int r; + ArpIpTarget *target = NULL; + int r, i = 0; assert(netdev); assert(!link); @@ -174,9 +251,230 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m } } + if (b->arp_interval != 0) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_INTERVAL, b->arp_interval / USEC_PER_MSEC); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_ARP_INTERVAL attribute: %s", + strerror(-r)); + return r; + } + } + + if ((b->lp_interval >= LEARNING_PACKETS_INTERVAL_MIN_SEC) && + (b->lp_interval <= LEARNING_PACKETS_INTERVAL_MAX_SEC)) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_LP_INTERVAL attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->ad_select != _NETDEV_BOND_AD_SELECT_INVALID && + b->mode == BOND_MODE_8023AD) { + r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_SELECT, b->ad_select); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_AD_SELECT attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->fail_over_mac != _NETDEV_BOND_FAIL_OVER_MAC_INVALID && + b->mode == NETDEV_BOND_MODE_ACTIVE_BACKUP) { + r = sd_rtnl_message_append_u8(m, IFLA_BOND_FAIL_OVER_MAC, b->fail_over_mac); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_FAIL_OVER_MAC attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->arp_validate != _NETDEV_BOND_ARP_VALIDATE_INVALID) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_VALIDATE, b->arp_validate); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_ARP_VALIDATE attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->arp_all_targets != _NETDEV_BOND_ARP_ALL_TARGETS_INVALID) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->arp_all_targets); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_ARP_VALIDATE attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->primary_reselect != _NETDEV_BOND_PRIMARY_RESELECT_INVALID) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->primary_reselect); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->resend_igmp <= RESEND_IGMP_MAX) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_RESEND_IGMP, b->resend_igmp); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_RESEND_IGMP attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->packets_per_slave <= PACKETS_PER_SLAVE_MAX) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_PACKETS_PER_SLAVE, b->packets_per_slave); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_PACKETS_PER_SLAVE attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->num_grat_arp <= GRATUITOUS_ARP_MAX) { + r = sd_rtnl_message_append_u8(m, IFLA_BOND_NUM_PEER_NOTIF, b->num_grat_arp); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_NUM_PEER_NOTIF attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->min_links != 0) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIN_LINKS, b->min_links); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_MIN_LINKS attribute: %s", + strerror(-r)); + return r; + } + } + + r = sd_rtnl_message_append_u8(m, IFLA_BOND_ALL_SLAVES_ACTIVE, b->all_slaves_active); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_ALL_SLAVES_ACTIVE attribute: %s", + strerror(-r)); + return r; + } + + if (b->arp_interval > 0) { + if (b->n_arp_ip_targets > 0) { + + r = sd_rtnl_message_open_container(m, IFLA_BOND_ARP_IP_TARGET); + if (r < 0) { + log_netdev_error(netdev, + "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %s", + strerror(-r)); + return r; + } + + LIST_FOREACH(arp_ip_target, target, b->arp_ip_targets) { + r = sd_rtnl_message_append_u32(m, i++, target->ip.in.s_addr); + if (r < 0) { + log_netdev_error(netdev, + "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %s", + strerror(-r)); + return r; + } + } + + r = sd_rtnl_message_close_container(m); + if (r < 0) { + log_netdev_error(netdev, + "Could not close contaniner IFLA_BOND_ARP_IP_TARGET : %s", + strerror(-r)); + return r; + } + } + } + return 0; } +int config_parse_arp_ip_target_address(const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + Bond *b = userdata; + const char *word, *state; + size_t l; + int r; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + FOREACH_WORD_QUOTED(word, l, rvalue, state) { + _cleanup_free_ ArpIpTarget *buffer = NULL; + _cleanup_free_ char *n = NULL; + int f; + + n = strndup(word, l); + if (!n) + return -ENOMEM; + + buffer = new0(ArpIpTarget, 1); + if (!buffer) + return -ENOMEM; + + r = in_addr_from_string_auto(n, &f, &buffer->ip); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Bond ARP ip target address is invalid, ignoring assignment: %s", n); + return 0; + } + + if (f != AF_INET) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Bond ARP ip target address is invalid, ignoring assignment: %s", n); + return 0; + } + + LIST_PREPEND(arp_ip_target, b->arp_ip_targets, buffer); + b->n_arp_ip_targets ++; + + buffer = NULL; + + if (b->n_arp_ip_targets > BOND_ARP_TARGETS_MAX) + break; + } + + return 0; +} + +static void bond_done(NetDev *netdev) { + ArpIpTarget *t = NULL, *n = NULL; + Bond *b = BOND(netdev); + + assert(netdev); + assert(b); + + LIST_FOREACH_SAFE(arp_ip_target, t, n, b->arp_ip_targets) + free(t); + + b->arp_ip_targets = NULL; +} + static void bond_init(NetDev *netdev) { Bond *b = BOND(netdev); @@ -186,11 +484,27 @@ static void bond_init(NetDev *netdev) { b->mode = _NETDEV_BOND_MODE_INVALID; b->xmit_hash_policy = _NETDEV_BOND_XMIT_HASH_POLICY_INVALID; b->lacp_rate = _NETDEV_BOND_LACP_RATE_INVALID; + b->ad_select = _NETDEV_BOND_AD_SELECT_INVALID; + b->fail_over_mac = _NETDEV_BOND_FAIL_OVER_MAC_INVALID; + b->arp_validate = _NETDEV_BOND_ARP_VALIDATE_INVALID; + b->arp_all_targets = _NETDEV_BOND_ARP_ALL_TARGETS_INVALID; + b->primary_reselect = _NETDEV_BOND_PRIMARY_RESELECT_INVALID; + + b->all_slaves_active = false; + + b->resend_igmp = RESEND_IGMP_DEFAULT; + b->packets_per_slave = PACKETS_PER_SLAVE_DEFAULT; + b->num_grat_arp = GRATUITOUS_ARP_DEFAULT; + b->lp_interval = LEARNING_PACKETS_INTERVAL_MIN_SEC; + + LIST_HEAD_INIT(b->arp_ip_targets); + b->n_arp_ip_targets = 0; } const NetDevVTable bond_vtable = { .object_size = sizeof(Bond), .init = bond_init, + .done = bond_done, .sections = "Match\0NetDev\0Bond\0", .fill_message_create = netdev_bond_fill_message_create, .create_type = NETDEV_CREATE_MASTER, diff --git a/src/network/networkd-netdev-bond.h b/src/network/networkd-netdev-bond.h index c09af5fa52..32d1702d58 100644 --- a/src/network/networkd-netdev-bond.h +++ b/src/network/networkd-netdev-bond.h @@ -47,7 +47,6 @@ typedef enum BondXmitHashPolicy { _NETDEV_BOND_XMIT_HASH_POLICY_INVALID = -1 } BondXmitHashPolicy; - typedef enum BondLacpRate { NETDEV_BOND_LACP_RATE_SLOW, NETDEV_BOND_LACP_RATE_FAST, @@ -55,16 +54,79 @@ typedef enum BondLacpRate { _NETDEV_BOND_LACP_RATE_INVALID = -1, } BondLacpRate; +typedef enum BondAdSelect { + NETDEV_BOND_AD_SELECT_STABLE, + NETDEV_BOND_AD_SELECT_BANDWIDTH, + NETDEV_BOND_AD_SELECT_COUNT, + _NETDEV_BOND_AD_SELECT_MAX, + _NETDEV_BOND_AD_SELECT_INVALID = -1, +} BondAdSelect; + +typedef enum BondFailOverMac { + NETDEV_BOND_FAIL_OVER_MAC_NONE, + NETDEV_BOND_FAIL_OVER_MAC_ACTIVE, + NETDEV_BOND_FAIL_OVER_MAC_FOLLOW, + _NETDEV_BOND_FAIL_OVER_MAC_MAX, + _NETDEV_BOND_FAIL_OVER_MAC_INVALID = -1, +} BondFailOverMac; + +typedef enum BondArpValidate { + NETDEV_BOND_ARP_VALIDATE_NONE, + NETDEV_BOND_ARP_VALIDATE_ACTIVE, + NETDEV_BOND_ARP_VALIDATE_BACKUP, + NETDEV_BOND_ARP_VALIDATE_ALL, + _NETDEV_BOND_ARP_VALIDATE_MAX, + _NETDEV_BOND_ARP_VALIDATE_INVALID = -1, +} BondArpValidate; + +typedef enum BondArpAllTargets { + NETDEV_BOND_ARP_ALL_TARGETS_ANY, + NETDEV_BOND_ARP_ALL_TARGETS_ALL, + _NETDEV_BOND_ARP_ALL_TARGETS_MAX, + _NETDEV_BOND_ARP_ALL_TARGETS_INVALID = -1, +} BondArpAllTargets; + +typedef enum BondPrimaryReselect { + NETDEV_BOND_PRIMARY_RESELECT_ALWAYS, + NETDEV_BOND_PRIMARY_RESELECT_BETTER, + NETDEV_BOND_PRIMARY_RESELECT_FAILURE, + _NETDEV_BOND_PRIMARY_RESELECT_MAX, + _NETDEV_BOND_PRIMARY_RESELECT_INVALID = -1, +} BondPrimaryReselect; + +typedef struct ArpIpTarget { + union in_addr_union ip; + + LIST_FIELDS(struct ArpIpTarget, arp_ip_target); +} ArpIpTarget; + struct Bond { NetDev meta; BondMode mode; BondXmitHashPolicy xmit_hash_policy; BondLacpRate lacp_rate; + BondAdSelect ad_select; + BondFailOverMac fail_over_mac; + BondArpValidate arp_validate; + BondArpAllTargets arp_all_targets; + BondPrimaryReselect primary_reselect; + + bool all_slaves_active; + + unsigned resend_igmp; + unsigned packets_per_slave; + unsigned num_grat_arp; + unsigned min_links; usec_t miimon; usec_t updelay; usec_t downdelay; + usec_t arp_interval; + usec_t lp_interval; + + int n_arp_ip_targets; + ArpIpTarget *arp_ip_targets; }; extern const NetDevVTable bond_vtable; @@ -78,6 +140,27 @@ BondXmitHashPolicy bond_xmit_hash_policy_from_string(const char *d) _pure_; const char *bond_lacp_rate_to_string(BondLacpRate d) _const_; BondLacpRate bond_lacp_rate_from_string(const char *d) _pure_; +const char *bond_fail_over_mac_to_string(BondFailOverMac d) _const_; +BondFailOverMac bond_fail_over_mac_from_string(const char *d) _pure_; + +const char *bond_ad_select_to_string(BondAdSelect d) _const_; +BondAdSelect bond_ad_select_from_string(const char *d) _pure_; + +const char *bond_arp_validate_to_string(BondArpValidate d) _const_; +BondArpValidate bond_arp_validate_from_string(const char *d) _pure_; + +const char *bond_arp_all_targets_to_string(BondArpAllTargets d) _const_; +BondArpAllTargets bond_arp_all_targets_from_string(const char *d) _pure_; + +const char *bond_primary_reselect_to_string(BondPrimaryReselect d) _const_; +BondPrimaryReselect bond_primary_reselect_from_string(const char *d) _pure_; + int config_parse_bond_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_bond_xmit_hash_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_bond_lacp_rate(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_bond_ad_select(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_bond_fail_over_mac(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_bond_arp_validate(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_bond_arp_all_targets(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_bond_primary_reselect(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_arp_ip_target_address(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index c06344c397..72ab2f4e9d 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -64,6 +64,19 @@ Tap.Group, config_parse_string, 0, Bond.Mode, config_parse_bond_mode, 0, offsetof(Bond, mode) Bond.TransmitHashPolicy, config_parse_bond_xmit_hash_policy, 0, offsetof(Bond, xmit_hash_policy) Bond.LACPTransmitRate, config_parse_bond_lacp_rate, 0, offsetof(Bond, lacp_rate) +Bond.AdSelect, config_parse_bond_ad_select, 0, offsetof(Bond, ad_select) +Bond.FailOverMac, config_parse_bond_fail_over_mac, 0, offsetof(Bond, fail_over_mac) +Bond.ArpIpTargets, config_parse_arp_ip_target_address, 0, 0 +Bond.ArpValidate, config_parse_bond_arp_validate, 0, offsetof(Bond, arp_validate) +Bond.ArpAllTargets, config_parse_bond_arp_all_targets, 0, offsetof(Bond, arp_all_targets) +Bond.PrimaryReselect, config_parse_bond_primary_reselect, 0, offsetof(Bond, primary_reselect) +Bond.ResendIGMP, config_parse_unsigned, 0, offsetof(Bond, resend_igmp) +Bond.PacketsPerSlave, config_parse_unsigned, 0, offsetof(Bond, packets_per_slave) +Bond.NumGratuitousARP, config_parse_unsigned, 0, offsetof(Bond, num_grat_arp) +Bond.AllSlavesActive, config_parse_unsigned, 0, offsetof(Bond, all_slaves_active) +Bond.MinLinks, config_parse_unsigned, 0, offsetof(Bond, min_links) Bond.MIIMonitorSec, config_parse_sec, 0, offsetof(Bond, miimon) Bond.UpDelaySec, config_parse_sec, 0, offsetof(Bond, updelay) Bond.DownDelaySec, config_parse_sec, 0, offsetof(Bond, downdelay) +Bond.ArpIntervalSec, config_parse_sec, 0, offsetof(Bond, arp_interval) +Bond.LearnPacketIntvSec, config_parse_sec, 0, offsetof(Bond, lp_interval) |