[PATCH] Runt frames dropped under RX checksum in hamachi.c

Keith Underwood keithu@parl.clemson.edu
Sun Mar 12 00:21:00 2000


On Monday (it would have been sooner, but I have encountered a myriad of
problems this week), I will make a slightly updated driver available to a
couple of people who have requested it.  Pending there results, I will
make it available on a website later in the week.  It will include Pete's
patch (or a similar one that I used to address Tony's problem).  

As an aside, let me say how surprised I was when Tony first told me
he couldn't ssh into a machine using the updated driver I sent him - and
how thankful I was when he found that Eric's driver didn't work either ;-)
It was rather disturbing that interaction with one OS was different from
another, until I saw all of the options Linux used ;-)

Anyway, off to sleep.

				Keith

On Fri, 10 Mar 2000, Pete Wyckoff wrote:

> Tony Caola brought to my attention the fact that my receive checksum
> enabling changes to the hamachi driver cause some packets to be dropped
> due to invalid checksum.  The problem was that I failed to notice that
> runt frames (< 64 bytes or so) are padded according to the ethernet spec
> up to the minimum, even on fancy full-duplex hardware like we've got.
> 
> Since there hasn't been a patch to Eric's version of Becker's driver
> for almost exactly a year, it seems due time for a version upgrade.  I
> submit a patch below.
> 
> Sorry for not replying properly.  I seem to have been removed from the
> list and did not notice.
> 
> 		-- Pete
> 
> 
> 
> --- hamachi-old.c	Thu Mar 11 06:50:04 1999
> +++ hamachi.c	Fri Mar 10 14:38:56 2000
> @@ -1394,9 +1394,14 @@
>  			/* TCP or UDP on ipv4, DIX encoding */
>  			if (pfck>>24 == 0x91 || pfck>>24 == 0x51) {
>  			    struct iphdr *ih = (struct iphdr *) skb->data;
> -			    /* don't worry about frags */
> +			    /* Don't worry about frags, and packets smaller
> +			     * than 46 bytes of IP will be padded to avoid
> +			     * runt frames, so punt if it's padded else
> +			     * checksum includes bogus pad bytes.
> +			     */
>  			    if (!(ih->frag_off
> -			      & __constant_htons(IP_MF|IP_OFFSET))) {
> +			      & __constant_htons(IP_MF|IP_OFFSET))
> +			      && ntohs(ih->tot_len) == pkt_len-14) {
>  				u32 inv = *(u32 *) &buf_addr[data_size - 16];
>  				u32 *p = (u32 *) &buf_addr[data_size - 20];
>  				u32 crc;
> 
> 
>  | To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
>  |  body of the mail, include only the text:
>  |   unsubscribe this-list-name youraddress@wherever.org
>  | You will be unsubscribed as speedily as possible.
> 
> 

 | To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
 |  body of the mail, include only the text:
 |   unsubscribe this-list-name youraddress@wherever.org
 | You will be unsubscribed as speedily as possible.