Date: Thu, 1 May 2003 20:40:15 -0700 (PDT) From: "Dorr H. Clark" <dclark@applmath.scu.edu> To: freebsd-bugs@FreeBSD.org Subject: fix proposal Re: kern/48172: ipfw does not log size and flags Message-ID: <200305020340.h423eFC3092418@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/48172; it has been noted by GNATS. From: "Dorr H. Clark" <dclark@applmath.scu.edu> To: freebsd-gnats-submit@FreeBSD.org, 320099972051-0001@t-online.de Cc: Subject: fix proposal Re: kern/48172: ipfw does not log size and flags Date: Thu, 01 May 2003 18:09:35 -0700 Logging example before change: Mar 12 10:02:56 COEN_284 /kernel: ipfw: 400 Deny UDP 127.0.0.1:1034 127.0.0.1 out via lo0 Mar 12 10:02:56 COEN_284 /kernel: ipfw: 400 Deny TCP 192.168.0.101:1024 192.168.0.100 out via xl0 The following command is helpful: sysctl -w net.inet.ip.fw.verbose=1 Logging example after change: Mar 20 18:52:38 COEN_284 /kernel: ipfw: 400 Deny UDP 127.0.0.1:1034 127.0.0.1 id:10 ttl:64 size:67 out via lo0 Mar 20 18:52:38 COEN_284 /kernel: ipfw: 400 Deny TCP 192.168.0.101:1024 192.168.0.100 id:11 flg:2 seq:1aff3139 ack:00000000 ttl:64 size:55 out via xl0 This bug is pretty simple to fix, but it still makes a great project because of the fun of staging and testing the change. NOTE: This patch is compatible with 4.7-STABLE ! Here is the code change for this bug: --- /usr/src/sys/netinet/ip_fw.c Sun Jul 28 19:04:25 2002 +++ ip_fw.c Mon Apr 28 21:11:02 2003 @@ -570,6 +570,16 @@ if (offset == 0) snprintf(SNPARGS(proto, len), ":%d", ntohs(tcp->th_dport)); + else + len += snprintf(SNPARGS(proto,len), " "); + len += snprintf(SNPARGS(proto,len), "id:%u ",ntohs(ip->ip_id)); + len += snprintf(SNPARGS(proto,len), "flg:%x ",tcp->th_flags); + len += snprintf(SNPARGS(proto,len), "seq:%08x ",(unsigned int)ntohl(tcp->th_seq)); + len += snprintf(SNPARGS(proto,len), "ack:%08x ",(unsigned int)ntohl(tcp->th_ack)); + len += snprintf(SNPARGS(proto,len), "ttl:%u ",ip->ip_ttl); + len += snprintf(SNPARGS(proto,len), "size:%u ",ip->ip_len - +ip->ip_hl); + break; case IPPROTO_UDP: len = snprintf(SNPARGS(proto, 0), "UDP %s", @@ -584,6 +594,12 @@ if (offset == 0) snprintf(SNPARGS(proto, len), ":%d", ntohs(udp->uh_dport)); + + len += snprintf(SNPARGS(proto,len), "id:%u ",ntohs(ip->ip_id)); + len += snprintf(SNPARGS(proto,len), "ttl:%u ",ip->ip_ttl); + len += snprintf(SNPARGS(proto,len), "size:%u ",ip->ip_len - +ip->ip_hl); + break; case IPPROTO_ICMP: if (offset == 0) Jagdish Patel, engineer Dorr H. Clark, advisor COEN 284 - Operating Systems Case Study Santa Clara University, Santa Clara CA.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305020340.h423eFC3092418>