mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
networkd: enable to set IFF_ALLMULTI to network device (#9146)
networkd: allow setting set IFF_ALLMULTI flag on network devices
This commit is contained in:
parent
be4bf266cb
commit
866e6b7a12
@ -234,7 +234,7 @@
|
||||
<varlistentry>
|
||||
<term><varname>ARP=</varname></term>
|
||||
<listitem>
|
||||
<para> A boolean. Enables or disables the ARP (low-level Address Resolution Protocol)
|
||||
<para>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.</para>
|
||||
<para> 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 @@
|
||||
<varlistentry>
|
||||
<term><varname>Multicast=</varname></term>
|
||||
<listitem>
|
||||
<para> A boolean. Enables or disables the change the MULTICAST flag on the device.</para>
|
||||
<para>A boolean. Enables or disables the multicast flag on the device.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>AllMulticast=</varname></term>
|
||||
<listitem>
|
||||
<para>A boolean. When this flag is set the driver retrieves all multicast packets from the network.
|
||||
This happens when multicast routing is enabled.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -214,6 +214,7 @@ struct Network {
|
||||
uint32_t mtu;
|
||||
int arp;
|
||||
int multicast;
|
||||
int allmulticast;
|
||||
bool unmanaged;
|
||||
bool configure_without_carrier;
|
||||
uint32_t iaid;
|
||||
|
Loading…
Reference in New Issue
Block a user