summaryrefslogtreecommitdiff
path: root/src/network/networkd-netdev-macvlan.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-07-28 19:44:02 +0200
committerTom Gundersen <teg@jklm.no>2015-07-28 19:44:02 +0200
commita494468652e2879741afb6c8d47c9218e3514df8 (patch)
tree6b2a97d9e2072e2a90ee05722dca1f9825422d40 /src/network/networkd-netdev-macvlan.c
parent4e18de3d27dc66d2675ab6cbd6a35d36c94e1157 (diff)
parent0371f2df67ca0b48a321d1ee5383a8f11b7e59e6 (diff)
Merge pull request #732 from ssahani/macvtap
networkd: add support for Macvtap
Diffstat (limited to 'src/network/networkd-netdev-macvlan.c')
-rw-r--r--src/network/networkd-netdev-macvlan.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c
index c2c564935c..e17de793ce 100644
--- a/src/network/networkd-netdev-macvlan.c
+++ b/src/network/networkd-netdev-macvlan.c
@@ -35,14 +35,20 @@ DEFINE_STRING_TABLE_LOOKUP(macvlan_mode, MacVlanMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, "Failed to parse macvlan mode");
static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
- MacVlan *m = MACVLAN(netdev);
+ MacVlan *m;
int r;
assert(netdev);
- assert(m);
assert(link);
assert(netdev->ifname);
+ if (netdev->kind == NETDEV_KIND_MACVLAN)
+ m = MACVLAN(netdev);
+ else
+ m = MACVTAP(netdev);
+
+ assert(m);
+
if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) {
r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
if (r < 0)
@@ -53,14 +59,28 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_net
}
static void macvlan_init(NetDev *n) {
- MacVlan *m = MACVLAN(n);
+ MacVlan *m;
assert(n);
+
+ if (n->kind == NETDEV_KIND_MACVLAN)
+ m = MACVLAN(n);
+ else
+ m = MACVTAP(n);
+
assert(m);
m->mode = _NETDEV_MACVLAN_MODE_INVALID;
}
+const NetDevVTable macvtap_vtable = {
+ .object_size = sizeof(MacVlan),
+ .init = macvlan_init,
+ .sections = "Match\0NetDev\0MACVTAP\0",
+ .fill_message_create = netdev_macvlan_fill_message_create,
+ .create_type = NETDEV_CREATE_STACKED,
+};
+
const NetDevVTable macvlan_vtable = {
.object_size = sizeof(MacVlan),
.init = macvlan_init,