* [PATCH 1/2] netfilter: ipt_LOG/ip6t_LOG: remove comparison within loop
@ 2010-06-25 11:39 Patrick McHardy
0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2010-06-25 11:39 UTC (permalink / raw)
To: Netfilter Developer Mailing List
[-- Attachment #1: Type: text/plain, Size: 52 bytes --]
Updated patchset incorporating Jan's suggestions.
[-- Attachment #2: 01.diff --]
[-- Type: text/x-diff, Size: 1604 bytes --]
commit bc4836711abb7695375acc9ade379c730a87684e
Author: Patrick McHardy <kaber@trash.net>
Date: Fri Jun 25 13:20:23 2010 +0200
netfilter: ipt_LOG/ip6t_LOG: remove comparison within loop
Remove the comparison within the loop to print the macheader by prepending
the colon to all but the first printk.
Based on suggestion by Jan Engelhardt <jengelh@medozas.de>.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
index 5234f4f..0a452a5 100644
--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -411,12 +411,12 @@ ipt_log_packet(u_int8_t pf,
skb->mac_header != skb->network_header) {
int i;
const unsigned char *p = skb_mac_header(skb);
- for (i = 0; i < skb->dev->hard_header_len; i++,p++)
- printk("%02x%c", *p,
- i==skb->dev->hard_header_len - 1
- ? ' ':':');
- } else
- printk(" ");
+
+ printk("%02x", *p++);
+ for (i = 1; i < skb->dev->hard_header_len; i++, p++)
+ printk(":%02x", *p);
+ }
+ printk(" ");
}
dump_packet(loginfo, skb, 0);
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index af4ee11..4c7ddac 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -414,9 +414,9 @@ ip6t_log_packet(u_int8_t pf,
p = NULL;
if (p != NULL) {
- for (i = 0; i < len; i++)
- printk("%02x%s", p[i],
- i == len - 1 ? "" : ":");
+ printk("%02x", *p++);
+ for (i = 1; i < len; i++)
+ printk(":%02x", p[i]);
}
printk(" ");
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-25 11:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 11:39 [PATCH 1/2] netfilter: ipt_LOG/ip6t_LOG: remove comparison within loop Patrick McHardy
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).