.object_size = sizeof(Bond),
.init = bond_init,
.done = bond_done,
- .sections = "Match\0NetDev\0Bond\0",
+ .sections = NETDEV_COMMON_SECTIONS "Bond\0",
.fill_message_create = netdev_bond_fill_message_create,
.create_type = NETDEV_CREATE_MASTER,
.generate_mac = true,
const NetDevVTable bridge_vtable = {
.object_size = sizeof(Bridge),
.init = bridge_init,
- .sections = "Match\0NetDev\0Bridge\0",
+ .sections = NETDEV_COMMON_SECTIONS "Bridge\0",
.post_create = netdev_bridge_post_create,
.create_type = NETDEV_CREATE_MASTER,
};
const NetDevVTable dummy_vtable = {
.object_size = sizeof(Dummy),
- .sections = "Match\0NetDev\0",
+ .sections = NETDEV_COMMON_SECTIONS,
.create_type = NETDEV_CREATE_INDEPENDENT,
.generate_mac = true,
};
const NetDevVTable foutnl_vtable = {
.object_size = sizeof(FouTunnel),
.init = fou_tunnel_init,
- .sections = "Match\0NetDev\0FooOverUDP\0",
+ .sections = NETDEV_COMMON_SECTIONS "FooOverUDP\0",
.create = netdev_fou_tunnel_create,
.create_type = NETDEV_CREATE_INDEPENDENT,
.config_verify = netdev_fou_tunnel_verify,
const NetDevVTable geneve_vtable = {
.object_size = sizeof(Geneve),
.init = geneve_init,
- .sections = "Match\0NetDev\0GENEVE\0",
+ .sections = NETDEV_COMMON_SECTIONS "GENEVE\0",
.create = netdev_geneve_create,
.create_type = NETDEV_CREATE_INDEPENDENT,
.config_verify = netdev_geneve_verify,
const NetDevVTable ipvlan_vtable = {
.object_size = sizeof(IPVlan),
.init = ipvlan_init,
- .sections = "Match\0NetDev\0IPVLAN\0",
+ .sections = NETDEV_COMMON_SECTIONS "IPVLAN\0",
.fill_message_create = netdev_ipvlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.generate_mac = true,
const NetDevVTable ipvtap_vtable = {
.object_size = sizeof(IPVlan),
.init = ipvlan_init,
- .sections = "Match\0NetDev\0IPVTAP\0",
+ .sections = NETDEV_COMMON_SECTIONS "IPVTAP\0",
.fill_message_create = netdev_ipvlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.generate_mac = true,
const NetDevVTable l2tptnl_vtable = {
.object_size = sizeof(L2tpTunnel),
.init = l2tp_tunnel_init,
- .sections = "Match\0NetDev\0L2TP\0L2TPSession\0",
+ .sections = NETDEV_COMMON_SECTIONS "L2TP\0L2TPSession\0",
.create_after_configured = l2tp_create_tunnel,
.done = l2tp_tunnel_done,
.create_type = NETDEV_CREATE_AFTER_CONFIGURED,
const NetDevVTable macsec_vtable = {
.object_size = sizeof(MACsec),
.init = macsec_init,
- .sections = "Match\0NetDev\0MACsec\0MACsecReceiveChannel\0MACsecTransmitAssociation\0MACsecReceiveAssociation\0",
+ .sections = NETDEV_COMMON_SECTIONS "MACsec\0MACsecReceiveChannel\0MACsecTransmitAssociation\0MACsecReceiveAssociation\0",
.fill_message_create = netdev_macsec_fill_message_create,
.post_create = netdev_macsec_configure,
.done = macsec_done,
const NetDevVTable macvtap_vtable = {
.object_size = sizeof(MacVlan),
.init = macvlan_init,
- .sections = "Match\0NetDev\0MACVTAP\0",
+ .sections = NETDEV_COMMON_SECTIONS "MACVTAP\0",
.fill_message_create = netdev_macvlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.generate_mac = true,
const NetDevVTable macvlan_vtable = {
.object_size = sizeof(MacVlan),
.init = macvlan_init,
- .sections = "Match\0NetDev\0MACVLAN\0",
+ .sections = NETDEV_COMMON_SECTIONS "MACVLAN\0",
.fill_message_create = netdev_macvlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.generate_mac = true,
dropin_dirname = strjoina(basename(filename), ".d");
r = config_parse_many(filename, NETWORK_DIRS, dropin_dirname,
- "Match\0NetDev\0",
+ NETDEV_COMMON_SECTIONS NETDEV_OTHER_SECTIONS,
config_item_perf_lookup, network_netdev_gperf_lookup,
- CONFIG_PARSE_WARN|CONFIG_PARSE_RELAXED, netdev_raw);
+ CONFIG_PARSE_WARN, netdev_raw);
if (r < 0)
return r;
#include "networkd-link.h"
#include "time-util.h"
+#define NETDEV_COMMON_SECTIONS "Match\0NetDev\0"
+/* This is the list of known sections. We need to ignore them in the initial parsing phase. */
+#define NETDEV_OTHER_SECTIONS \
+ "-Bond\0" \
+ "-Bridge\0" \
+ "-FooOverUDP\0" \
+ "-GENEVE\0" \
+ "-IPVLAN\0" \
+ "-IPVTAP\0" \
+ "-L2TP\0" \
+ "-L2TPSession\0" \
+ "-MACsec\0" \
+ "-MACsecReceiveChannel\0" \
+ "-MACsecTransmitAssociation\0" \
+ "-MACsecReceiveAssociation\0" \
+ "-MACVTAP\0" \
+ "-MACVLAN\0" \
+ "-Tunnel\0" \
+ "-Tun\0" \
+ "-Tap\0" \
+ "-Peer\0" \
+ "-VLAN\0" \
+ "-VRF\0" \
+ "-VXCAN\0" \
+ "-VXLAN\0" \
+ "-WireGuard\0" \
+ "-WireGuardPeer\0" \
+ "-Xfrm\0"
+
typedef struct netdev_join_callback netdev_join_callback;
struct netdev_join_callback {
const NetDevVTable netdevsim_vtable = {
.object_size = sizeof(NetDevSim),
- .sections = "Match\0NetDev\0",
+ .sections = NETDEV_COMMON_SECTIONS,
.create_type = NETDEV_CREATE_INDEPENDENT,
.generate_mac = true,
};
const NetDevVTable nlmon_vtable = {
.object_size = sizeof(NLMon),
- .sections = "Match\0NetDev\0",
+ .sections = NETDEV_COMMON_SECTIONS,
.create_type = NETDEV_CREATE_INDEPENDENT,
.config_verify = netdev_nlmon_verify,
};
const NetDevVTable ipip_vtable = {
.object_size = sizeof(Tunnel),
.init = ipip_sit_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_ipip_sit_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable sit_vtable = {
.object_size = sizeof(Tunnel),
.init = ipip_sit_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_ipip_sit_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable vti_vtable = {
.object_size = sizeof(Tunnel),
.init = vti_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_vti_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable vti6_vtable = {
.object_size = sizeof(Tunnel),
.init = vti_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_vti_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable gre_vtable = {
.object_size = sizeof(Tunnel),
.init = gre_erspan_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_gre_erspan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable gretap_vtable = {
.object_size = sizeof(Tunnel),
.init = gre_erspan_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_gre_erspan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable ip6gre_vtable = {
.object_size = sizeof(Tunnel),
.init = ip6gre_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_ip6gre_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable ip6gretap_vtable = {
.object_size = sizeof(Tunnel),
.init = ip6gre_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_ip6gre_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable ip6tnl_vtable = {
.object_size = sizeof(Tunnel),
.init = ip6tnl_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_ip6tnl_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable erspan_vtable = {
.object_size = sizeof(Tunnel),
.init = gre_erspan_init,
- .sections = "Match\0NetDev\0Tunnel\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tunnel\0",
.fill_message_create = netdev_gre_erspan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_tunnel_verify,
const NetDevVTable tun_vtable = {
.object_size = sizeof(TunTap),
- .sections = "Match\0NetDev\0Tun\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tun\0",
.config_verify = tuntap_verify,
.done = tuntap_done,
.create = netdev_create_tuntap,
const NetDevVTable tap_vtable = {
.object_size = sizeof(TunTap),
- .sections = "Match\0NetDev\0Tap\0",
+ .sections = NETDEV_COMMON_SECTIONS "Tap\0",
.config_verify = tuntap_verify,
.done = tuntap_done,
.create = netdev_create_tuntap,
const NetDevVTable vcan_vtable = {
.object_size = sizeof(VCan),
- .sections = "Match\0NetDev\0",
+ .sections = NETDEV_COMMON_SECTIONS,
.create_type = NETDEV_CREATE_INDEPENDENT,
.generate_mac = true,
};
const NetDevVTable veth_vtable = {
.object_size = sizeof(Veth),
- .sections = "Match\0NetDev\0Peer\0",
+ .sections = NETDEV_COMMON_SECTIONS "Peer\0",
.done = veth_done,
.fill_message_create = netdev_veth_fill_message_create,
.create_type = NETDEV_CREATE_INDEPENDENT,
const NetDevVTable vlan_vtable = {
.object_size = sizeof(VLan),
.init = vlan_init,
- .sections = "Match\0NetDev\0VLAN\0",
+ .sections = NETDEV_COMMON_SECTIONS "VLAN\0",
.fill_message_create = netdev_vlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_vlan_verify,
const NetDevVTable vrf_vtable = {
.object_size = sizeof(Vrf),
- .sections = "Match\0NetDev\0VRF\0",
+ .sections = NETDEV_COMMON_SECTIONS "VRF\0",
.fill_message_create = netdev_vrf_fill_message_create,
.create_type = NETDEV_CREATE_MASTER,
.generate_mac = true,
const NetDevVTable vxcan_vtable = {
.object_size = sizeof(VxCan),
- .sections = "Match\0NetDev\0VXCAN\0",
+ .sections = NETDEV_COMMON_SECTIONS "VXCAN\0",
.done = vxcan_done,
.fill_message_create = netdev_vxcan_fill_message_create,
.create_type = NETDEV_CREATE_INDEPENDENT,
const NetDevVTable vxlan_vtable = {
.object_size = sizeof(VxLan),
.init = vxlan_init,
- .sections = "Match\0NetDev\0VXLAN\0",
+ .sections = NETDEV_COMMON_SECTIONS "VXLAN\0",
.fill_message_create = netdev_vxlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_vxlan_verify,
const NetDevVTable wireguard_vtable = {
.object_size = sizeof(Wireguard),
- .sections = "Match\0NetDev\0WireGuard\0WireGuardPeer\0",
+ .sections = NETDEV_COMMON_SECTIONS "WireGuard\0WireGuardPeer\0",
.post_create = netdev_wireguard_post_create,
.init = wireguard_init,
.done = wireguard_done,
const NetDevVTable xfrm_vtable = {
.object_size = sizeof(Xfrm),
- .sections = "Match\0NetDev\0Xfrm\0",
+ .sections = NETDEV_COMMON_SECTIONS "Xfrm\0",
.fill_message_create = xfrm_fill_message_create,
.create_type = NETDEV_CREATE_STACKED
};