From: Sam Leffler Date: Sun, 14 Nov 1982 15:05:22 +0000 (-0800) Subject: merge 4.1b with 4.1c X-Git-Tag: BSD-4_1c_2-Snapshot-Development~1849 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/4fce3bf9816218d3cead81ad945ddd9e9f5f27e6?hp=e74d4c15eb5613f80b168a31eff39ce7675014f6 merge 4.1b with 4.1c SCCS-vsn: sys/vax/if/if_acc.c 4.30 SCCS-vsn: sys/vax/if/if_dmc.c 4.21 SCCS-vsn: sys/vax/if/if_ec.c 4.29 SCCS-vsn: sys/vax/if/if_en.c 4.72 SCCS-vsn: sys/vax/if/if_il.c 4.14 SCCS-vsn: sys/vax/if/if_il.h 4.3 SCCS-vsn: sys/vax/if/if_ilreg.h 4.3 --- diff --git a/usr/src/sys/vax/if/if_acc.c b/usr/src/sys/vax/if/if_acc.c index a126465569..c40bc616a6 100644 --- a/usr/src/sys/vax/if/if_acc.c +++ b/usr/src/sys/vax/if/if_acc.c @@ -1,4 +1,4 @@ -/* if_acc.c 4.29 82/10/24 */ +/* if_acc.c 4.30 82/11/13 */ #include "acc.h" #ifdef NACC > 0 @@ -104,7 +104,7 @@ accattach(ui) struct impcb ifimp_impcb; } *ifimp; - if ((ifimp = (struct ifimpcb *)impattacch(ui, acreset)) == 0) + if ((ifimp = (struct ifimpcb *)impattacch(ui, accreset)) == 0) panic("accattach"); sc->acc_if = &ifimp->ifimp_if; ip = &ifimp->ifimp_impcb; diff --git a/usr/src/sys/vax/if/if_dmc.c b/usr/src/sys/vax/if/if_dmc.c index 7d0d3d906c..309a339bb6 100644 --- a/usr/src/sys/vax/if/if_dmc.c +++ b/usr/src/sys/vax/if/if_dmc.c @@ -1,4 +1,4 @@ -/* if_dmc.c 4.20 82/10/31 */ +/* if_dmc.c 4.21 82/11/13 */ #include "dmc.h" #if NDMC > 0 @@ -23,6 +23,7 @@ int dmcdebug = 1; #include #include "../net/if.h" +#include "../net/netisr.h" #include "../net/route.h" #include "../netinet/in.h" #include "../netinet/in_systm.h" @@ -336,7 +337,7 @@ dmcxint(unit) goto setup; if (IF_QFULL(inq)) { IF_DROP(inq); - (void) m_freem(m); + m_freem(m); } else IF_ENQUEUE(inq, m); @@ -356,7 +357,7 @@ setup: sc->sc_if.if_opackets++; sc->sc_oactive = 0; if (sc->sc_ifuba.ifu_xtofree) { - (void) m_freem(sc->sc_ifuba.ifu_xtofree); + m_freem(sc->sc_ifuba.ifu_xtofree); sc->sc_ifuba.ifu_xtofree = 0; } if (sc->sc_if.if_snd.ifq_head == 0) @@ -397,7 +398,8 @@ dmcoutput(ifp, m, dst) printd("dmcoutput\n"); if (dst->sa_family != (ui->ui_flags & DMC_AF)) { - printf("dmc%d: af%d not supported\n", ifp->if_unit, pf); + printf("dmc%d: af%d not supported\n", ifp->if_unit, + dst->sa_family); m_freem(m); return (EAFNOSUPPORT); } diff --git a/usr/src/sys/vax/if/if_ec.c b/usr/src/sys/vax/if/if_ec.c index bd39a67336..97526b4034 100644 --- a/usr/src/sys/vax/if/if_ec.c +++ b/usr/src/sys/vax/if/if_ec.c @@ -1,4 +1,4 @@ -/* if_ec.c 4.28 82/10/31 */ +/* if_ec.c 4.29 82/11/13 */ #include "ec.h" @@ -34,6 +34,7 @@ #include "../vaxuba/ubavar.h" #define ECMTU 1500 +#define ECMIN (60-14) #define ECMEM 0000000 int ecprobe(), ecattach(), ecrint(), ecxint(), eccollide(); @@ -620,8 +621,11 @@ bad: } /* - * Routine to copy from mbuf chain to transmitter + * Routine to copy from mbuf chain to transmit * buffer in UNIBUS memory. + * If packet size is less than the minimum legal size, + * the buffer is expanded. We probably should zero out the extra + * bytes for security, but that would slow things down. */ ecput(ecbuf, m) u_char *ecbuf; @@ -633,6 +637,8 @@ ecput(ecbuf, m) for (off = 2048, mp = m; mp; mp = mp->m_next) off -= mp->m_len; + if (2048 - off < ECMIN + sizeof (struct ec_header)) + off = 2048 - ECMIN - sizeof (struct ec_header); *(u_short *)ecbuf = off; bp = (u_char *)(ecbuf + off); for (mp = m; mp; mp = mp->m_next) { diff --git a/usr/src/sys/vax/if/if_en.c b/usr/src/sys/vax/if/if_en.c index 3478e295f3..4afefc4369 100644 --- a/usr/src/sys/vax/if/if_en.c +++ b/usr/src/sys/vax/if/if_en.c @@ -1,4 +1,4 @@ -/* if_en.c 4.71 82/10/31 */ +/* if_en.c 4.72 82/11/13 */ #include "en.h" @@ -455,7 +455,7 @@ enoutput(ifp, m0, dst) #ifdef INET case AF_INET: dest = ((struct sockaddr_in *)dst)->sin_addr.s_addr; - if (dest & 0x00ffff00) { + if (in_lnaof(*((struct in_addr *)&dest)) >= 0x100) { error = EPERM; /* ??? */ goto bad; } diff --git a/usr/src/sys/vax/if/if_il.c b/usr/src/sys/vax/if/if_il.c index e26c04927f..60fc050881 100644 --- a/usr/src/sys/vax/if/if_il.c +++ b/usr/src/sys/vax/if/if_il.c @@ -1,4 +1,4 @@ -/* if_il.c 4.13 82/10/31 */ +/* if_il.c 4.14 82/11/13 */ #include "il.h" @@ -33,6 +33,7 @@ #include "../vaxuba/ubavar.h" #define ILMTU 1500 +#define ILMIN (60-14) int ilprobe(), ilattach(), ilrint(), ilcint(); struct uba_device *ilinfo[NIL]; @@ -81,7 +82,7 @@ ilprobe(reg) #ifdef lint br = 0; cvec = br; br = cvec; - ilrint(0); ilcint(0); ilwatch(0); + i = 0; ilrint(i); ilcint(i); ilwatch(i); #endif addr->il_csr = ILC_OFFLINE|IL_CIE; @@ -122,7 +123,7 @@ ilattach(ui) printf("il%d: reset failed, csr=%b\n", ui->ui_unit, addr->il_csr, IL_BITS); - is->is_ubaddr = uballoc(ui->ui_ubanum, &is->is_stats, + is->is_ubaddr = uballoc(ui->ui_ubanum, (caddr_t)&is->is_stats, sizeof (struct il_stats), 0); addr->il_bar = is->is_ubaddr & 0xffff; addr->il_bcr = sizeof (struct il_stats); @@ -199,10 +200,21 @@ ilinit(unit) is->is_if.if_flags &= ~IFF_UP; return; } - is->is_ubaddr = uballoc(ui->ui_ubanum, &is->is_stats, + is->is_ubaddr = uballoc(ui->ui_ubanum, (caddr_t)&is->is_stats, sizeof (struct il_stats), 0); addr = (struct ildevice *)ui->ui_addr; + /* + * Turn off source address insertion (it's faster this way), + * and set board online. + */ + s = splimp(); + addr->il_csr = ILC_CISA; + while ((addr->il_csr & IL_CDONE) == 0) + ; + addr->il_csr = ILC_ONLINE; + while ((addr->il_csr & IL_CDONE) == 0) + ; /* * Set board online. * Hang receive buffer and start any pending @@ -236,7 +248,7 @@ ilinit(unit) ilstart(dev) dev_t dev; { - int unit = ILUNIT(dev), dest, len; + int unit = ILUNIT(dev), len; struct uba_device *ui = ilinfo[unit]; register struct il_softc *is = &il_softc[unit]; register struct ildevice *addr; @@ -248,13 +260,22 @@ ilstart(dev) if (m == 0) { if ((is->is_flags & ILF_STATPENDING) == 0) return; - addr->il_bar = is->is_ubaddr & 0xfff; + addr->il_bar = is->is_ubaddr & 0xffff; addr->il_bcr = sizeof (struct il_stats); csr = ((is->is_ubaddr >> 2) & IL_EUA)|ILC_STAT|IL_RIE|IL_CIE; is->is_flags &= ~ILF_STATPENDING; goto startcmd; } len = if_wubaput(&is->is_ifuba, m); + /* + * Ensure minimum packet length. + * This makes the safe assumtion that there are no virtual holes + * after the data. + * For security, it might be wise to zero out the added bytes, + * but we're mainly interested in speed at the moment. + */ + if (len - sizeof(struct il_xheader) < ILMIN) + len = ILMIN + sizeof(struct il_xheader); if (is->is_ifuba.ifu_flags & UBA_NEEDBDP) UBAPURGE(is->is_ifuba.ifu_uba, is->is_ifuba.ifu_w.ifrw_bdp); addr->il_bar = is->is_ifuba.ifu_w.ifrw_info & 0xffff; @@ -441,7 +462,7 @@ iloutput(ifp, m0, dst) register struct il_softc *is = &il_softc[ifp->if_unit]; register struct mbuf *m = m0; register struct il_xheader *il; - register int off, i; + register int off; switch (dst->sa_family) { @@ -503,15 +524,16 @@ gottype: } il = mtod(m, struct il_xheader *); if ((dest &~ 0xff) == 0) - bcopy(ilbroadcastaddr, il->ilx_dhost, 6); + bcopy((caddr_t)ilbroadcastaddr, (caddr_t)il->ilx_dhost, 6); else { u_char *to = dest & 0x8000 ? is->is_stats.ils_addr : il_ectop; - bcopy(to, il->ilx_dhost, 3); + bcopy((caddr_t)to, (caddr_t)il->ilx_dhost, 3); il->ilx_dhost[3] = (dest>>8) & 0x7f; il->ilx_dhost[4] = (dest>>16) & 0xff; il->ilx_dhost[5] = (dest>>24) & 0xff; } + bcopy((caddr_t)is->is_stats.ils_addr, (caddr_t)il->ilx_shost, 6); il->ilx_type = type; /* diff --git a/usr/src/sys/vax/if/if_il.h b/usr/src/sys/vax/if/if_il.h index fe07df303f..bdc7ca6629 100644 --- a/usr/src/sys/vax/if/if_il.h +++ b/usr/src/sys/vax/if/if_il.h @@ -1,10 +1,12 @@ -/* if_il.h 4.2 82/06/23 */ +/* if_il.h 4.3 82/11/13 */ /* * Structure of an Ethernet header -- transmit format + * (source address insertion disabled) */ struct il_xheader { u_char ilx_dhost[6]; /* Destination Host */ + u_char ilx_shost[6]; /* Source Host */ u_short ilx_type; /* Type of packet */ }; diff --git a/usr/src/sys/vax/if/if_ilreg.h b/usr/src/sys/vax/if/if_ilreg.h index 0037280bb4..3e52370492 100644 --- a/usr/src/sys/vax/if/if_ilreg.h +++ b/usr/src/sys/vax/if/if_ilreg.h @@ -1,4 +1,4 @@ -/* if_ilreg.h 4.2 82/06/23 */ +/* if_ilreg.h 4.3 82/11/13 */ /* * Interlan Ethernet Communications Controller interface @@ -33,6 +33,11 @@ struct ildevice { #define ILC_OFFLINE 0x0800 /* Go Offline */ #define ILC_ONLINE 0x0900 /* Go Online */ #define ILC_DIAG 0x0a00 /* Run On-board Diagnostics */ +#define ILC_ISA 0x0d00 /* Set Insert Source Address Mode */ +#define ILC_CISA 0x0e00 /* Clear Insert Source Address Mode */ +#define ILC_DEFPA 0x0f00 /* Set Physical Address to Default */ +#define ILC_ALLMC 0x1000 /* Set Receive All Multicast Packets */ +#define ILC_CALLMC 0x1100 /* Clear Receive All Multicast */ #define ILC_STAT 0x1800 /* Report and Reset Statistics */ #define ILC_DELAYS 0x1900 /* Report Collision Delay Times */ #define ILC_RCV 0x2000 /* Supply Receive Buffer */ @@ -40,6 +45,7 @@ struct ildevice { #define ILC_XMIT 0x2900 /* Load Transmit Data and Send */ #define ILC_LDGRPS 0x2a00 /* Load Group Addresses */ #define ILC_RMGRPS 0x2b00 /* Delete Group Addresses */ +#define ILC_LDPA 0x2c00 /* Load Physical Address */ #define ILC_FLUSH 0x3000 /* Flush Receive BAR/BCR Queue */ #define ILC_RESET 0x3f00 /* Reset */