<varlistentry>
<term><varname>Group=</varname></term>
<listitem>
- <para>Link groups are similar to port ranges found in managed switches.
- When network interfaces are added to a numbered group, operations on
- all the interfaces from that group can be performed at once. An unsigned
- integer in the range 0…4294967294. Defaults to unset.</para>
+ <para>Link groups are similar to port ranges found in managed switches. When network interfaces
+ are added to a numbered group, operations on all the interfaces from that group can be
+ performed at once. Takes an unsigned integer in the range 0…4294967295. Defaults to unset.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
assert(link->manager);
assert(link->manager->rtnl);
- if (link->network->group <= 0)
+ if (!link->network->group_set)
return 0;
log_link_debug(link, "Setting group");
Match.Firmware, config_parse_net_condition, CONDITION_FIRMWARE, offsetof(Network, conditions)
Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(Network, mtu)
-Link.Group, config_parse_uint32, 0, offsetof(Network, group)
+Link.Group, config_parse_link_group, 0, 0
Link.ARP, config_parse_tristate, 0, offsetof(Network, arp)
Link.Multicast, config_parse_tristate, 0, offsetof(Network, multicast)
Link.AllMulticast, config_parse_tristate, 0, offsetof(Network, allmulticast)
return 0;
}
+int config_parse_link_group(
+ 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) {
+
+ Network *network = userdata;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(network);
+
+ if (isempty(rvalue)) {
+ network->group = 0;
+ network->group_set = false;
+ return 0;
+ }
+
+ r = safe_atou32(rvalue, &network->group);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Failed to parse Group=, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ network->group_set = true;
+ return 0;
+}
+
DEFINE_CONFIG_PARSE_ENUM(config_parse_required_family_for_online, link_required_address_family, AddressFamily,
"Failed to parse RequiredFamilyForOnline= setting");
struct ether_addr *mac;
uint32_t mtu;
uint32_t group;
+ bool group_set;
int arp;
int multicast;
int allmulticast;
CONFIG_PARSER_PROTOTYPE(config_parse_keep_configuration);
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_link_local_address_gen_mode);
CONFIG_PARSER_PROTOTYPE(config_parse_activation_policy);
+CONFIG_PARSER_PROTOTYPE(config_parse_link_group);
const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, GPERF_LEN_TYPE length);