netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: netfilter-devel@vger.kernel.org
Subject: ipt_LOG: MAC address output
Date: Mon, 3 May 2010 15:58:09 +0200	[thread overview]
Message-ID: <201005031558.09409.thomas.jarosch@intra2net.com> (raw)

Hello,

below is an ipt_LOG output from kernel 2.6.33.2:

May  3 15:14:40 intratest kernel: REJECT IN=eth0 OUT=
MAC=02:00:00:00:00:29:00:0c:76:28:3e:6c:08:00 SRC=172.16.1.1 DST=172.16.1.145 ...

The MAC address really looks strange if you take
the original data into consideration:

Source: 172.16.1.1 (00:0C:76:28:3E:6C)
Destination: 172.16.1.145 (02:00:00:00:00:29)

The corresponding code in net/ipv4/netfilter/ipt_LOG.c:

ipt_log_packet():
        if (in && !out) {
                /* MAC logging for input chain only. */
                printk("MAC=");
                if (skb->dev && skb->dev->hard_header_len
                    && 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(" ");


The current code does the following:
- Output the two MAC addresses separated by ":"
  instead of something readable like " "

- Output the destination MAC address first which
  is a bit unexpected as the first shown IP is
  the IP address of "SRC".
 
  Idea: Maybe print "MACSRC= " and "MACDST= ". Leave out
  the "MACxxx= " output if the MAC address is not known.

- Output "08:00" garbage at the end.

Could it be that "skb->dev->hard_header_len" is longer
than the MAC address header field?

Cheers,
Thomas

             reply	other threads:[~2010-05-03 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 13:58 Thomas Jarosch [this message]
2010-05-03 15:41 ` ipt_LOG: MAC address output Jan Engelhardt
2010-05-07  8:02   ` Thomas Jarosch
2010-05-07  9:31     ` Jan Engelhardt

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=201005031558.09409.thomas.jarosch@intra2net.com \
    --to=thomas.jarosch@intra2net.com \
    --cc=netfilter-devel@vger.kernel.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).