summaryrefslogtreecommitdiffstats
path: root/src/rtnl.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-08-13 19:49:58 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-08-13 19:50:09 +0200
commit8b15e485c0d5f4a1e56b2148a34995ed1fa9e95b (patch)
tree5512712e5fbe21eef57ab46f644e71f05c48fe5f /src/rtnl.c
parent830fcfda1900444ecfc9102415fa46fe637ddbb3 (diff)
iftable: fix incomplete list of interfaces via nlif_query
RTM_GETLINK with NLM_F_DUMP returns a multi-part netlink message. The existing code only handled the first message of it, thus, ignoring the remaining interfaces. This is the cause of the following bug in conntrackd: [Thu Aug 9 14:14:23 2012] (pid=3819) [notice] -- starting in daemon mode -- [Thu Aug 9 14:14:23 2012] (pid=3819) [ERROR] no dedicated links available! [Thu Aug 9 14:14:23 2012] (pid=3819) [ERROR] no dedicated links available! [Thu Aug 9 14:14:23 2012] (pid=3819) [ERROR] no dedicated links available! [Thu Aug 9 14:19:54 2012] (pid=3819) [notice] ---- shutdown received ---- Thanks to Jan Engelhardt for providing useful pointer to address the problem. Reported-by: Arturo Borrero <aborrero@cica.es> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rtnl.c')
-rw-r--r--src/rtnl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rtnl.c b/src/rtnl.c
index 1092c81..5ccb272 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -193,6 +193,15 @@ int rtnl_receive(struct rtnl_handle *rtnl_handle)
return 1;
}
+int rtnl_receive_multi(struct rtnl_handle *rtnl_handle)
+{
+ while (1) {
+ if (rtnl_receive(rtnl_handle) <= 0)
+ break;
+ }
+ return 1;
+}
+
/* rtnl_open - constructor of rtnetlink module */
struct rtnl_handle *rtnl_open(void)
{