]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/vrf.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / network / netdev / vrf.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 /***
3 This file is part of systemd.
4
5 Copyright 2016 Andreas Rammhold <andreas@rammhold.de>
6
7 systemd is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version.
11
12 systemd is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with systemd; If not, see <http://www.gnu.org/licenses/>.
19 ***/
20
21 #include <net/if.h>
22
23 #include "sd-netlink.h"
24 #include "missing.h"
25 #include "netdev/vrf.h"
26
27 static int netdev_vrf_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
28 Vrf *v;
29 int r;
30
31 assert(netdev);
32 assert(!link);
33 assert(m);
34
35 v = VRF(netdev);
36
37 assert(v);
38
39 r = sd_netlink_message_append_u32(m, IFLA_VRF_TABLE, v->table);
40 if (r < 0)
41 return log_netdev_error_errno(netdev, r, "Could not append IPLA_VRF_TABLE attribute: %m");
42
43 return r;
44 }
45
46 const NetDevVTable vrf_vtable = {
47 .object_size = sizeof(Vrf),
48 .sections = "NetDev\0VRF\0",
49 .fill_message_create = netdev_vrf_fill_message_create,
50 .create_type = NETDEV_CREATE_MASTER,
51 };