Commit be39ee11 authored by Tobias Klauser's avatar Tobias Klauser Committed by Patrick McHardy

netfilter: ebtables: Use %pM conversion specifier

ebt_log uses its own implementation of print_mac to print MAC addresses.
This patch converts it to use the %pM conversion specifier for printk.
Signed-off-by: default avatarTobias Klauser <klto@zhaw.ch>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 54981279
...@@ -50,14 +50,6 @@ struct arppayload ...@@ -50,14 +50,6 @@ struct arppayload
unsigned char ip_dst[4]; unsigned char ip_dst[4];
}; };
static void print_MAC(const unsigned char *p)
{
int i;
for (i = 0; i < ETH_ALEN; i++, p++)
printk("%02x%c", *p, i == ETH_ALEN - 1 ? ' ':':');
}
static void static void
print_ports(const struct sk_buff *skb, uint8_t protocol, int offset) print_ports(const struct sk_buff *skb, uint8_t protocol, int offset)
{ {
...@@ -88,14 +80,11 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, ...@@ -88,14 +80,11 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
unsigned int bitmask; unsigned int bitmask;
spin_lock_bh(&ebt_log_lock); 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 = %pM MAC dest = %pM proto = 0x%04x",
prefix, in ? in->name : "", out ? out->name : ""); '0' + loginfo->u.log.level, prefix,
in ? in->name : "", out ? out->name : "",
print_MAC(eth_hdr(skb)->h_source); eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
printk("MAC dest = "); ntohs(eth_hdr(skb)->h_proto));
print_MAC(eth_hdr(skb)->h_dest);
printk("proto = 0x%04x", ntohs(eth_hdr(skb)->h_proto));
if (loginfo->type == NF_LOG_TYPE_LOG) if (loginfo->type == NF_LOG_TYPE_LOG)
bitmask = loginfo->u.log.logflags; bitmask = loginfo->u.log.logflags;
...@@ -171,12 +160,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, ...@@ -171,12 +160,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
printk(" INCOMPLETE ARP payload"); printk(" INCOMPLETE ARP payload");
goto out; goto out;
} }
printk(" ARP MAC SRC="); printk(" ARP MAC SRC=%pM ARP IP SRC=%pI4 ARP MAC DST=%pM ARP IP DST=%pI4",
print_MAC(ap->mac_src); ap->mac_src, ap->ip_src, ap->mac_dst, ap->ip_dst);
printk(" ARP IP SRC=%pI4", ap->ip_src);
printk(" ARP MAC DST=");
print_MAC(ap->mac_dst);
printk(" ARP IP DST=%pI4", ap->ip_dst);
} }
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment