netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ipt_LOG: MAC address output
@ 2010-05-03 13:58 Thomas Jarosch
  2010-05-03 15:41 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Jarosch @ 2010-05-03 13:58 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-07  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03 13:58 ipt_LOG: MAC address output Thomas Jarosch
2010-05-03 15:41 ` Jan Engelhardt
2010-05-07  8:02   ` Thomas Jarosch
2010-05-07  9:31     ` Jan Engelhardt

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).