All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danny Rathjens <gmane@rathjens.org>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH] ipt_LOG split MAC
Date: Fri, 08 Sep 2006 14:09:44 -0400	[thread overview]
Message-ID: <edsbl9$eq$1@sea.gmane.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

Is a patch like this sensible?
with the log messages currently looking like:
  IN=eth0 OUT= MAC=00:c0:49:5f:9a:0d:00:00:c5:66:00:28:08:00 SRC=72.234.128.92 DST=72.1.142.189  ...
it's hard to tell what the source or destination MAC address is.

I just split the MAC header in half, but now that I am reading more about
variable length MAC addresses I don't think that is the right way to do it.

Just spitting out the raw header seems pretty efficient, too.  Perhaps that
is by design for efficienecy as opposed to laziness? :)

[-- Attachment #2: ipt_LOG-split-MAC.patch --]
[-- Type: text/x-patch, Size: 740 bytes --]

--- net/ipv4/netfilter/ipt_LOG.c	2006-09-07 20:04:02.000000000 -0400
+++ net/ipv4/netfilter/ipt_LOG.c	2006-09-07 20:04:20.000000000 -0400
@@ -392,15 +392,19 @@
 
 	if (in && !out) {
 		/* MAC logging for input chain only. */
-		printk("MAC=");
 		if (skb->dev && skb->dev->hard_header_len
 		    && skb->mac.raw != (void*)skb->nh.iph) {
 			int i;
 			unsigned char *p = skb->mac.raw;
-			for (i = 0; i < skb->dev->hard_header_len; i++,p++)
+			for (i = 0; i < skb->dev->hard_header_len; i++,p++) {
+				if i == 0
+					printk("DSTMAC=");
+				if i == skb->dev->hard_header_len / 2
+					printk(" SRCMAC=");
 				printk("%02x%c", *p,
 				       i==skb->dev->hard_header_len - 1
 				       ? ' ':':');
+			}
 		} else
 			printk(" ");
 	}

             reply	other threads:[~2006-09-08 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-08 18:09 Danny Rathjens [this message]
2006-09-15  4:26 ` [PATCH] ipt_LOG split MAC Patrick McHardy

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='edsbl9$eq$1@sea.gmane.org' \
    --to=gmane@rathjens.org \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.