From: Varsha Rao <rvarsha016@gmail.com>
To: pablo@netfilter.org, netfilter-devel@vger.kernel.org
Subject: [PATCH nft] src: netlink: Subscribe nft monitor and nft monitor trace to respective groups.
Date: Tue, 25 Jul 2017 10:55:00 +0530 [thread overview]
Message-ID: <5976d630.c553650a.2e876.31e8@mx.google.com> (raw)
Subscribe nft monitor only to NFNLGRP_NFTABLES and nft monitor trace
only to NFNLGRP_NFTRACE. In netlink_monitor() depending on the command
call setsockopt() once.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
src/netlink.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/netlink.c b/src/netlink.c
index 9cef4c4..ccc13eb 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -3080,14 +3080,11 @@ int netlink_monitor(struct netlink_mon_handler *monhandler,
{
int group;
- group = NFNLGRP_NFTABLES;
- if (mnl_socket_setsockopt(nf_sock, NETLINK_ADD_MEMBERSHIP, &group,
- sizeof(int)) < 0)
- return netlink_io_error(monhandler->ctx, monhandler->loc,
- "Could not bind to netlink socket %s",
- strerror(errno));
+ if (monhandler->monitor_flags == (unsigned int)-1)
+ group = NFNLGRP_NFTABLES;
+ else
+ group = NFNLGRP_NFTRACE;
- group = NFNLGRP_NFTRACE;
if (mnl_socket_setsockopt(nf_sock, NETLINK_ADD_MEMBERSHIP, &group,
sizeof(int)) < 0)
return netlink_io_error(monhandler->ctx, monhandler->loc,
--
2.9.4
next reply other threads:[~2017-07-25 5:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-25 5:25 Varsha Rao [this message]
2017-07-25 16:06 ` [PATCH nft] src: netlink: Subscribe nft monitor and nft monitor trace to respective groups Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5976d630.c553650a.2e876.31e8@mx.google.com \
--to=rvarsha016@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).