Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pucc-h Path: utzoo!watmath!clyde!akgua!sdcsvax!sdcrdcf!hplabs!zehntel!ihnp4!inuxc!pur-ee!CS-Mordred!Pucc-H:acg From: acg@pucc-h (Schwab) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: if_uba.c routines do not handle local net hlen of 0 Message-ID: <729@pucc-h> Date: Fri, 25-May-84 16:30:58 EDT Article-I.D.: pucc-h.729 Posted: Fri May 25 16:30:58 1984 Date-Received: Fri, 1-Jun-84 02:39:55 EDT Organization: Purdue University Computing Center Lines: 53 Xref: 1387 231 Description: If a local network interface has an hlen of 0, the routines in if_ubainit() allocate spurious pages and the if_rubaget() routine will exchange the wrong page when handling a packet greater than 1024 bytes long. Repeat-By: The pcl-11 is such a device. If you raise the mtu on the device from the default 1006 to anything greater than 1024, your network will be unusable. Fix: The following diff's fix the extraneous page allocations and the problems in if_rubaget(). - Jeff Schwab ---- if_ubainit() ------ register caddr_t cp; int i, ncl; + #ifdef PUCC + ncl = clrnd(nmr + (hlen? CLSIZE: 0)) / CLSIZE; + #else PUCC ncl = clrnd(nmr + CLSIZE) / CLSIZE; + #endif PUCC if (ifu->ifu_r.ifrw_addr) + #ifdef PUCC + cp = ifu->ifu_r.ifrw_addr - (hlen? (CLBYTES - hlen): 0); + #else PUCC cp = ifu->ifu_r.ifrw_addr - (CLBYTES - hlen); + #endif PUCC else { cp = m_clalloc(2 * ncl, MPG_SPACE); if (cp == 0) return (0); + #ifdef PUCC + ifu->ifu_r.ifrw_addr = cp + (hlen? (CLBYTES - hlen): 0); + #else PUCC ifu->ifu_r.ifrw_addr = cp + CLBYTES - hlen; + #endif PUCC ifu->ifu_w.ifrw_addr = ifu->ifu_r.ifrw_addr + ncl * CLBYTES; ------- if_rubaget() ------- ppte = &Mbmap[mtocl(p)*CLSIZE]; x = btop(cp - ifu->ifu_r.ifrw_addr); ip = (int *)&ifu->ifu_r.ifrw_mr[x]; + #ifdef PUCC + if (ifu->ifu_hlen == 0) { + ip--; + } + #endif PUCC for (i = 0; i < CLSIZE; i++) { struct pte t; t = *ppte; *ppte++ = *cpte; *cpte = t;