diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index c2957fd182..b258e0c965 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -819,6 +819,13 @@ Accepts the same key in [VXLAN] section. + + Independent= + + Takes a boolean. When true, the vxlan interface is created without underlying interfaces. + Defaults to false. + + diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index c532dfd268..2e69b17fe3 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -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) diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c index 446a580e2c..3e32d83029 100644 --- a/src/network/netdev/netdev.c +++ b/src/network/netdev/netdev.c @@ -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; } diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index 373ff789aa..d941b7d633 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -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"); diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h index cf8ae8845e..d836215c46 100644 --- a/src/network/netdev/vxlan.h +++ b/src/network/netdev/vxlan.h @@ -56,6 +56,7 @@ struct VxLan { bool group_policy; bool generic_protocol_extension; bool inherit; + bool independent; struct ifla_vxlan_port_range port_range; }; diff --git a/test/fuzz/fuzz-netdev-parser/directives.netdev b/test/fuzz/fuzz-netdev-parser/directives.netdev index ef1f18fa40..4c223f908e 100644 --- a/test/fuzz/fuzz-netdev-parser/directives.netdev +++ b/test/fuzz/fuzz-netdev-parser/directives.netdev @@ -116,6 +116,7 @@ PortRange= UDPChecksum= UDP6ZeroCheckSumTx= IPDoNotFragment= +Independent= [VXCAN] Peer= [Bond]