]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink: don't try to get ll addr len when creating an iface
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 29 May 2019 14:42:10 +0000 (16:42 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 30 May 2019 18:03:20 +0000 (11:03 -0700)
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 <dsahern@gmail.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/iplink.c

index 7952cb2be3644735d6490a8e0c2575aa6cfc0852..d275efa9d087dbde1b1291d5bf4c378aa1d4d38b 100644 (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) {