summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-06-21 11:34:28 +0200
committerThomas Graf <tgraf@suug.ch>2011-06-21 11:34:28 +0200
commitdba0e91a09dcd928ebc4e8ce4db8cc6cd471d8f9 (patch)
tree2a15f4a6875051ef5bbbcd51d9d279870eb67a0a
parent4806c5c058ba95b0c88af7731d26dad427d2fcb8 (diff)
parentca0fc75580512ccb5931fe1e05092c6c52a4e99c (diff)
downloadlibnl-dba0e91a09dcd928ebc4e8ce4db8cc6cd471d8f9.tar.gz
Merge branch 'master' of master.kernel.org:/pub/scm/libs/netlink/libnl
-rw-r--r--lib/nl.c10
-rw-r--r--lib/route/neigh.c3
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/nl.c b/lib/nl.c
index f5f94e3..fc70374 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -101,14 +101,20 @@
* Creates a netlink socket using the specified protocol, binds the socket
* and issues a connection attempt.
*
+ * @note SOCK_CLOEXEC is set on the socket if available.
+ *
* @return 0 on success or a negative error code.
*/
int nl_connect(struct nl_sock *sk, int protocol)
{
- int err;
+ int err, flags = 0;
socklen_t addrlen;
- sk->s_fd = socket(AF_NETLINK, SOCK_RAW, protocol);
+#ifdef SOCK_CLOEXEC
+ flags |= SOCK_CLOEXEC;
+#endif
+
+ sk->s_fd = socket(AF_NETLINK, SOCK_RAW | flags, protocol);
if (sk->s_fd < 0) {
err = -nl_syserr2nlerr(errno);
goto errout;
diff --git a/lib/route/neigh.c b/lib/route/neigh.c
index 0cd0366..7985d34 100644
--- a/lib/route/neigh.c
+++ b/lib/route/neigh.c
@@ -465,6 +465,9 @@ static int build_neigh_msg(struct rtnl_neigh *tmpl, int cmd, int flags,
nhdr.ndm_family = nl_addr_get_family(tmpl->n_dst);
+ if (tmpl->ce_mask & NEIGH_ATTR_FLAGS)
+ nhdr.ndm_flags = tmpl->n_flags;
+
if (tmpl->ce_mask & NEIGH_ATTR_STATE)
nhdr.ndm_state = tmpl->n_state;