]> git.proxmox.com Git - systemd.git/blob - src/network/networkd-netdev-ipvlan.c
Enable seccomp support on powerpc, ppc64el, and s390x
[systemd.git] / src / network / networkd-netdev-ipvlan.c
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2013-2015 Tom Gundersen <teg@jklm.no>
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <net/if.h>
23
24 #include "conf-parser.h"
25 #include "networkd-netdev-ipvlan.h"
26 #include "string-table.h"
27
28 static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
29 [NETDEV_IPVLAN_MODE_L2] = "L2",
30 [NETDEV_IPVLAN_MODE_L3] = "L3",
31 };
32
33 DEFINE_STRING_TABLE_LOOKUP(ipvlan_mode, IPVlanMode);
34 DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode, "Failed to parse ipvlan mode");
35
36 static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
37 IPVlan *m;
38 int r;
39
40 assert(netdev);
41 assert(link);
42 assert(netdev->ifname);
43
44 m = IPVLAN(netdev);
45
46 assert(m);
47
48 if (m->mode != _NETDEV_IPVLAN_MODE_INVALID) {
49 r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
50 if (r < 0)
51 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_MODE attribute: %m");
52 }
53
54 return 0;
55 }
56
57 static void ipvlan_init(NetDev *n) {
58 IPVlan *m;
59
60 assert(n);
61
62 m = IPVLAN(n);
63
64 assert(m);
65
66 m->mode = _NETDEV_IPVLAN_MODE_INVALID;
67 }
68
69 const NetDevVTable ipvlan_vtable = {
70 .object_size = sizeof(IPVlan),
71 .init = ipvlan_init,
72 .sections = "Match\0NetDev\0IPVLAN\0",
73 .fill_message_create = netdev_ipvlan_fill_message_create,
74 .create_type = NETDEV_CREATE_STACKED,
75 };