From c442234858a6bf3ee954f5e482dac9486ece5f17 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Wed, 29 May 2019 16:42:10 +0200 Subject: [PATCH] iplink: don't try to get ll addr len when creating an iface It will obviously fail. This is a follow up of the commit 757837230a65 ("lib: suppress error msg when filling the cache"). Suggested-by: David Ahern Signed-off-by: Nicolas Dichtel Signed-off-by: Stephen Hemminger --- ip/iplink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/iplink.c b/ip/iplink.c index 7952cb2b..d275efa9 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -945,7 +945,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type) else if (!strcmp(name, dev)) name = dev; - if (dev && addr_len) { + if (dev && addr_len && + !(req->n.nlmsg_flags & NLM_F_CREATE)) { int halen = nl_get_ll_addr_len(dev); if (halen >= 0 && halen != addr_len) {