From patchwork Wed Jul 15 10:55:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Klauser X-Patchwork-Id: 29806 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id BEA31B7066 for ; Wed, 15 Jul 2009 20:55:20 +1000 (EST) Received: by ozlabs.org (Postfix) id ACA2BDDDB2; Wed, 15 Jul 2009 20:55:20 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 3C774DDDA2 for ; Wed, 15 Jul 2009 20:55:20 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754082AbZGOKzL (ORCPT ); Wed, 15 Jul 2009 06:55:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754070AbZGOKzL (ORCPT ); Wed, 15 Jul 2009 06:55:11 -0400 Received: from mx2.zhaw.ch ([160.85.104.51]:50186 "EHLO mx2.zhaw.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754069AbZGOKzK (ORCPT ); Wed, 15 Jul 2009 06:55:10 -0400 Received: from mx2.zhaw.ch (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 352373A1; Wed, 15 Jul 2009 12:55:08 +0200 (CEST) Received: from localhost.localdomain (staff-klto-0.zhaw.ch [160.85.232.187]) by mx2.zhaw.ch (Postfix) with ESMTP id A81B4298; Wed, 15 Jul 2009 12:55:07 +0200 (CEST) From: Tobias Klauser To: bart.de.schuymer@pandora.be, shemminger@linux-foundation.org, kaber@trash.net, davem@davemloft.net, ebtables-devel@lists.sourceforge.net, netfilter-devel@vger.kernel.org Cc: netdev@vger.kernel.org, Tobias Klauser Subject: [PATCH] netfilter: ebtables: Use print_mac instead of own function Date: Wed, 15 Jul 2009 12:55:06 +0200 Message-Id: <1247655306-21337-1-git-send-email-klto@zhaw.ch> X-Mailer: git-send-email 1.6.0.4 X-PMX-Version: 5.5.4.371499, Antispam-Engine: 2.7.1.369594, Antispam-Data: 2009.7.15.104217 X-PerlMx-Spam: Gauge=IIIIIIII, Probability=8%, Report=' BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, TO_NO_NAME 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __STOCK_PHRASE_24 0, __STOCK_PHRASE_7 0, __TO_MALFORMED_2 0' Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ebt_log uses its own implementation of print_mac to print MAC addresses. This patch converts it to use print_mac from linux/if_ether.h Signed-off-by: Tobias Klauser --- net/bridge/netfilter/ebt_log.c | 31 +++++++++++-------------------- 1 files changed, 11 insertions(+), 20 deletions(-) diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index a94f3cc..70fd072 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -50,14 +51,6 @@ struct arppayload 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 print_ports(const struct sk_buff *skb, uint8_t protocol, int offset) { @@ -86,16 +79,16 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, const char *prefix) { unsigned int bitmask; + DECLARE_MAC_BUF(macbuf); spin_lock_bh(&ebt_log_lock); - printk("<%c>%s IN=%s OUT=%s MAC source = ", '0' + loginfo->u.log.level, - prefix, in ? in->name : "", out ? out->name : ""); - - print_MAC(eth_hdr(skb)->h_source); - printk("MAC dest = "); - print_MAC(eth_hdr(skb)->h_dest); - - printk("proto = 0x%04x", ntohs(eth_hdr(skb)->h_proto)); + printk("<%c>%s IN=%s OUT=%s MAC source = %s", + '0' + loginfo->u.log.level, prefix, + in ? in->name : "", out ? out->name : "", + print_mac(macbuf, eth_hdr(skb)->h_source)); + printk(" MAC dest = %s proto = 0x%04x", + print_mac(macbuf, eth_hdr(skb)->h_dest), + ntohs(eth_hdr(skb)->h_proto)); if (loginfo->type == NF_LOG_TYPE_LOG) bitmask = loginfo->u.log.logflags; @@ -171,11 +164,9 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, printk(" INCOMPLETE ARP payload"); goto out; } - printk(" ARP MAC SRC="); - print_MAC(ap->mac_src); + printk(" ARP MAC SRC=%s", print_mac(macbuf, ap->mac_src)); printk(" ARP IP SRC=%pI4", ap->ip_src); - printk(" ARP MAC DST="); - print_MAC(ap->mac_dst); + printk(" ARP MAC DST=%s", print_mac(macbuf, ap->mac_dst)); printk(" ARP IP DST=%pI4", ap->ip_dst); } }