Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: xt_NFLOG: use nf_log_packet instead of nfulnl_log_packet.

The nfulnl_log_packet() is added to make sure that the NFLOG target
works as only user-space logger. but now, nf_log_packet() can find proper
log function using NF_LOG_TYPE_ULOG and NF_LOG_TYPE_LOG.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Taehee Yoo and committed by
Pablo Neira Ayuso
ce20cdf4 415787d7

+14 -26
+11 -4
net/netfilter/xt_NFLOG.c
··· 13 13 #include <linux/netfilter/x_tables.h> 14 14 #include <linux/netfilter/xt_NFLOG.h> 15 15 #include <net/netfilter/nf_log.h> 16 - #include <net/netfilter/nfnetlink_log.h> 17 16 18 17 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); 19 18 MODULE_DESCRIPTION("Xtables: packet logging to netlink using NFLOG"); ··· 36 37 if (info->flags & XT_NFLOG_F_COPY_LEN) 37 38 li.u.ulog.flags |= NF_LOG_F_COPY_LEN; 38 39 39 - nfulnl_log_packet(net, xt_family(par), xt_hooknum(par), skb, 40 - xt_in(par), xt_out(par), &li, info->prefix); 40 + nf_log_packet(net, xt_family(par), xt_hooknum(par), skb, xt_in(par), 41 + xt_out(par), &li, "%s", info->prefix); 42 + 41 43 return XT_CONTINUE; 42 44 } 43 45 ··· 50 50 return -EINVAL; 51 51 if (info->prefix[sizeof(info->prefix) - 1] != '\0') 52 52 return -EINVAL; 53 - return 0; 53 + 54 + return nf_logger_find_get(par->family, NF_LOG_TYPE_ULOG); 55 + } 56 + 57 + static void nflog_tg_destroy(const struct xt_tgdtor_param *par) 58 + { 59 + nf_logger_put(par->family, NF_LOG_TYPE_ULOG); 54 60 } 55 61 56 62 static struct xt_target nflog_tg_reg __read_mostly = { ··· 64 58 .revision = 0, 65 59 .family = NFPROTO_UNSPEC, 66 60 .checkentry = nflog_tg_check, 61 + .destroy = nflog_tg_destroy, 67 62 .target = nflog_tg, 68 63 .targetsize = sizeof(struct xt_nflog_info), 69 64 .me = THIS_MODULE,