Skip to content

Commit

Permalink
netfilter: ipt_LOG/ip6t_LOG: remove comparison within loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Patrick McHardy committed Jun 28, 2010
1 parent d70a011 commit cf377eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions net/ipv4/netfilter/ipt_LOG.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/netfilter/ip6t_LOG.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ");

Expand Down

0 comments on commit cf377eb

Please sign in to comment.