From dca31d4206dc06df462b6fe9fe98094a2c7397a3 Mon Sep 17 00:00:00 2001
From: Stefano Brivio <sbrivio@redhat.com>
Date: Thu, 14 Oct 2021 19:11:05 +0200
Subject: netlink: Bring up interface even if neither MTU nor MAC address is
 configured

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 netlink.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/netlink.c b/netlink.c
index a26078b..4faa697 100644
--- a/netlink.c
+++ b/netlink.c
@@ -489,6 +489,7 @@ void nl_link(int ns, unsigned int ifi, void *mac, int up, int mtu)
 		req.rta.rta_type = IFLA_ADDRESS;
 		req.rta.rta_len = RTA_LENGTH(ETH_ALEN);
 		nl_req(ns, buf, &req, req.nlh.nlmsg_len);
+		up = 0;
 	}
 
 	if (mtu) {
@@ -497,8 +498,12 @@ void nl_link(int ns, unsigned int ifi, void *mac, int up, int mtu)
 		req.rta.rta_type = IFLA_MTU;
 		req.rta.rta_len = RTA_LENGTH(sizeof(unsigned int));
 		nl_req(ns, buf, &req, req.nlh.nlmsg_len);
+		up = 0;
 	}
 
+	if (up)
+		nl_req(ns, buf, &req, req.nlh.nlmsg_len);
+
 	if (change)
 		return;
 
-- 
cgit v1.2.3