]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: Allow vxlan to be created without .network file
authorSusant Sahani <ssahani@vmware.com>
Wed, 16 Sep 2020 01:03:30 +0000 (01:03 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 17 Sep 2020 06:49:36 +0000 (15:49 +0900)
man/systemd.netdev.xml
src/network/netdev/netdev-gperf.gperf
src/network/netdev/netdev.c
src/network/netdev/vxlan.c
src/network/netdev/vxlan.h
test/fuzz/fuzz-netdev-parser/directives.netdev

index c2957fd18232053c616585b4bd711ea2c31892e5..b258e0c965fab16747b1b43ee8918ac87c44a22d 100644 (file)
           <para>Accepts the same key in [VXLAN] section.</para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term><varname>Independent=</varname></term>
+        <listitem>
+          <para>Takes a boolean. When true, the vxlan interface is created without underlying interfaces.
+          Defaults to <literal>false</literal>.</para>
+        </listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 
index c532dfd2683b0120cb13ab3fbf0ee2d6db489011..2e69b17fe37fd3f85f0f7c4e76bedf4738a9cbf8 100644 (file)
@@ -134,6 +134,7 @@ VXLAN.PortRange,                          config_parse_port_range,
 VXLAN.DestinationPort,                    config_parse_ip_port,                      0,                             offsetof(VxLan, dest_port)
 VXLAN.FlowLabel,                          config_parse_flow_label,                   0,                             0
 VXLAN.IPDoNotFragment,                    config_parse_df,                           0,                             offsetof(VxLan, df)
+VXLAN.Independent,                        config_parse_bool,                         0,                             offsetof(VxLan, independent)
 GENEVE.Id,                                config_parse_geneve_vni,                   0,                             offsetof(Geneve, id)
 GENEVE.Remote,                            config_parse_geneve_address,               0,                             offsetof(Geneve, remote)
 GENEVE.TOS,                               config_parse_uint8,                        0,                             offsetof(Geneve, tos)
index 446a580e2cc91af4502d9b23da6e4625146d2d15..3e32d8302909661d20be287277c3143aa74aabeb 100644 (file)
@@ -823,6 +823,9 @@ int netdev_load_one(Manager *manager, const char *filename) {
         case NETDEV_KIND_XFRM:
                 independent = XFRM(netdev)->independent;
                 break;
+        case NETDEV_KIND_VXLAN:
+                independent = VXLAN(netdev)->independent;
+                break;
         default:
                 break;
         }
index 373ff789aaeae0885bbb739fc22313661b73a06a..d941b7d63342672b1da19c961d3fedd51b59fe40 100644 (file)
@@ -25,7 +25,6 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
         int r;
 
         assert(netdev);
-        assert(link);
         assert(m);
 
         v = VXLAN(netdev);
@@ -63,7 +62,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LOCAL attribute: %m");
         }
 
-        r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
+        r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link ? link->ifindex : 0);
         if (r < 0)
                 return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
 
index cf8ae8845e83353c01102b92b21b091cfafccb36..d836215c466c06bca9589fce8f03038779d71a89 100644 (file)
@@ -56,6 +56,7 @@ struct VxLan {
         bool group_policy;
         bool generic_protocol_extension;
         bool inherit;
+        bool independent;
 
         struct ifla_vxlan_port_range port_range;
 };
index ef1f18fa402430c384c4bd14891ebe19f6d5ceaf..4c223f908eb45d2b7c426fa6d85eddc495c11d20 100644 (file)
@@ -116,6 +116,7 @@ PortRange=
 UDPChecksum=
 UDP6ZeroCheckSumTx=
 IPDoNotFragment=
+Independent=
 [VXCAN]
 Peer=
 [Bond]