libnetfilter_conntrack: Add API support for passing bound file descriptor
PATCH 1/1 libnetfilter_conntrack: Add API support for passing bound file descriptor
Add API support to accept pre-bound file descriptor from a privileged process for creating a handle. Also clean-up the handle without close the passing file descriptor. This paves the path for privilege separation.
Change-Id: I815fb20cf1aadf931679d9470e6977a45681b4c9
--- .../libnetfilter_conntrack.h | 6 ++ src/main.c | 69 +++++++++++++++++++--- 2 files changed, 68 insertions(+), 7 deletions(-)
include/libnetfilter_conntrack/libnetfilter_conntrack.h +6 -0
@@ -40,10 +40,16 @@ struct nfct_handle;* [Open|close] a conntrack handler */ extern struct nfct_handle *nfct_open (uint8_t ,unsigned ); +extern struct nfct_handle *nfct_open2 (uint8_t ,unsigned ,int );extern struct nfct_handle *nfct_open_nfnl (struct nfnl_handle *nfnlh,uint8_t subsys_id,unsigned int subscriptions); +extern struct nfct_handle *nfct_open_nfnl2 (struct nfnl_handle *nfnlh, +uint8_t subsys_id, +unsigned int subscriptions, +bool bind);extern int nfct_close (struct nfct_handle *cth); +extern int nfct_close2 (struct nfct_handle *cth,bool keep_fd);extern int nfct_fd (struct nfct_handle *cth);extern const struct nfnl_handle *nfct_nfnlh (struct nfct_handle *cth);
src/main.c +62 -7
117 lines not on this page · raw message
Signature · 1 line
1.9.1