Date: Wed, 5 Oct 2005 23:00:39 GMT From: Remigiusz Hajduk <rhajduk@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/86957: [PATCH] ipfw mac logging Message-ID: <200510052300.j95N0dGE075965@www.freebsd.org> Resent-Message-ID: <200510052310.j95NAEU3060148@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 86957
>Category: kern
>Synopsis: [PATCH] ipfw mac logging
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 05 23:10:14 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Remigiusz Hajduk
>Release: 5.4-RELEASE
>Organization:
home
>Environment:
FreeBSD devel 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May 8 10:21:06 UTC 2005 root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
I added MAC address logging facility.
I think that it is useful and should be committed.
>How-To-Repeat:
>Fix:
--- sys/netinet/ip_fw2.c.orig Tue Oct 4 23:06:20 2005
+++ sys/netinet/ip_fw2.c Tue Oct 4 23:06:21 2005
@@ -665,7 +665,25 @@
}
if (hlen == 0) { /* non-ip */
- snprintf(SNPARGS(proto, 0), "MAC");
+ int len, i;
+ u_char *ptr;
+
+ len = snprintf(SNPARGS(proto, 0), "MAC ");
+
+ i = ETHER_ADDR_LEN;
+ ptr = eh->ether_dhost;
+
+ do {
+ len += snprintf(SNPARGS(proto, len), "%s%02x", (i==ETHER_ADDR_LEN) ? "" : ":", *ptr++);
+ } while(--i > 0);
+
+ i = ETHER_ADDR_LEN;
+ ptr = eh->ether_shost;
+ len += snprintf(SNPARGS(proto, len), " ");
+ do {
+ len += snprintf(SNPARGS(proto, len), "%s%02x", (i==ETHER_ADDR_LEN) ? "" : ":", *ptr++);
+ } while(--i > 0);
+
} else {
struct ip *ip = mtod(m, struct ip *);
/* these three are all aliases to the same thing */
>Release-Note:
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510052300.j95N0dGE075965>
