From: Susant Sahani <145210+ssahani@users.noreply.github.com> Date: Fri, 1 Jun 2018 14:22:12 +0000 (+0530) Subject: networkd: enable to set IFF_ALLMULTI to network device (#9146) X-Git-Tag: v239~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=866e6b7a1214a8a053615b48bef7be078ff95234;p=thirdparty%2Fsystemd.git networkd: enable to set IFF_ALLMULTI to network device (#9146) networkd: allow setting set IFF_ALLMULTI flag on network devices --- diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 64b9232689f..953bc74cc5a 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -234,7 +234,7 @@ ARP= - A boolean. Enables or disables the ARP (low-level Address Resolution Protocol) + A boolean. Enables or disables the ARP (low-level Address Resolution Protocol) for this interface. Defaults to unset, which means that the kernel default will be used. For example, disabling ARP is useful when creating multiple MACVLAN or VLAN virtual interfaces atop a single lower-level physical interface, which will then only serve as a @@ -245,7 +245,14 @@ Multicast= - A boolean. Enables or disables the change the MULTICAST flag on the device. + A boolean. Enables or disables the multicast flag on the device. + + + + AllMulticast= + + A boolean. When this flag is set the driver retrieves all multicast packets from the network. + This happens when multicast routing is enabled. diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 32bcc4c4596..c957efd409c 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1357,7 +1357,7 @@ static int link_set_flags(Link *link) { if (!link->network) return 0; - if (link->network->arp < 0 && link->network->multicast < 0) + if (link->network->arp < 0 && link->network->multicast < 0 && link->network->allmulticast < 0) return 0; r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); @@ -1374,6 +1374,11 @@ static int link_set_flags(Link *link) { SET_FLAG(ifi_flags, IFF_MULTICAST, link->network->multicast); } + if (link->network->allmulticast >= 0) { + ifi_change |= IFF_ALLMULTI; + SET_FLAG(ifi_flags, IFF_ALLMULTI, link->network->allmulticast); + } + r = sd_rtnl_message_link_set_flags(req, ifi_flags, ifi_change); if (r < 0) return log_link_error_errno(link, r, "Could not set link flags: %m"); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 26e3f452ef3..7e625e48fa4 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -34,6 +34,7 @@ Link.MACAddress, config_parse_hwaddr, Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(Network, mtu) 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) Link.Unmanaged, config_parse_bool, 0, offsetof(Network, unmanaged) Link.RequiredForOnline, config_parse_bool, 0, offsetof(Network, required_for_online) Network.Description, config_parse_string, 0, offsetof(Network, description) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 57d04827abd..c3a11ddca07 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -248,6 +248,7 @@ static int network_load_one(Manager *manager, const char *filename) { network->proxy_arp = -1; network->arp = -1; network->multicast = -1; + network->allmulticast = -1; network->ipv6_accept_ra_use_dns = true; network->ipv6_accept_ra_route_table = RT_TABLE_MAIN; network->ipv6_mtu = 0; diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 86e97909c98..b8e2c523a3c 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -214,6 +214,7 @@ struct Network { uint32_t mtu; int arp; int multicast; + int allmulticast; bool unmanaged; bool configure_without_carrier; uint32_t iaid;