[Patch v3 5/5] add NLM_F_EXCL to rtnl_link_veth_add()

Cong Wang xiyou.wangcong at gmail.com
Tue Apr 1 18:03:33 PDT 2014


rtnl_link_veth_add() is a helper API we provide, it makes sense to
set NLM_F_EXCL for it since it doesn't accept flags as a parameter.

BTW, correct an indention too.

Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
---
 lib/route/link/veth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/route/link/veth.c b/lib/route/link/veth.c
index b2cfa54..19c84f8 100644
--- a/lib/route/link/veth.c
+++ b/lib/route/link/veth.c
@@ -286,10 +286,10 @@ int rtnl_link_veth_add(struct nl_sock *sock, const char *name,
 	}
 
 	rtnl_link_set_ns_pid(peer, pid);
-	err = rtnl_link_add(sock, link, NLM_F_CREATE);
+	err = rtnl_link_add(sock, link, NLM_F_CREATE | NLM_F_EXCL);
 
 	rtnl_link_put(link);
-        return err;
+	return err;
 }
 
 /** @} */
-- 
1.7.11.7




More information about the libnl mailing list