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 757837230a ("lib: suppress error msg when filling the cache").

Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Nicolas Dichtel 2019-05-29 16:42:10 +02:00 committed by Stephen Hemminger
parent a9661b8b0f
commit c442234858

View File

@ -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) {