Subject: Interlan ether driver crashes UNIBUS systems (#217) Index: sys/pdpif/if_il.c 2.11BSD Description: When the Interlan driver's attach entry point (ilattach) is called UNIBUS based systems (pdp-11/44) crash. Repeat-By: Install a Interlan 1010 in a UNIBUS system. Fix: The check for a UNIBUS Map being present was being skipped because 'startnet' (physical starting address of the networking data segment) had already been calculated earlier (at net image load time). If not on a UNIBUS based system there is no 'ber' register associated with the NI1010 - referencing that register causes a unexpected fault. The capability to output trailer packets was removed. The ability to receive them had been gone for a number of years, and most of the other network drivers have had trailer capability removed long ago. To apply this patch: 1) Cut where indicated and save to a file (/tmp/foo) 2) patch -p0 < /tmp/foo ============================cut here========================= *** /sys/pdpif/if_il.c.old Sat Dec 17 23:21:10 1994 --- /sys/pdpif/if_il.c Fri Jan 6 21:40:23 1995 *************** *** 3,10 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)if_il.c 2.1 (2.11BSD GTE) 12/17/94 * * 12/29/92 - sms: remove Q22 ifdefs, replacing them with runtime tests * for a Unibus Map. * 2.11BSD - Remove ilreset since that's a vax'ism and is never --- 3,16 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)if_il.c 2.2 (2.11BSD GTE) 1/6/95 * + * 1/6/95 - sms: start of network data was already computed in sys_net.c, + * it should no longer be done in this driver. Using 'startnet' + * as an initialization done flag caused the driver to skip + * testing for a UNIBUS MAP on an 11/44. *crash*. + * Trailer output capability was removed (it was already gone from + * the receive routine as well as several other ether drivers). * 12/29/92 - sms: remove Q22 ifdefs, replacing them with runtime tests * for a Unibus Map. * 2.11BSD - Remove ilreset since that's a vax'ism and is never *************** *** 63,70 **** #define ILUNIT(x) minor(x) int ilinit(),iloutput(),ilioctl(),ilwatch(); int ildebug = 0; ! short ilub = 0; ! long startnet = 0; /* * Ethernet software status per interface. --- 69,76 ---- #define ILUNIT(x) minor(x) int ilinit(),iloutput(),ilioctl(),ilwatch(); int ildebug = 0; ! static short ilub; ! extern long startnet; /* * Ethernet software status per interface. *************** *** 132,143 **** register struct ifnet *ifp = &is->is_if; register struct ildevice *addr = (struct ildevice *)ui->ui_addr; ! if (!startnet) { ! extern memaddr netdata; ! startnet = mfkd(&netdata); ! startnet = ctob(startnet); ! ilub = mfkd(&ubmap); /* get copy of kernel UBmap flag */ ! } ifp->if_unit = ui->ui_unit; ifp->if_name = "il"; ifp->if_mtu = ETHERMTU; --- 138,145 ---- register struct ifnet *ifp = &is->is_if; register struct ildevice *addr = (struct ildevice *)ui->ui_addr; ! ilub = mfkd(&ubmap); /* get copy of kernel UBmap flag */ ! ifp->if_unit = ui->ui_unit; ifp->if_name = "il"; ifp->if_mtu = ETHERMTU; *************** *** 208,214 **** register struct il_softc *is = &il_softc[unit]; register struct uba_device *ui = ilinfo[unit]; register struct ildevice *addr; ! register struct ifnet *ifp = &is->is_if; int s; /* not yet, if address still unknown */ --- 210,216 ---- register struct il_softc *is = &il_softc[unit]; register struct uba_device *ui = ilinfo[unit]; register struct ildevice *addr; ! struct ifnet *ifp = &is->is_if; int s; /* not yet, if address still unknown */ *************** *** 583,598 **** idst = ((struct sockaddr_in *)dst)->sin_addr; if (!arpresolve(&is->is_ac, m, &idst, edst, &usetrailers)) return (0); /* if not yet resolved */ - off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len; - if (usetrailers && off > 0 && (off & 0x1ff) == 0 && - m->m_off >= MMINOFF + 2 * sizeof (u_short)) { - type = ETHERTYPE_TRAIL + (off>>9); - m->m_off -= 2 * sizeof (u_short); - m->m_len += 2 * sizeof (u_short); - *mtod(m, u_short *) = htons((u_short)ETHERTYPE_IP); - *(mtod(m, u_short *) + 1) = htons((u_short)m->m_len); - goto gottrailertype; - } type = ETHERTYPE_IP; off = 0; goto gottype; --- 585,590 ---- *************** *** 618,635 **** m_freem(m); return(EAFNOSUPPORT); } - - gottrailertype: - /* - * Packet to be sent as trailer: move first packet - * (control information) to end of chain. - */ - while (m->m_next) - m = m->m_next; - m->m_next = m0; - m = m0->m_next; - m0->m_next = 0; - m0 = m; gottype: /* --- 610,615 ---- *** /VERSION.old Thu Jan 12 20:33:02 1995 --- /VERSION Fri Jan 13 19:47:16 1995 *************** *** 1,4 **** ! Current Patch Level: 216 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 217 2.11 BSD ============