networkd: bridge add support to set IGMP version
This commit is contained in:
committed by
Yu Watanabe
parent
037dbb80d1
commit
afa51e2dfb
@@ -133,6 +133,12 @@ static int netdev_bridge_post_create(NetDev *netdev, Link *link, sd_netlink_mess
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_STP_STATE attribute: %m");
|
||||
}
|
||||
|
||||
if (b->igmp_version > 0) {
|
||||
r = sd_netlink_message_append_u8(req, IFLA_BR_MCAST_IGMP_VERSION, b->igmp_version);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_MCAST_IGMP_VERSION attribute: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_close_container(req);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
|
||||
@@ -287,6 +293,50 @@ int link_set_bridge(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
int config_parse_bridge_igmp_version(
|
||||
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) {
|
||||
|
||||
Bridge *b = userdata;
|
||||
uint8_t u;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
b->igmp_version = 0; /* 0 means unset. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = safe_atou8(rvalue, &u);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
"Failed to parse bridge IGMP version number '%s', ignoring assignment: %m",
|
||||
rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (!IN_SET(u, 2, 3)) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0,
|
||||
"Invalid bridge IGMP version number '%s', ignoring assignment.", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
b->igmp_version = u;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bridge_init(NetDev *n) {
|
||||
Bridge *b;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ typedef struct Bridge {
|
||||
uint16_t priority;
|
||||
uint16_t group_fwd_mask;
|
||||
uint16_t default_pvid;
|
||||
uint8_t igmp_version;
|
||||
|
||||
usec_t forward_delay;
|
||||
usec_t hello_time;
|
||||
@@ -42,3 +43,4 @@ const char* multicast_router_to_string(MulticastRouter i) _const_;
|
||||
MulticastRouter multicast_router_from_string(const char *s) _pure_;
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_multicast_router);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_bridge_igmp_version);
|
||||
|
||||
@@ -207,6 +207,7 @@ Bridge.MulticastQuerier, config_parse_tristate,
|
||||
Bridge.MulticastSnooping, config_parse_tristate, 0, offsetof(Bridge, mcast_snooping)
|
||||
Bridge.VLANFiltering, config_parse_tristate, 0, offsetof(Bridge, vlan_filtering)
|
||||
Bridge.STP, config_parse_tristate, 0, offsetof(Bridge, stp)
|
||||
Bridge.IGMPVersion, config_parse_uint8, 0, offsetof(Bridge, igmp_version)
|
||||
VRF.TableId, config_parse_uint32, 0, offsetof(Vrf, table) /* deprecated */
|
||||
VRF.Table, config_parse_uint32, 0, offsetof(Vrf, table)
|
||||
WireGuard.FirewallMark, config_parse_unsigned, 0, offsetof(Wireguard, fwmark)
|
||||
|
||||
Reference in New Issue
Block a user