Date: Thu, 16 Sep 2004 04:09:35 -0000 From: Pyun YongHyeon <yongari@kt-is.co.kr> To: pf4freebsd@freelists.org Subject: [pf4freebsd] Re: Strange problem/Need help Message-ID: <20040723083119.GA3240@kt-is.co.kr> In-Reply-To: <200407230602.34822.max@love2party.net> References: <200407230602.34822.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jul 23, 2004 at 06:02:27AM +0200, Max Laier wrote: > Hi, > > Christian S.J. Peron reported a very strange problem with pf in a recent > current kernel. It turned out (after days of brainwracking debugging) that > the problem went away by disabling the i386 optimized version of in4_cksum(). > The problem I am having with this, is that I can't explain why this > (standalone) thing would break all of a sudden (earlier kernel seemed to > work). So what I am looking for are other examples for this behavior or > possible explanations. > Hi Max, I don't know where the problem is.... :-( How about this? Instead of using hand-optimized code, it would be better to use system supplied one. This will work on icc too. I have to go out now. Please review the patch and let me know your opinions.(It wasn't tested at all.) This one can be used for a while. Personally, I really want to import NetBSD's approach. > If anybody else was/is seeing high numbers of "bad checksum" in #netstat -ssp > tcp or #netstat -ssp udp with rescent current, please try the attached patch > and report in if it fixed the problem. > > I am really really disturbed by this as I just can't explain. Hence I am > really really hoping for you to explain what's going on here or at least > providing additional data points to get an idea. Thanks in advance. > > I am not commiting this is order to keep the code exposed and hope for active > users to report! > > -- > /"\ Best regards, | mlaier@freebsd.org > \ / Max Laier | ICQ #67774661 > X http://pf4freebsd.love2party.net/ | mlaier@EFnet > / \ ASCII Ribbon Campaign | Against HTML Mail and News Best regards, Pyun YongHyeon -- Pyun YongHyeon <http://www.kr.freebsd.org/~yongari> --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="in4_cksum.c" #include <sys/param.h> #include <sys/systm.h> #include <sys/mbuf.h> #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <netinet/ip_var.h> #include <machine/in_cksum.h> #define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) #define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);} int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len) { union { struct ipovly ipov; u_int16_t w[10]; } u; union { u_int16_t s[2]; u_int32_t l; } l_util; u_int16_t *w; int psum; int sum = 0; if (nxt != 0) { /* pseudo header */ if (off < sizeof(struct ipovly)) panic("in4_cksum: offset too short"); if (m->m_len < sizeof(struct ip)) panic("in4_cksum: bad mbuf chain"); bzero(&u.ipov, sizeof(u.ipov)); u.ipov.ih_len = htons(len); u.ipov.ih_pr = nxt; u.ipov.ih_src = mtod(m, struct ip *)->ip_src; u.ipov.ih_dst = mtod(m, struct ip *)->ip_dst; w = u.w; /* assumes sizeof(ipov) == 20 */ sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; sum += w[8]; sum += w[9]; } psum = in_cksum_skip(m, len + off, off); psum = ~psum & 0xffff; sum += psum; REDUCE; return (~sum & 0xffff); } --TB36FDmn/VVEgNH/--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040723083119.GA3240>