netfilter: nfnetlink_log: autoload nf_conntrack_netlink module NFQA_CFG_F_CONNTRACK...
authorKen-ichirou MATSUZAWA <chamaken@gmail.com>
Wed, 7 Oct 2015 04:25:50 +0000 (13:25 +0900)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 12 Oct 2015 19:44:12 +0000 (21:44 +0200)
This patch enables to load nf_conntrack_netlink module if
NFULNL_CFG_F_CONNTRACK config flag is specified.

Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_log.c

index e1d1187f6646fa5ce3c72340f48fb79fc371921e..f8d9bd848f79e8b146ee3789c33b1d282de1bbef 100644 (file)
@@ -927,7 +927,16 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
                }
 
                if (flags & NFULNL_CFG_F_CONNTRACK &&
-                   rcu_access_pointer(nfnl_ct_hook) == NULL) {
+                   !rcu_access_pointer(nfnl_ct_hook)) {
+#ifdef CONFIG_MODULES
+                       nfnl_unlock(NFNL_SUBSYS_ULOG);
+                       request_module("ip_conntrack_netlink");
+                       nfnl_lock(NFNL_SUBSYS_ULOG);
+                       if (rcu_access_pointer(nfnl_ct_hook)) {
+                               ret = -EAGAIN;
+                               goto out;
+                       }
+#endif
                        ret = -EOPNOTSUPP;
                        goto out;
                }