[prev in list] [next in list] [prev in thread] [next in thread]
List: ipfilter
Subject: Re: Patch for ftp proxy on BSDI
From: Scott Presnell <srp () zgi ! com>
Date: 1999-09-27 14:38:10
[Download RAW message or body]
Darren Reed wrote:
>
> Please do not laugh at how trivial this change is. For some reason,
> without that cast, the htons() on the u_char (ip->ip_p) was setting
> the upper 8 bits to non-zero and corrupting the checksum result.
>
> Darren
It might be worthwhile checking all of the IP Filter code for this
(non) promotion. I ran into a similar u_char => u_short issue in the
rcmd proxy (was fixed in 3.2.2) under NetBSD 1.4.1 (another BSD 4.4
derived unix).
Thanks.
- Scott
> Index: fil.c
> ===================================================================
> RCS file: /devel/CVS/IP-Filter/fil.c,v
> retrieving revision 2.3.2.3
> diff -c -r2.3.2.3 fil.c
> *** fil.c 1999/09/21 11:56:19 2.3.2.3
> --- fil.c 1999/09/27 14:10:04
> ***************
> *** 990,996 ****
> */
> hlen = ip->ip_hl << 2;
> slen = ip->ip_len - hlen;
> ! sum = htons(ip->ip_p);
> sum += htons(slen);
> sp = (u_short *)&ip->ip_src;
> sum += *sp++; /* ip_src */
> --- 990,996 ----
> */
> hlen = ip->ip_hl << 2;
> slen = ip->ip_len - hlen;
> ! sum = htons((u_short)ip->ip_p);
> sum += htons(slen);
> sp = (u_short *)&ip->ip_src;
> sum += *sp++; /* ip_src */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic