[PATCH nft] src: netlink: Subscribe nft monitor and nft monitor trace to respective groups.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux