1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 
3 #include <net/if.h>
4 #include <netinet/in.h>
5 #include <linux/if_arp.h>
6 
7 #include "vrf.h"
8 
netdev_vrf_fill_message_create(NetDev * netdev,Link * link,sd_netlink_message * m)9 static int netdev_vrf_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
10         Vrf *v;
11         int r;
12 
13         assert(netdev);
14         assert(!link);
15         assert(m);
16 
17         v = VRF(netdev);
18 
19         assert(v);
20 
21         r = sd_netlink_message_append_u32(m, IFLA_VRF_TABLE, v->table);
22         if (r < 0)
23                 return r;
24 
25         return 0;
26 }
27 
28 const NetDevVTable vrf_vtable = {
29         .object_size = sizeof(Vrf),
30         .sections = NETDEV_COMMON_SECTIONS "VRF\0",
31         .fill_message_create = netdev_vrf_fill_message_create,
32         .create_type = NETDEV_CREATE_INDEPENDENT,
33         .iftype = ARPHRD_ETHER,
34         .generate_mac = true,
35 };
36