diff options
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; } |