netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <rw@linutronix.de>
To: netfilter-devel@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	rostedt@goodmis.org, Richard Weinberger <richard@nod.at>
Subject: [PATCH 3/5] nf_log: Export dump_packet() and dump_mac_header() functions
Date: Wed, 18 Jan 2012 23:43:28 +0100	[thread overview]
Message-ID: <1326926610-17830-4-git-send-email-rw@linutronix.de> (raw)
In-Reply-To: <1326926610-17830-1-git-send-email-rw@linutronix.de>

From: Richard Weinberger <richard@nod.at>


Signed-off-by: Richard Weinberger <richard@nod.at>
---
 include/net/netfilter/nf_log.h |   19 +++++++++++++++++++
 net/ipv4/netfilter/ipt_LOG.c   |   12 +++++++-----
 net/ipv6/netfilter/ip6t_LOG.c  |   12 +++++++-----
 3 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index e991bd0..c0f2b27 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -61,5 +61,24 @@ void nf_log_packet(u_int8_t pf,
 		   const struct net_device *out,
 		   const struct nf_loginfo *li,
 		   const char *fmt, ...);
+struct sbuff;
+void ipt_dump_packet(struct sbuff *m,
+	const struct nf_loginfo *info,
+	const struct sk_buff *skb,
+	unsigned int iphoff);
+
+void ipt_dump_mac_header(struct sbuff *m,
+	const struct nf_loginfo *info,
+	const struct sk_buff *skb);
+
+void ip6t_dump_packet(struct sbuff *m,
+	const struct nf_loginfo *info,
+	const struct sk_buff *skb,
+	unsigned int iphoff,
+	int recurse);
+
+void ip6t_dump_mac_header(struct sbuff *m,
+	const struct nf_loginfo *info,
+	const struct sk_buff *skb);
 
 #endif /* _NF_LOG_H */
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
index d76d6c9..8ec9d2b 100644
--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -31,7 +31,7 @@ MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
 MODULE_DESCRIPTION("Xtables: IPv4 packet logging to syslog");
 
 /* One level of recursion won't kill us */
-static void dump_packet(struct sbuff *m,
+void ipt_dump_packet(struct sbuff *m,
 			const struct nf_loginfo *info,
 			const struct sk_buff *skb,
 			unsigned int iphoff)
@@ -270,7 +270,7 @@ static void dump_packet(struct sbuff *m,
 			/* Max length: 3+maxlen */
 			if (!iphoff) { /* Only recurse once. */
 				sb_add(m, "[");
-				dump_packet(m, info, skb,
+				ipt_dump_packet(m, info, skb,
 					    iphoff + ih->ihl*4+sizeof(_icmph));
 				sb_add(m, "] ");
 			}
@@ -362,8 +362,9 @@ static void dump_packet(struct sbuff *m,
 	/* maxlen =  IP + ICMP +  IP + max(TCP,UDP,ICMP,unknown) */
 	/* maxlen = 230+   91  + 230 + 252 = 803 */
 }
+EXPORT_SYMBOL_GPL(ipt_dump_packet);
 
-static void dump_mac_header(struct sbuff *m,
+void ipt_dump_mac_header(struct sbuff *m,
 			    const struct nf_loginfo *info,
 			    const struct sk_buff *skb)
 {
@@ -399,6 +400,7 @@ fallback:
 	}
 	sb_add(m, " ");
 }
+EXPORT_SYMBOL_GPL(ipt_dump_mac_header);
 
 static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
@@ -443,9 +445,9 @@ ipt_log_packet(u_int8_t pf,
 #endif
 
 	if (in != NULL)
-		dump_mac_header(m, loginfo, skb);
+		ipt_dump_mac_header(m, loginfo, skb);
 
-	dump_packet(m, loginfo, skb, 0);
+	ipt_dump_packet(m, loginfo, skb, 0);
 
 	sb_close(m);
 }
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index e6af8d7..c6abacb 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -34,7 +34,7 @@ struct in_device;
 #include <linux/netfilter_ipv6/ip6t_LOG.h>
 
 /* One level of recursion won't kill us */
-static void dump_packet(struct sbuff *m,
+void ip6t_dump_packet(struct sbuff *m,
 			const struct nf_loginfo *info,
 			const struct sk_buff *skb, unsigned int ip6hoff,
 			int recurse)
@@ -341,7 +341,7 @@ static void dump_packet(struct sbuff *m,
 			/* Max length: 3+maxlen */
 			if (recurse) {
 				sb_add(m, "[");
-				dump_packet(m, info, skb,
+				ip6t_dump_packet(m, info, skb,
 					    ptr + sizeof(_icmp6h), 0);
 				sb_add(m, "] ");
 			}
@@ -371,8 +371,9 @@ static void dump_packet(struct sbuff *m,
 	if (!recurse && skb->mark)
 		sb_add(m, "MARK=0x%x ", skb->mark);
 }
+EXPORT_SYMBOL(ip6t_dump_packet);
 
-static void dump_mac_header(struct sbuff *m,
+void ip6t_dump_mac_header(struct sbuff *m,
 			    const struct nf_loginfo *info,
 			    const struct sk_buff *skb)
 {
@@ -422,6 +423,7 @@ fallback:
 	} else
 		sb_add(m, " ");
 }
+EXPORT_SYMBOL(ip6t_dump_mac_header);
 
 static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
@@ -453,9 +455,9 @@ ip6t_log_packet(u_int8_t pf,
 	       out ? out->name : "");
 
 	if (in != NULL)
-		dump_mac_header(m, loginfo, skb);
+		ip6t_dump_mac_header(m, loginfo, skb);
 
-	dump_packet(m, loginfo, skb, skb_network_offset(skb), 1);
+	ip6t_dump_packet(m, loginfo, skb, skb_network_offset(skb), 1);
 
 	sb_close(m);
 }
-- 
1.7.7

  parent reply	other threads:[~2012-01-18 22:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 22:43 Netfilter: New target: RLOG Richard Weinberger
2012-01-18 22:43 ` [PATCH 1/5] ring_buffer: Export for_each_buffer_cpu() Richard Weinberger
2012-01-19  1:18   ` Steven Rostedt
2012-01-18 22:43 ` [PATCH 2/5] xt_log: Make printk() in sb_close() optional Richard Weinberger
2012-01-19  1:20   ` Steven Rostedt
2012-01-18 22:43 ` Richard Weinberger [this message]
2012-01-19  1:21   ` [PATCH 3/5] nf_log: Export dump_packet() and dump_mac_header() functions Steven Rostedt
2012-01-18 22:43 ` [PATCH 4/5] netfilter: Implement xt_RLOG Richard Weinberger
2012-01-18 22:43 ` [PATCH 5/5] xt_RLOG: add userspace-components Richard Weinberger
2012-01-19  9:12 ` Netfilter: New target: RLOG Pablo Neira Ayuso
2012-01-19  9:21   ` Richard Weinberger
2012-01-19  9:26     ` Eric Dumazet
2012-01-19  9:46       ` Jan Engelhardt
2012-01-19 10:31         ` Richard Weinberger
2012-01-19  9:25   ` Pablo Neira Ayuso
2012-01-19  9:29     ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326926610-17830-4-git-send-email-rw@linutronix.de \
    --to=rw@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).