diff options
author | Susant Sahani <ssahani@vmware.com> | 2019-07-24 18:28:57 +0530 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-25 10:05:06 +0900 |
commit | afa51e2dfb1a0171d3a9341e5a5fc5c4088624bc (patch) | |
tree | 011c65ca8b87d714d1486628d66d3e63d03e5a6b /src | |
parent | 037dbb80d1298795cf1079db21d5d096cb454af3 (diff) | |
download | systemd-afa51e2dfb1a0171d3a9341e5a5fc5c4088624bc.tar.gz systemd-afa51e2dfb1a0171d3a9341e5a5fc5c4088624bc.tar.bz2 systemd-afa51e2dfb1a0171d3a9341e5a5fc5c4088624bc.zip |
networkd: bridge add support to set IGMP version
Diffstat (limited to 'src')
-rw-r--r-- | src/network/netdev/bridge.c | 50 | ||||
-rw-r--r-- | src/network/netdev/bridge.h | 2 | ||||
-rw-r--r-- | src/network/netdev/netdev-gperf.gperf | 1 |
3 files changed, 53 insertions, 0 deletions
diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c index f20130d264..71a7ac7a43 100644 --- a/src/network/netdev/bridge.c +++ b/src/network/netdev/bridge.c @@ -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; diff --git a/src/network/netdev/bridge.h b/src/network/netdev/bridge.h index 2954155c37..b0a728e5a4 100644 --- a/src/network/netdev/bridge.h +++ b/src/network/netdev/bridge.h @@ -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); diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index 8641d18026..b017ac8ec7 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -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) |