]> granicus.if.org Git - libnl/commitdiff
lib/veth.c: Disassociate link name of peer name
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>
Thu, 4 Jan 2018 22:24:55 +0000 (20:24 -0200)
committerThomas Haller <thaller@redhat.com>
Tue, 16 Jan 2018 08:13:26 +0000 (09:13 +0100)
Based in the function documentation, peer name could be set regardless
of the link name being informed of not. These parameters should be
checked independently.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
https://github.com/thom311/libnl/pull/162

lib/route/link/veth.c

index 0cc3a4af012721e275b3ced7e88206ebdbed566a..bd3004184454b4396a04351122a85177a850d4ff 100644 (file)
@@ -282,10 +282,10 @@ int rtnl_link_veth_add(struct nl_sock *sock, const char *name,
                return -NLE_NOMEM;
        peer = link->l_info;
 
-       if (name && peer_name) {
+       if (name)
                rtnl_link_set_name(link, name);
+       if (peer_name)
                rtnl_link_set_name(peer, peer_name);
-       }
 
        rtnl_link_set_ns_pid(peer, pid);
        err = rtnl_link_add(sock, link, NLM_F_CREATE | NLM_F_EXCL);