Unifiy logging in netfilter using nf_log, take #1
Subsystems (4)
RFC PATCH 1/1 Unifiy logging in netfilter using nf_log, take #1
[PATCH][RFC] Unifiy logging in netfilter using nf_log, take #1
Although nf_log is meant as a general logging API for netfilter, not every module uses it. Furthermore modules can interfere with the logging of other modules. This patch (against net-2.6.17) tries to eliminate these problems.
* Everything uses nf_log.c as logging API (excpect the obsolete ULOG targets)
* Loggers in nf_log.c are stackable. More than one logger can be registered per PF
* nf_loginfo struct has been changed. Instead of the type field and the union there is a "backends" field now that contains a bitmask specifing which backends should process/log this packet.
* ipt_LOGc and ip6t_LOG.c have been splitted:
* xt_LOG.c now contains the targets. The targets
always use nf_log for logging. These should be the only logging targets. They take care of setting up nf_loginfo for logging to syslog and/or to other backends
* ip_log_syslog.c and ip6_log_syslog.c are new and contain the syslog log backends. When these modules are loaded, the syslog backend is registered with nf_log
* The backends (nfnetlink_log, ip_log_syslog, ip6_log_syslog, ebt_LOG) check the backends field of nf_loginfo to see if they should handle the packet
* The ULOG targets have been changed to be self-contained and independent from nf_log API. They are the _only_ modules that do not use nf_log
What the LOG targets for v4 and v6 can do from a userspace / iptables point of view:
* Log to syslog (allows you to specify the flags)
* Log to nfnetlink_log (allows you to specify the loggroup)
* Log to syslog and nfnetlink_log
===> One LOG target fits all.
Things TODO:
* ebt_log is always using the syslog backend. Furthermore the code there isn't split into the syslog logger and the target
* change userspace iptables, so it can utilize the new stuff. Patch will follow soon
* thoroughly test the patch
POTENTIAL PROBLEMS / ALTERNATIVE SOLUTION
* ipt_log_info and ip6t_log_info have been replaced by xt_log_info (which has changed in size). This means iptables must be recompiled and older iptables versions won't work with these changes.
If this is considered a problem the only solution I can think of, is not to change the old LOG targets and introduce a new, general purpose target, that can do what the LOG target in this patch can to.
=====================================================================
include/linux/netfilter.h +11 -15
@@ -123,22 +123,18 @@ extern struct list_head nf_hooks[NPROTO]#define NF_LOG_UID 0x08/* Log UID owning local socket */ #define NF_LOG_MASK 0x0f -#define NF_LOG_TYPE_LOG 0x01 -#define NF_LOG_TYPE_ULOG 0x02 +#define NF_LOG_BACKEND_SYSLOG 0x01 +#define NF_LOG_BACKEND_NFLOG 0x02 +#define NF_LOG_BACKEND_MASK (NF_LOG_BACKEND_SYSLOG|NF_LOG_BACKEND_NFLOG)struct nf_loginfo { -u_int8_t type; -union { -struct { -u_int32_t copy_len; -u_int16_t group; -u_int16_t qthreshold; - } ulog; -struct { -u_int8_t level; -u_int8_t logflags; - } log; - } u; +u_int8_t backends;/* ORed from NF_LOG_BACKEND* */ +/* nflog backend */ +u_int16_t group; +u_int16_t qthreshold; +/* SYSLOG backend */ +u_int8_t level; +u_int8_t logflags; }; typedef void nf_logfn(unsigned int pf,
@@ -157,7 +153,7 @@ struct nf_logger {/* Function to register/unregister log function. */ int nf_log_register (int pf,struct nf_logger *logger); -int nf_log_unregister_pf (int pf); +int nf_log_unregister_pf (int pf,struct nf_logger *logger);void nf_log_unregister_logger (struct nf_logger *logger);/* Calls the registered backend logging function */
include/linux/netfilter/xt_LOG.h new file +26 -0
@@ -0,0 +1,26 @@ +/* iptables module for logging / LOG target +* +* (C) 2006 Gregor Maier <[email protected]> +* +* This software is distributed under GNU GPL v2, 1991 +* +*/ +#ifndef _XT_LOG_TARGET_H +#define _XT_LOG_TARGET_H + +/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ +#define XT_LOG_TCPSEQ 0x01/* Log TCP sequence numbers */ +#define XT_LOG_TCPOPT 0x02/* Log TCP options */ +#define XT_LOG_IPOPT 0x04/* Log IP options */ +#define XT_LOG_UID 0x08/* Log UID owning local socket */ +#define XT_LOG_MASK 0x0f + +struct xt_log_info { +u_int16_t group; +unsigned char backends; +unsigned char level; +unsigned char logflags; +char prefix[30 ]; +}; + +#endif /* _XT_LOG_TARGET_H */
include/linux/netfilter_bridge/ebt_log.h +1 -1
@@ -4,7 +4,7 @@#define EBT_LOG_IP 0x01/* if the frame is made by ip, log the ip information */ #define EBT_LOG_ARP 0x02#define EBT_LOG_NFLOG 0x04 -#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP) +#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_NFLOG)#define EBT_LOG_PREFIX_SIZE 30#define EBT_LOG_WATCHER "log"
net/bridge/netfilter/Makefile +1 -1
@@ -29,4 +29,4 @@ obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_sna # watchers obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_log.o -obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_ulog.o +obj-$(CONFIG_BRIDGE_EBT_ULOG) += ebt_ulog.o
net/bridge/netfilter/ebt_log.c +13 -13
@@ -67,8 +67,13 @@ ebt_log_packet(unsigned int pf, unsigned {unsigned int bitmask; +if (!loginfo) +return ;/* FIXME: we should add a default_loginfo here */ +if (!(loginfo->backends &NF_LOG_BACKEND_SYSLOG )) +return ; +spin_lock_bh (&ebt_log_lock); -printk ("<%c>%s IN=%s OUT=%s MAC source = " ,'0' + loginfo->u.log.level, +printk ("<%c>%s IN=%s OUT=%s MAC source = " ,'0' + loginfo->level, prefix, in ? in->name :"" , out ? out->name :"" );print_MAC (eth_hdr (skb)->h_source);
@@ -77,10 +82,7 @@ ebt_log_packet(unsigned int pf, unsignedprintk ("proto = 0x%04x" ,ntohs (eth_hdr (skb)->h_proto)); -if (loginfo->type ==NF_LOG_TYPE_LOG ) - bitmask = loginfo->u.log.logflags; -else - bitmask =NF_LOG_MASK ; + bitmask = loginfo->logflags;if ((bitmask &EBT_LOG_IP ) &ð_hdr (skb)->h_proto ==htons (ETH_P_IP )){
@@ -162,16 +164,14 @@ static void ebt_log(const struct sk_buffstruct ebt_log_info *info = (struct ebt_log_info *)data;struct nf_loginfo li; - li.type =NF_LOG_TYPE_LOG ; - li.u.log.level = info->loglevel; - li.u.log.logflags = info->bitmask; + li.backends =NF_LOG_BACKEND_SYSLOG ;/* currently only syslog backend supported */ + li.level = info->loglevel; +/* XXX: info->bitmask is 32 bit, logflas only 8 +* Currently it's not a problem, since only 3 falgs are defined, but nevertheless */ + li.logflags = info->bitmask; -if (info->bitmask &EBT_LOG_NFLOG ) -nf_log_packet (PF_BRIDGE , hooknr, skb, in, out, &li, +nf_log_packet (PF_BRIDGE , hooknr, skb, in, out, &li, info->prefix); -else -ebt_log_packet (PF_BRIDGE , hooknr, skb, in, out, &li, - info->prefix); } static struct ebt_watcher log =
net/bridge/netfilter/ebt_ulog.c +0 -36
@@ -218,28 +218,6 @@ alloc_failure: goto unlock; } -/* this function is registered with the netfilter core */ -static void ebt_log_packet (unsigned int pf,unsigned int hooknum, -const struct sk_buff *skb,const struct net_device *in, -const struct net_device *out,const struct nf_loginfo *li, -const char *prefix) -{ -struct ebt_ulog_info loginfo; - -if (!li || li->type !=NF_LOG_TYPE_ULOG ) { - loginfo.nlgroup =EBT_ULOG_DEFAULT_NLGROUP ; - loginfo.cprange =0 ; - loginfo.qthreshold =EBT_ULOG_DEFAULT_QTHRESHOLD ; - loginfo.prefix[0 ] ='\0' ; - }else { - loginfo.nlgroup = li->u.ulog.group; - loginfo.cprange = li->u.ulog.copy_len; - loginfo.qthreshold = li->u.ulog.qthreshold; -strlcpy (loginfo.prefix, prefix,sizeof (loginfo.prefix)); - } - -ebt_ulog_packet (hooknum, skb, in, out, &loginfo, prefix); -} static void ebt_ulog(const struct sk_buff *skb, unsigned int hooknr, const struct net_device *in, const struct net_device *out,
@@ -275,12 +253,6 @@ static struct ebt_watcher ulog = { .me = THIS_MODULE, }; -static struct nf_logger ebt_ulog_logger = { - .name =EBT_ULOG_WATCHER , - .logfn = &ebt_log_packet, - .me =THIS_MODULE , -}; -static int __init init (void ) {int i, ret =0 ;
@@ -306,13 +278,6 @@ static int __init init(void)else if ((ret =ebt_register_watcher (&ulog)))sock_release (ebtulognl->sk_socket); -if (nf_log_register (PF_BRIDGE , &ebt_ulog_logger) <0 ) { -printk (KERN_WARNING "ebt_ulog: not logging via ulog " -"since somebody else already registered for PF_BRIDGE\n" ); -/* we cannot make module load fail here, since otherwise -* ebtables userspace would abort */ - } -return ret; }
@@ -321,7 +286,6 @@ static void __exit fini(void)ebt_ulog_buff_t *ub;int i; -nf_log_unregister_logger (&ebt_ulog_logger);ebt_unregister_watcher (&ulog);for (i =0 ; i <EBT_ULOG_MAXNLGROUPS ; i++) { ub = &ulog_buffers[i];
net/ipv4/netfilter/Kconfig +11 -9
@@ -313,6 +313,17 @@ config IP_NF_FILTER local output. See the man page for iptables(8). To compile it as a module, choose M here. If unsure, say N. + +config IP_NF_LOG_SYSLOG + tristate "Syslog backend for LOG target" + depends on IP_NF_IPTABLES + help + This option adds a log backend, which allows you to create rules in + any iptables table which records the packet header to the syslog. + See NF_XTABLES_TARGET_LOG + + To compile it as a module, choose M here. If unsure, say N. + config IP_NF_TARGET_REJECT tristate "REJECT target support"
@@ -324,15 +335,6 @@ config IP_NF_TARGET_REJECT To compile it as a module, choose M here. If unsure, say N. -config IP_NF_TARGET_LOG - tristate "LOG target support" - depends on IP_NF_IPTABLES - help - This option adds a `LOG' target, which allows you to create rules in - any iptables table which records the packet header to the syslog. - - To compile it as a module, choose M here. If unsure, say N. - config IP_NF_TARGET_ULOG tristate "ULOG target support (OBSOLETE)" depends on IP_NF_IPTABLES
net/ipv4/netfilter/Makefile +3 -1
@@ -45,6 +45,9 @@ obj-$(CONFIG_IP_NF_MANGLE) += iptable_ma obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o +# Syslog backend support +obj-$(CONFIG_IP_NF_LOG_SYSLOG) += ip_log_syslog.o + # matches obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
@@ -68,7 +71,6 @@ obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += i obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o -obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
net/ipv4/netfilter/ip_log_syslog.c new file +437 -0
437 lines not on this page · raw message
net/ipv4/netfilter/ipt_ULOG.c +1 -35
@@ -15,6 +15,7 @@* 2002/10/30 fix uninitialized mac_len field - <Anders K. Pedersen> * 2004/10/25 fix erroneous calculation of 'len' parameter to NLMSG_PUT * resulting in bogus 'error during NLMSG_PUT' messages. +* 2006/03/04 make ULOG self-contained without interaction with nf_log * * (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <[email protected]>
@@ -313,31 +314,6 @@ static unsigned int ipt_ulog_target(strureturn IPT_CONTINUE ; } -static void ipt_logfn (unsigned int pf, -unsigned int hooknum, -const struct sk_buff *skb, -const struct net_device *in, -const struct net_device *out, -const struct nf_loginfo *li, -const char *prefix) -{ -struct ipt_ulog_info loginfo; - -if (!li || li->type !=NF_LOG_TYPE_ULOG ) { - loginfo.nl_group =ULOG_DEFAULT_NLGROUP ; - loginfo.copy_range =0 ; - loginfo.qthreshold =ULOG_DEFAULT_QTHRESHOLD ; - loginfo.prefix[0 ] ='\0' ; - }else { - loginfo.nl_group = li->u.ulog.group; - loginfo.copy_range = li->u.ulog.copy_len; - loginfo.qthreshold = li->u.ulog.qthreshold; -strlcpy (loginfo.prefix, prefix,sizeof (loginfo.prefix)); - } - -ipt_ulog_packet (hooknum, skb, in, out, &loginfo, prefix); -} - static int ipt_ulog_checkentry(const char *tablename, const void *e, const struct xt_target *target,
@@ -368,12 +344,6 @@ static struct ipt_target ipt_ulog_reg = .me = THIS_MODULE, }; -static struct nf_logger ipt_ulog_logger = { - .name ="ipt_ULOG" , - .logfn = ipt_logfn, - .me =THIS_MODULE , -}; -static int __init init (void ) {int i;
@@ -401,8 +371,6 @@ static int __init init(void)sock_release (nflognl->sk_socket);return -EINVAL ; } -if (nflog) -nf_log_register (PF_INET , &ipt_ulog_logger);return 0 ; }
@@ -414,8 +382,6 @@ static void __exit fini(void)DEBUGP ("ipt_ULOG: cleanup_module\n" ); -if (nflog) -nf_log_unregister_logger (&ipt_ulog_logger);ipt_unregister_target (&ipt_ulog_reg);sock_release (nflognl->sk_socket);
net/ipv6/netfilter/Kconfig +6 -4
@@ -144,15 +144,17 @@ config IP6_NF_FILTER To compile it as a module, choose M here. If unsure, say N. -config IP6_NF_TARGET_LOG - tristate "LOG target support" - depends on IP6_NF_FILTER +config IP6_NF_LOG_SYSLOG + tristate "Syslog backend for LOG target" + depends on IP_NF_IPTABLES help - This option adds a `LOG' target, which allows you to create rules in + This option adds a log backend, which allows you to create rules in any iptables table which records the packet header to the syslog. + See NF_XTABLES_TARGET_LOG To compile it as a module, choose M here. If unsure, say N. + config IP6_NF_TARGET_REJECT tristate "REJECT target support" depends on IP6_NF_FILTER
net/ipv6/netfilter/Makefile +1 -1
@@ -4,6 +4,7 @@ # Link order matters here. obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o +obj-$(CONFIG_IP6_NF_LOG_SYSLOG) += ip6_log_syslog.o obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o ip6t_dst.o obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o
@@ -16,7 +17,6 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_ obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o -obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
net/ipv6/netfilter/ip6_log_syslog.c new file +449 -0
449 lines not on this page · raw message
net/netfilter/Kconfig +11 -0
@@ -136,6 +136,17 @@ config NETFILTER_XT_TARGET_CONNMARK <file:Documentation/modules.txt>. The module will be called ipt_CONNMARK.o. If unsure, say `N'. +config NETFILTER_XT_TARGET_LOG + tristate '"LOG" target Support' + depends on NETFILTER_XTABLES + help + This option adds a `LOG' target, which allows you to create rules in + any iptables table which records the packet registered loggers like + NETFILTER_NETLINK_LOG, IP_NF_LOG_SYSLOG or IP6_NF_LOG_SYSLOG. + + To compile it as a module, choose M here. If unsure, say `N'. + + config NETFILTER_XT_TARGET_MARK tristate '"MARK" target support' depends on NETFILTER_XTABLES
net/netfilter/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tab # targets obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o +obj-$(CONFIG_NETFILTER_XT_TARGET_LOG) += xt_LOG.o obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o
net/netfilter/nf_log.c +72 -30
179 lines not on this page · raw message
net/netfilter/nfnetlink_log.c +10 -8
@@ -574,6 +574,7 @@ nfattr_failure:#define RCV_SKB_FAIL (err) do { netlink_ack(skb, nlh, (err)); return; } while (0) +/* static struct nf_loginfo default_loginfo = { .type = NF_LOG_TYPE_ULOG, .u = {
@@ -584,6 +585,7 @@ static struct nf_loginfo default_loginfo}, }, }; +*/ /* log handler for internal netfilter logging api */ static void
@@ -601,17 +603,17 @@ nfulnl_log_packet(unsigned int pf,unsigned int qthreshold;unsigned int nlbufsiz; -if (li_user && li_user->type ==NF_LOG_TYPE_ULOG ) +if (li_user && (li_user->backends &NF_LOG_BACKEND_NFLOG )) li = li_user; -else - li = &default_loginfo; +else /* This packet is none of our buisness */ +return ; - inst =instance_lookup_get (li->u.ulog.group); + inst =instance_lookup_get (li->group);if (!inst) inst =instance_lookup_get (0 );if (!inst) {PRINTR ("nfnetlink_log: trying to log packet, " -"but no instance for group %u\n" , li->u.ulog.group); +"but no instance for group %u\n" , li->group);return ; }
@@ -644,8 +646,8 @@ nfulnl_log_packet(unsigned int pf, qthreshold = inst->qthreshold;/* per-rule qthreshold overrides per-instance */ -if (qthreshold > li->u.ulog.qthreshold) - qthreshold = li->u.ulog.qthreshold; +if (qthreshold > li->qthreshold) + qthreshold = li->qthreshold;switch (inst->copy_mode) {case NFULNL_COPY_META :
@@ -848,7 +850,7 @@ nfulnl_recv_config(struct sock *ctnl, stUDEBUG ("unregistering log handler for pf=%u\n" , pf);/* This is a bug and a feature. We cannot unregister * other handlers, like nfnetlink_inst can */ -nf_log_unregister_pf (pf); +nf_log_unregister_pf (pf, &nfulnl_logger);break ;default : ret = -EINVAL ;
net/netfilter/xt_LOG.c new file +136 -0
136 lines not on this page · raw message
Re: [PATCH][RFC] Unifiy logging in netfilter using nf_log, take #1.1
A small change to be applied on top of the take #1 patch.
cu
Gregor
[PATCH] Add defines in xt_LOG.h, that are needed by the userspace iptables program.
=====================================================================
include/linux/netfilter/xt_LOG.h +18 -1
@@ -8,13 +8,30 @@ #ifndef _XT_LOG_TARGET_H #define _XT_LOG_TARGET_H -/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ +/* make sure not to change this without changing netfilter.h:XT_LOG_* (!) */ +#define XT_LOG_BACKEND_SYSLOG 0x01 +#define XT_LOG_BACKEND_NFLOG 0x02 +#define XT_LOG_BACKEND_MASK (XT_LOG_BACKEND_SYSLOG|XT_LOG_BACKEND_NFLOG) + +/* make sure not to change this without changing netfilter.h:XT_LOG_* (!) */ #define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define XT_LOG_TCPOPT 0x02 /* Log TCP options */ #define XT_LOG_IPOPT 0x04 /* Log IP options */ #define XT_LOG_UID 0x08 /* Log UID owning local socket */ #define XT_LOG_MASK 0x0f +#define IPT_LOG_TCPSEQ XT_LOG_TCPSEQ /* Log TCP sequence numbers */ +#define IPT_LOG_TCPOPT XT_LOG_TCPOPT /* Log TCP options */ +#define IPT_LOG_IPOPT XT_LOG_IPOPT /* Log IP options */ +#define IPT_LOG_UID XT_LOG_UID /* Log UID owning local socket */ +#define IPT_LOG_MASK XT_LOG_MASK + +#define IP6T_LOG_TCPSEQ XT_LOG_TCPSEQ /* Log TCP sequence numbers */ +#define IP6T_LOG_TCPOPT XT_LOG_TCPOPT /* Log TCP options */ +#define IP6T_LOG_IPOPT XT_LOG_IPOPT /* Log IP options */ +#define IP6T_LOG_UID XT_LOG_UID /* Log UID owning local socket */ +#define IP6T_LOG_MASK XT_LOG_MASK + struct xt_log_info { u_int16_t group; unsigned char backends;
Re: [PATCH][RFC] iptables patch for: Unifiy logging in netfilter using nf_log, take #1
In reply to Gregor Maier[PATCH][RFC] This patch adds support for the modified LOG targets from the nf-log-unification patch.
* Support for syslog and libnetfilter_log backend
* The nf-log backends can be combined (log to one
backend, log to both, log to none)
* semantics of "old" LOG target are preserved
===================================================================
linux/netfilter/xt_LOG.h +23 -0
@@ -0,0 +1,23 @@ +/* iptables module for logging / LOG target +* +* (C) 2006 Gregor Maier <[email protected]> +* +* This software is distributed under GNU GPL v2, 1991 +* +*/ +#ifndef _XT_LOG_TARGET_H +#define _XT_LOG_TARGET_H + +/* This file intentionally left empty +* +* When the kernel doesn't provive xt_LOG.h this file will +* be included, so the preprocessor won't complain +* +* In the "real" xt_LOG.h file XT_LOG_BACKEND_SYSLOG is defined +* and we use this to determine if the xt_LOG target is used +* or the ipt_LOG, ip6t_LOG targets +* +* XXX: There must be a way to do this more nicely +*/ + +#endif /* _XT_LOG_TARGET_H */
libip6t_LOG.c +157 -42
305 lines not on this page · raw message
libip6t_LOG.man +27 -10
@@ -1,22 +1,39 @@ Turn on kernel logging of matching packets. When this option is set -for a rule, the Linux kernel will print some information on all -matching packets (like most IPv6 IPv6-header fields) via the kernel log -(where it can be read with +for a rule, the Linux kernel logs this packet to all specified logging +backends. There is a syslog backend, which prints some +information on matching packets (like most IPv6 header fields) via the +kernel log (where it can be read with .I dmesg or .IR syslogd (8)). -This is a "non-terminating target", i.e. rule traversal continues at -the next rule. So if you want to LOG the packets you refuse, use two -separate rules with the same matching criteria, first using target LOG -then DROP (or REJECT). +The other backend is nfnetlink_log, which passes +packets to userspace to be handled there. Userspace processes my +subsribe to various log groups and receive the packets. A packet can be +logged to any number of backends. Default is to log only to the syslog +backend. +This is a "non-terminating target", i.e. rule traversal +continues at the next rule. So if you want to LOG the packets you +refuse, use two separate rules with the same matching criteria, first +using target LOG then DROP (or REJECT). .TP -.BI "--log-level " "level" -Level of logging (numeric or see \fIsyslog.conf\fP(5)). -.TP .BI "--log-prefix " "prefix" Prefix log messages with the specified prefix; up to 29 letters long, and useful for distinguishing messages in the logs. .TP +.B --log-no-syslog +Do not log to syslog backend. +.TP +.B Options for nfnetlink_log backend +.TP +.BI "--log-group " "group" +Log this packet to nfnetlink_log backend. Group specifies the log group for +this target. +.TP +.B Options for syslog backend +.TP +.BI "--log-level " "level" +Level of logging (numeric or see \fIsyslog.conf\fP(5)). +.TP .B --log-tcp-sequence Log TCP sequence numbers. This is a security risk if the log is readable by users.
libipt_LOG.c +152 -37
287 lines not on this page · raw message
libipt_LOG.man +27 -10
@@ -1,22 +1,39 @@ Turn on kernel logging of matching packets. When this option is set -for a rule, the Linux kernel will print some information on all -matching packets (like most IP header fields) via the kernel log -(where it can be read with +for a rule, the Linux kernel logs this packet to all specified logging +backends. There is a syslog backend, which prints some +information on matching packets (like most IP header fields) via the +kernel log (where it can be read with .I dmesg or .IR syslogd (8)). -This is a "non-terminating target", i.e. rule traversal continues at -the next rule. So if you want to LOG the packets you refuse, use two -separate rules with the same matching criteria, first using target LOG -then DROP (or REJECT). +The other backend is nfnetlink_log, which passes +packets to userspace to be handled there. Userspace processes my +subsribe to various log groups and receive the packets. A packet can be +logged to any number of backends. Default is to log only to the syslog +backend. +This is a "non-terminating target", i.e. rule traversal +continues at the next rule. So if you want to LOG the packets you +refuse, use two separate rules with the same matching criteria, first +using target LOG then DROP (or REJECT). .TP -.BI "--log-level " "level" -Level of logging (numeric or see \fIsyslog.conf\fP(5)). -.TP .BI "--log-prefix " "prefix" Prefix log messages with the specified prefix; up to 29 letters long, and useful for distinguishing messages in the logs. .TP +.B --log-no-syslog +Do not log to syslog backend. +.TP +.B Options for nfnetlink_log backend +.TP +.BI "--log-group " "group" +Log this packet to nfnetlink_log backend. Group specifies the log group for +this target. +.TP +.B Options for syslog backend +.TP +.BI "--log-level " "level" +Level of logging (numeric or see \fIsyslog.conf\fP(5)). +.TP .B --log-tcp-sequence Log TCP sequence numbers. This is a security risk if the log is readable by users.
Makefile +1 -1
@@ -12,7 +12,7 @@ TOPLEVEL_INCLUDED=YES ifndef KERNEL_DIR -KERNEL_DIR=/usr/src/linux +KERNEL_DIR=/usr/src/linux-2.6.15.2 endif IPTABLES_VERSION:=1.3.5 OLD_IPTABLES_VERSION:=1.3.4