Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: D Finnigan Newsgroups: comp.sys.apple2.programmer Subject: Re: Resolved!, was Re: Uthernet receive error: bytes swapped Date: Sat, 7 Mar 2015 17:31:42 +0000 (UTC) Organization: Mac GUI Lines: 54 Message-ID: References: <0e712315-fbcb-49de-a5db-ee0bc945efd7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 7 Mar 2015 17:31:42 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ac9e0e4d7dd3957fb97803ee6801bab8"; logging-data="18156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n0q+rBf+4mHSDJR4jMESr" User-Agent: Mac GUI Usenet In-Reply-To: <0e712315-fbcb-49de-a5db-ee0bc945efd7@googlegroups.com> Cancel-Lock: sha1:0nAmQ0Re1CHv0QIrM2abHgHtR7g= Xref: csiph.com comp.sys.apple2.programmer:1553 David Schmenk wrote: > On Thursday, 5 March 2015 16:31:09 UTC-8, D Finnigan wrote: >> gids.rs wrote: >> >> What's incredible is how the checksum routine still managed to give >> >> correct >> >> results in so many cases. That's definitely one of those tricky bugs. >> >> >> > >> > >> > Maybe not so incredible. Wouldn't 10 bytes of code followed by 10 >> > bytes >> > of >> > 0's give the same checksum? >> >> I don't know. This IP checksum routine was supposed to only cover the 20 >> byte IP header. If it was running twice as long, it was either >> checksumming >> a bit of the data payload, or something else. I'm not really interested >> in >> looking into exactly what it was doing, just surprised that it was giving >> correct results in its broken state. >> > > Are you sure it was giving correct results? Yes, I had my application print a + sign if the checksum came out to be 0, and an @ if not. I also have a test suite. Granted, it involves me manually entering the test cases and verifying the result, but I trust it. This problem came when I unrolled the loop. See, I had this checksum routine verified correct by my test suite, but then I decided to unroll the loop, and that's when I started getting these occasional errors. > Most TCP/IP headers can get > away with a checksum of 0 (no checksum) so you don't need to spend time > calculating them. If you are on a local network and not putting your Apple > II on the internetz, this is probably a safe thing to do. I appreciate the advice, but I don't want to take any shortcuts in this area. I just completed and debugged the UDP checksum routine last week. Both outgoing and incoming UDP datagrams have their checksum verified or computed as necessary. -- ]DF$ Apple II Book: http://macgui.com/newa2guide/ Usenet: http://macgui.com/usenet/ <-- get posts by email! Apple II Web & Blog hosting: http://a2hq.com/