diff options
author | Tom Gundersen <teg@jklm.no> | 2014-02-25 21:16:17 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-02-25 21:19:08 +0100 |
commit | fe6b2d55bcb379d01664ed28cea40634cb6b52e3 (patch) | |
tree | 330da49ab0f895c7c1618a36b4439f41a04d9472 /src/network/networkd-link.c | |
parent | e3ab0c0e19227efdf15237dd9136fc6fc7f3839d (diff) |
networkd: add basic support for MACVLANs
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r-- | src/network/networkd-link.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 1f495b38bb..b217123ecc 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -890,7 +890,7 @@ static int enslave_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { } static int link_enter_enslave(Link *link) { - NetDev *vlan; + NetDev *vlan, *macvlan; Iterator i; int r; @@ -901,7 +901,8 @@ static int link_enter_enslave(Link *link) { link->state = LINK_STATE_ENSLAVING; if (!link->network->bridge && !link->network->bond && - hashmap_isempty(link->network->vlans)) + hashmap_isempty(link->network->vlans) && + hashmap_isempty(link->network->macvlans)) return link_enslaved(link); if (link->network->bridge) { @@ -943,6 +944,24 @@ static int link_enter_enslave(Link *link) { link->enslaving ++; } + HASHMAP_FOREACH(macvlan, link->network->macvlans, i) { + log_struct_link(LOG_DEBUG, link, + "MESSAGE=%s: enslaving by '%s'", + link->ifname, macvlan->name, NETDEV(macvlan), NULL); + + r = netdev_enslave(macvlan, link, &enslave_handler); + if (r < 0) { + log_struct_link(LOG_WARNING, link, + "MESSAGE=%s: could not enslave by '%s': %s", + link->ifname, macvlan->name, strerror(-r), + NETDEV(macvlan), NULL); + link_enter_failed(link); + return r; + } + + link->enslaving ++; + } + return 0; } |