[libnfnetlink] nfnl: add nfnl_portid() to get the Netlink portID of a socket

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Sat May 23 11:30:12 CEST 2009


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=libnfnetlink.git;a=commit;h=2114ff20f8dbc2845e7d75f3c404337c061ebca5
commit 2114ff20f8dbc2845e7d75f3c404337c061ebca5
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Thu May 21 21:23:47 2009 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu May 21 21:23:47 2009 +0200

    nfnl: add nfnl_portid() to get the Netlink portID of a socket
    
    This patch adds the new interface nfnl_portid() to retrieve the
    Netlink portID that has been assigned to a given socket.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
       via  2114ff20f8dbc2845e7d75f3c404337c061ebca5 (commit)
      from  5186605c9361493ec43379a55a5422a2a25c802d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2114ff20f8dbc2845e7d75f3c404337c061ebca5
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Thu May 21 21:23:47 2009 +0200

    nfnl: add nfnl_portid() to get the Netlink portID of a socket
    
    This patch adds the new interface nfnl_portid() to retrieve the
    Netlink portID that has been assigned to a given socket.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

-----------------------------------------------------------------------

 include/libnfnetlink/libnfnetlink.h |    1 +
 src/libnfnetlink.c                  |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
This patch adds the new interface nfnl_portid() to retrieve the
Netlink portID that has been assigned to a given socket.

Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h
index f689ab0..935d903 100644
--- a/include/libnfnetlink/libnfnetlink.h
+++ b/include/libnfnetlink/libnfnetlink.h
@@ -50,6 +50,7 @@ struct nfnl_handle;
 struct nfnl_subsys_handle;
 
 extern int nfnl_fd(struct nfnl_handle *h);
+extern unsigned int nfnl_portid(const struct nfnl_handle *h);
 
 /* get a new library handle */
 extern struct nfnl_handle *nfnl_open(void);
diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
index a836de1..c1c4477 100644
--- a/src/libnfnetlink.c
+++ b/src/libnfnetlink.c
@@ -131,6 +131,16 @@ int nfnl_fd(struct nfnl_handle *h)
 	return h->fd;
 }
 
+/**
+ * nfnl_portid - returns the Netlink port ID of this socket
+ * @h: nfnetlink handler
+ */
+unsigned int nfnl_portid(const struct nfnl_handle *h)
+{
+	assert(h);
+	return h->local.nl_pid;
+}
+
 static int recalc_rebind_subscriptions(struct nfnl_handle *nfnlh)
 {
 	int i, err;



More information about the netfilter-cvslog mailing list