]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Add ability to set MULTICAST flag on interface
authorSusant Sahani <susant@redhat.com>
Tue, 29 May 2018 14:58:11 +0000 (20:28 +0530)
committerLennart Poettering <lennart@poettering.net>
Wed, 30 May 2018 10:59:24 +0000 (12:59 +0200)
Closes #9113

fix ARP toggling flag

man/systemd.network.xml
src/network/networkd-link.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.c
src/network/networkd-network.h

index 82629b917252ba2ac782da7654ad0b4aa3f00aae..64b9232689f875f9999556ed1ca4088ba1657622 100644 (file)
           the network otherwise.</para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term><varname>Multicast=</varname></term>
+        <listitem>
+          <para> A boolean. Enables or disables the change the MULTICAST flag on the device.</para>
+        </listitem>
+      </varlistentry>
       <varlistentry>
         <term><varname>Unmanaged=</varname></term>
         <listitem>
index 8cc817ac003bca7c24bdd2f1a3766934ecfb78a0..32bcc4c45962794a194a5debc58d8114f9c6ce86 100644 (file)
@@ -1357,7 +1357,7 @@ static int link_set_flags(Link *link) {
         if (!link->network)
                 return 0;
 
-        if (link->network->arp < 0)
+        if (link->network->arp < 0 && link->network->multicast < 0)
                 return 0;
 
         r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex);
@@ -1366,7 +1366,12 @@ static int link_set_flags(Link *link) {
 
         if (link->network->arp >= 0) {
                 ifi_change |= IFF_NOARP;
-                ifi_flags |= link->network->arp ? 0 : IFF_NOARP;
+                SET_FLAG(ifi_flags, IFF_NOARP, link->network->arp == 0);
+        }
+
+        if (link->network->multicast >= 0) {
+                ifi_change |= IFF_MULTICAST;
+                SET_FLAG(ifi_flags, IFF_MULTICAST, link->network->multicast);
         }
 
         r = sd_rtnl_message_link_set_flags(req, ifi_flags, ifi_change);
index 23f57ca2f0051d6e152aa2dc72c2c61ff2801ec9..26e3f452ef3651b610f625856823210f7a1f9897 100644 (file)
@@ -33,6 +33,7 @@ Match.Architecture,                     config_parse_net_condition,
 Link.MACAddress,                        config_parse_hwaddr,                            0,                             offsetof(Network, mac)
 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.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)
index 2b03fc254ba7a076f68e95ce0bec6f9060038b9f..57d04827abdf4a9cc44fd3c2bd3d06c5da1dda43 100644 (file)
@@ -247,6 +247,7 @@ static int network_load_one(Manager *manager, const char *filename) {
         network->duid.type = _DUID_TYPE_INVALID;
         network->proxy_arp = -1;
         network->arp = -1;
+        network->multicast = -1;
         network->ipv6_accept_ra_use_dns = true;
         network->ipv6_accept_ra_route_table = RT_TABLE_MAIN;
         network->ipv6_mtu = 0;
index c4c6b28ab0d96e4849a9cd9d9a635faaf53eea18..86e97909c98836888fe2a32f114824b6edc65fcd 100644 (file)
@@ -213,6 +213,7 @@ struct Network {
         struct ether_addr *mac;
         uint32_t mtu;
         int arp;
+        int multicast;
         bool unmanaged;
         bool configure_without_carrier;
         uint32_t iaid;