kern/86957: [PATCH] ipfw mac logging
Remigiusz Hajduk
rhajduk at gmail.com
Wed Oct 5 16:10:16 PDT 2005
>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 at 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:
More information about the freebsd-bugs
mailing list